Fixed another issue causing a changed file with multiple views not to be saved upon shutdown. eric7

Sat, 10 Dec 2022 17:56:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 10 Dec 2022 17:56:44 +0100
branch
eric7
changeset 9602
28e7f6cdf385
parent 9601
5be43798a735
child 9603
4c17d54de9a3

Fixed another issue causing a changed file with multiple views not to be saved upon shutdown.

src/eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
src/eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.QScintilla.Lexers.__init__.html file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.ViewManager.ViewManager.html file | annotate | diff | comparison | revisions
src/eric7/Project/CreateDialogCodeDialog.py file | annotate | diff | comparison | revisions
src/eric7/ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
--- a/src/eric7/APIs/Python3/eric7.api	Sat Dec 10 16:59:48 2022 +0100
+++ b/src/eric7/APIs/Python3/eric7.api	Sat Dec 10 17:56:44 2022 +0100
@@ -10677,7 +10677,7 @@
 eric7.ViewManager.ViewManager.ViewManager.changeCaption?7
 eric7.ViewManager.ViewManager.ViewManager.checkActions?7
 eric7.ViewManager.ViewManager.ViewManager.checkAllDirty?4()
-eric7.ViewManager.ViewManager.ViewManager.checkDirty?4(editor, autosave=False)
+eric7.ViewManager.ViewManager.ViewManager.checkDirty?4(editor, autosave=False, closeIt=False)
 eric7.ViewManager.ViewManager.ViewManager.checkFileDirty?4(fn)
 eric7.ViewManager.ViewManager.ViewManager.clearRecent?4()
 eric7.ViewManager.ViewManager.ViewManager.cloneEditor?4(caller, filetype, fn)
Binary file src/eric7/Documentation/Help/source.qch has changed
--- a/src/eric7/Documentation/Source/eric7.QScintilla.Lexers.__init__.html	Sat Dec 10 16:59:48 2022 +0100
+++ b/src/eric7/Documentation/Source/eric7.QScintilla.Lexers.__init__.html	Sat Dec 10 17:56:44 2022 +0100
@@ -289,40 +289,40 @@
 </p>
 <dl>
 
-<dt><i>name</i></dt>
+<dt><i>name</i> (str)</dt>
 <dd>
-lexer language name (string)
+lexer language name
 </dd>
-<dt><i>displayString</i></dt>
+<dt><i>displayString</i> (str)</dt>
 <dd>
-display string (string)
+display string
 </dd>
-<dt><i>filenameSample</i></dt>
+<dt><i>filenameSample</i> (str)</dt>
 <dd>
-dummy filename to derive lexer name (string)
+dummy filename to derive lexer name
 </dd>
-<dt><i>getLexerFunc</i></dt>
+<dt><i>getLexerFunc</i> (function)</dt>
 <dd>
 reference to a function instantiating the specific
         lexer. This function must take a reference to the parent as its only
         argument.
 </dd>
-<dt><i>openFilters</i></dt>
+<dt><i>openFilters</i> (list of str)</dt>
 <dd>
-list of open file filters (list of strings)
+list of open file filters
 </dd>
-<dt><i>saveFilters</i></dt>
+<dt><i>saveFilters</i> (list of str)</dt>
 <dd>
-list of save file filters (list of strings)
+list of save file filters
 </dd>
-<dt><i>defaultAssocs</i></dt>
+<dt><i>defaultAssocs</i> (list of str)</dt>
 <dd>
-default lexer associations (list of strings of
-        filename wildcard patterns to be associated with the lexer)
+default lexer associations (list of filename wildcard
+        patterns to be associated with the lexer)
 </dd>
-<dt><i>iconFileName</i></dt>
+<dt><i>iconFileName</i> (str)</dt>
 <dd>
-name of an icon file (string)
+name of an icon file
 </dd>
 </dl>
 <dl>
@@ -344,9 +344,9 @@
 </p>
 <dl>
 
-<dt><i>name</i></dt>
+<dt><i>name</i> (str)</dt>
 <dd>
-lexer language name (string)
+lexer language name
 </dd>
 </dl>
 <div align="right"><a href="#top">Up</a></div>
--- a/src/eric7/Documentation/Source/eric7.ViewManager.ViewManager.html	Sat Dec 10 16:59:48 2022 +0100
+++ b/src/eric7/Documentation/Source/eric7.ViewManager.ViewManager.html	Sat Dec 10 17:56:44 2022 +0100
@@ -2887,7 +2887,7 @@
 </dl>
 <a NAME="ViewManager.checkDirty" ID="ViewManager.checkDirty"></a>
 <h4>ViewManager.checkDirty</h4>
-<b>checkDirty</b>(<i>editor, autosave=False</i>)
+<b>checkDirty</b>(<i>editor, autosave=False, closeIt=False</i>)
 
 <p>
         Public method to check the dirty status and open a message window.
@@ -2898,10 +2898,15 @@
 <dd>
 editor window to check
 </dd>
-<dt><i>autosave</i> (bool)</dt>
+<dt><i>autosave</i> (bool (optional))</dt>
 <dd>
 flag indicating that the file should be saved
-            automatically
+            automatically (defaults to False)
+</dd>
+<dt><i>closeIt</i> (bool (optional))</dt>
+<dd>
+flag indicating a check in order to close the editor
+            (defaults to False)
 </dd>
 </dl>
 <dl>
--- a/src/eric7/Project/CreateDialogCodeDialog.py	Sat Dec 10 16:59:48 2022 +0100
+++ b/src/eric7/Project/CreateDialogCodeDialog.py	Sat Dec 10 17:56:44 2022 +0100
@@ -106,7 +106,7 @@
         if os.path.exists(self.srcFile):
             vm = ericApp().getObject("ViewManager")
             ed = vm.getOpenEditor(self.srcFile)
-            if ed and not vm.checkDirty(ed):
+            if ed and not ed.checkDirty():
                 self.__initError = True
                 return
 
--- a/src/eric7/ViewManager/ViewManager.py	Sat Dec 10 16:59:48 2022 +0100
+++ b/src/eric7/ViewManager/ViewManager.py	Sat Dec 10 17:56:44 2022 +0100
@@ -5373,23 +5373,26 @@
         # Open up the new files.
         self.openSourceFile(prog)
 
-    def checkDirty(self, editor, autosave=False):
+    def checkDirty(self, editor, autosave=False, closeIt=False):
         """
         Public method to check the dirty status and open a message window.
 
         @param editor editor window to check
         @type Editor
         @param autosave flag indicating that the file should be saved
-            automatically
-        @type bool
+            automatically (defaults to False)
+        @type bool (optional)
+        @param closeIt flag indicating a check in order to close the editor
+            (defaults to False)
+        @type bool (optional)
         @return flag indicating successful reset of the dirty flag
         @rtype bool
         """
         if editor.isModified():
             fn = editor.getFileName()
             # ignore the dirty status, if there is more than one open editor
-            # for the same file
-            if fn and self.getOpenEditorCount(fn) > 1 and not autosave:
+            # for the same file (only for closing)
+            if fn and self.getOpenEditorCount(fn) > 1 and closeIt:
                 return True
 
             if fn is None:
@@ -5463,7 +5466,7 @@
         @rtype bool
         """
         # save file if necessary
-        if not ignoreDirty and not self.checkDirty(editor):
+        if not ignoreDirty and not self.checkDirty(editor, closeIt=True):
             return False
 
         # get the filename of the editor for later use
@@ -5733,6 +5736,9 @@
         self.editorOpened.emit(fn)
         self.editorOpenedEd.emit(editor)
 
+        if caller.isModified():
+            editor.setModified(True)
+
         return editor, assembly
 
     def addToRecentList(self, fn):

eric ide

mercurial