eric7/ViewManager/ViewManager.py

branch
eric7
changeset 8370
c492b40a2224
parent 8358
144a6b854f70
child 8519
fd4722a8f782
--- a/eric7/ViewManager/ViewManager.py	Sun May 23 16:37:26 2021 +0200
+++ b/eric7/ViewManager/ViewManager.py	Sun May 23 18:39:22 2021 +0200
@@ -4417,7 +4417,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.
@@ -4471,13 +4481,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