When closing a project, it should ask for backup even if the project is saved.

This commit is contained in:
Veronica K. B. Olsen
2019-10-20 13:56:21 +02:00
parent 6638c5187e
commit 77c6caacee
2 changed files with 19 additions and 13 deletions
+1 -1
View File
@@ -225,7 +225,7 @@ class GuiMain(QMainWindow):
if self.docEditor.docChanged: if self.docEditor.docChanged:
self.saveDocument() self.saveDocument()
if self.theProject.projChanged: if self.theProject.projAltered:
saveOK = self.saveProject() saveOK = self.saveProject()
doBackup = False doBackup = False
if self.theProject.doBackup and self.mainConf.backupOnClose: if self.theProject.doBackup and self.mainConf.backupOnClose:
+18 -12
View File
@@ -34,22 +34,23 @@ class NWProject():
# Internal # Internal
self.theParent = theParent self.theParent = theParent
self.mainConf = self.theParent.mainConf self.mainConf = self.theParent.mainConf
self.projChanged = None self.projOpened = None # The time stamp of when the project file was opened
self.projOpened = None self.projChanged = None # The project has unsaved changes
self.projAltered = None # The project has been altered this session (used to trigger backup)
# Debug # Debug
self.handleSeed = None self.handleSeed = None
# Class Settings # Class Settings
self.projTree = None self.projTree = None # Holds all the items of the project
self.treeOrder = None self.treeOrder = None # The order of the tree items on the tree view
self.treeRoots = None self.treeRoots = None # The root items of the tree
self.trashRoot = None self.trashRoot = None # The handle of the trash root folder
self.projPath = None self.projPath = None # The full path to where the currently open project is saved
self.projMeta = None self.projMeta = None # The full path to the project's meta data folder
self.projCache = None self.projCache = None # The full path to the project's cache folder
self.projDict = None self.projDict = None # The spell check dictionary
self.projFile = None self.projFile = None # The file name of the project main xml file
# Project Meta # Project Meta
self.projName = None self.projName = None
@@ -140,8 +141,9 @@ class NWProject():
def clearProject(self): def clearProject(self):
self.projChanged = None
self.projOpened = None self.projOpened = None
self.projChanged = None
self.projAltered = False
# Project Settings # Project Settings
self.projTree = {} self.projTree = {}
@@ -267,6 +269,7 @@ class NWProject():
self._scanProjectFolder() self._scanProjectFolder()
self.setProjectChanged(False) self.setProjectChanged(False)
self.projOpened = time() self.projOpened = time()
self.projAltered = False
return True return True
@@ -458,6 +461,9 @@ class NWProject():
def setProjectChanged(self, bValue): def setProjectChanged(self, bValue):
self.projChanged = bValue self.projChanged = bValue
self.theParent.setProjectStatus(self.projChanged) self.theParent.setProjectStatus(self.projChanged)
if bValue:
# If we've changed the project at all, this should be True
self.projAltered = True
return self.projChanged return self.projChanged
## ##