eric6/ViewManager/ViewManager.py

changeset 8379
ef170cde761b
parent 8317
0703d36de27c
child 8400
b3eefd7e58d1
--- a/eric6/ViewManager/ViewManager.py	Sun May 23 11:54:57 2021 +0200
+++ b/eric6/ViewManager/ViewManager.py	Sun May 23 18:39:22 2021 +0200
@@ -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):
         """

eric ide

mercurial