From c0aca6a06907773dcf665b8bbdef937bcbea6a62 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 2 Nov 2019 14:11:50 +0100 Subject: [PATCH] Only make a copy of the project file when not autosaving --- nw/gui/winmain.py | 6 +++--- nw/project/project.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 872e9c66..0d86f84b 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -313,7 +313,7 @@ class GuiMain(QMainWindow): return True - def saveProject(self): + def saveProject(self, isAuto=False): """Save the current project. """ if not self.hasProject: @@ -327,7 +327,7 @@ class GuiMain(QMainWindow): return False self.treeView.saveTreeOrder() - self.theProject.saveProject() + self.theProject.saveProject(isAuto) self.theIndex.saveIndex() self.mainMenu.updateRecentProjects() @@ -703,7 +703,7 @@ class GuiMain(QMainWindow): def _autoSaveProject(self): if self.hasProject and self.theProject.projChanged and self.theProject.projPath is not None: logger.debug("Autosaving project") - self.saveProject() + self.saveProject(isAuto=True) return def _autoSaveDocument(self): diff --git a/nw/project/project.py b/nw/project/project.py index 71891185..aa9bc9d2 100644 --- a/nw/project/project.py +++ b/nw/project/project.py @@ -280,7 +280,7 @@ class NWProject(): return True - def saveProject(self): + def saveProject(self, isAuto=False): if self.projPath is None: self.makeAlert("Project path not set, cannot save.", nwAlert.ERROR) @@ -296,7 +296,8 @@ class NWProject(): logger.debug("Saving project: %s" % self.projPath) # Save a copy of the current file, just in case - self._maintainPrevious() + if not isAuto: + self._maintainPrevious() # Root element and project details logger.debug("Writing project meta")