diff -r c04e878aa308 -r e4069ddd7dc7 src/eric7/MicroPython/MicroPythonWindow.py --- a/src/eric7/MicroPython/MicroPythonWindow.py Tue Jan 23 12:21:15 2024 +0100 +++ b/src/eric7/MicroPython/MicroPythonWindow.py Wed Jan 24 18:52:50 2024 +0100 @@ -43,9 +43,12 @@ """ Class implementing the standalone MicroPython window. + @signal editorCountChanged(count) emitted whenever the count of open editors + changed @signal preferencesChanged() emitted after the preferences were changed """ + editorCountChanged = pyqtSignal(int) preferencesChanged = pyqtSignal() def __init__(self, parent=None): @@ -305,6 +308,7 @@ editor.show() self.__editors.append(editor) + self.editorCountChanged.emit(len(self.__editors)) def newEditorWithText(self, text, language="", fileName=""): """ @@ -325,6 +329,7 @@ editor.show() self.__editors.append(editor) + self.editorCountChanged.emit(len(self.__editors)) def __editorClosing(self, editor): """ @@ -336,6 +341,7 @@ with contextlib.suppress(ValueError): self.__editors.remove(editor) del editor + self.editorCountChanged.emit(len(self.__editors)) if self.__editors: # make the last one (i.e. most recently opened one) the active editor @@ -343,6 +349,15 @@ else: self.__activeEditor = None + def getOpenEditorsCount(self): + """ + Public method to get the number of open editors. + + @return number of open editors + @rtype int + """ + return len(self.__editors) + @pyqtSlot(QWidget, QWidget) def __appFocusChanged(self, old, now): """