diff -r 197414ba11cc -r b3eefd7e58d1 eric6/ViewManager/ViewManager.py --- a/eric6/ViewManager/ViewManager.py Sat May 01 14:27:38 2021 +0200 +++ b/eric6/ViewManager/ViewManager.py Thu Jun 03 11:39:23 2021 +0200 @@ -1448,7 +1448,7 @@ self.esm = QSignalMapper(self) try: - self.alignMapper.mappedInt.connect(self.__editorCommand) + self.esm.mappedInt.connect(self.__editorCommand) except AttributeError: # pre Qt 5.15 self.esm.mapped[int].connect(self.__editorCommand) @@ -4420,7 +4420,17 @@ res = self.checkDirty(editor) return res - + + def hasDirtyEditor(self): + """ + Public method to ask, if any of the open editors contains unsaved + changes. + + @return flag indicating at least one editor has unsaved changes + @rtype bool + """ + return any(editor.isModified() for editor in self.editors) + def closeEditor(self, editor, ignoreDirty=False): """ Public method to close an editor window. @@ -4474,13 +4484,16 @@ return res - def closeAllWindows(self): - """ - Public method to close all editor windows via file menu. + def closeAllWindows(self, ignoreDirty=False): + """ + Public method to close all editor windows. + + @param ignoreDirty flag indicating to ignore the 'dirty' status + @type bool """ savedEditors = self.editors[:] for editor in savedEditors: - self.closeEditor(editor) + self.closeEditor(editor, ignoreDirty=ignoreDirty) def closeWindow(self, fn, ignoreDirty=False): """