Release 2.0 RC 2 (#1231)

This commit is contained in:
Veronica Berglyd Olsen
2022-11-13 10:06:39 +01:00
committed by GitHub
4 changed files with 18 additions and 28 deletions
+4
View File
@@ -74,6 +74,8 @@ opened, a request to update the file format will show up.
reader class is capable of reading all file formats that have been used thus far. The various reader class is capable of reading all file formats that have been used thus far. The various
data classes have been improved, and a new XML file formart version 1.5 added. Issue #1189. data classes have been improved, and a new XML file formart version 1.5 added. Issue #1189.
PRs #1221 and #1232. PRs #1221 and #1232.
* The index is now automatically rebuilt when the project file format is updated. Issue #1235.
PR #1236.
* The project folder on disk is now wrapped in a storage class that the project accesses files * The project folder on disk is now wrapped in a storage class that the project accesses files
through. It also handles lock files and archiving used for backup. The change is in preparation through. It also handles lock files and archiving used for backup. The change is in preparation
for adding a potential single file format. Issue #1222. PR #1225. for adding a potential single file format. Issue #1222. PR #1225.
@@ -83,6 +85,8 @@ opened, a request to update the file format will show up.
Issue #1152. PR #1225. Issue #1152. PR #1225.
* The Config class has been refactored extensively and now also uses pathlib for all paths. Tests * The Config class has been refactored extensively and now also uses pathlib for all paths. Tests
are also switched to using pathlib. Issue #1224. PRs #1228 and #1229. are also switched to using pathlib. Issue #1224. PRs #1228 and #1229.
* The updating of tree order method of the project tree class has been updated for better
performance. PR #1236.
---- ----
-10
View File
@@ -74,7 +74,6 @@ class NWProject(QObject):
# Project Status # Project Status
self._projOpened = 0 # The time stamp of when the project file was opened self._projOpened = 0 # The time stamp of when the project file was opened
self._projChanged = False # The project has unsaved changes self._projChanged = False # The project has unsaved changes
self._projAltered = False # The project has been altered this session
self._lockedBy = None # Data on which computer has the project open self._lockedBy = None # Data on which computer has the project open
self._projFiles = [] # A list of all files in the content folder on load self._projFiles = [] # A list of all files in the content folder on load
@@ -118,10 +117,6 @@ class NWProject(QObject):
def projChanged(self): def projChanged(self):
return self._projChanged return self._projChanged
@property
def projAltered(self):
return self._projAltered
@property @property
def projFiles(self): def projFiles(self):
return self._projFiles return self._projFiles
@@ -236,7 +231,6 @@ class NWProject(QObject):
# Project Status # Project Status
self._projOpened = 0 self._projOpened = 0
self._projChanged = False self._projChanged = False
self._projAltered = False
# Project Tree # Project Tree
self._storage.clear() self._storage.clear()
@@ -375,7 +369,6 @@ class NWProject(QObject):
self.updateWordCounts() self.updateWordCounts()
self._projOpened = time() self._projOpened = time()
self._projAltered = False
self._storage.writeLockFile() self._storage.writeLockFile()
self.setProjectChanged(False) self.setProjectChanged(False)
@@ -559,9 +552,6 @@ class NWProject(QObject):
if isinstance(value, bool): if isinstance(value, bool):
self._projChanged = value self._projChanged = value
self.projectStatusChanged.emit(self._projChanged) self.projectStatusChanged.emit(self._projChanged)
if value:
# If we've changed the project at all, this should be True
self._projAltered = True
return self._projChanged return self._projChanged
## ##
+14 -16
View File
@@ -404,22 +404,20 @@ class GuiMain(QMainWindow):
if self.docEditor.docChanged(): if self.docEditor.docChanged():
self.saveDocument() self.saveDocument()
if self.theProject.projAltered: saveOK = self.saveProject()
saveOK = self.saveProject() doBackup = False
doBackup = False if self.theProject.data.doBackup and self.mainConf.backupOnClose:
if self.theProject.data.doBackup and self.mainConf.backupOnClose: doBackup = True
doBackup = True if self.mainConf.askBeforeBackup:
if self.mainConf.askBeforeBackup: msgYes = self.askQuestion(
msgYes = self.askQuestion( self.tr("Backup Project"),
self.tr("Backup Project"), self.tr("Backup the current project?")
self.tr("Backup the current project?") )
) if not msgYes:
if not msgYes: doBackup = False
doBackup = False
if doBackup: if doBackup:
self.theProject.backupProject(False) self.theProject.backupProject(False)
else:
saveOK = True
if saveOK: if saveOK:
self.closeDocument() self.closeDocument()
-2
View File
@@ -516,11 +516,9 @@ def testCoreProject_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
# Spell check # Spell check
theProject.setProjectChanged(False) theProject.setProjectChanged(False)
theProject._projAltered = False
theProject.data.setSpellCheck(True) theProject.data.setSpellCheck(True)
theProject.data.setSpellCheck(False) theProject.data.setSpellCheck(False)
assert theProject.projChanged is True assert theProject.projChanged is True
assert theProject.projAltered is True
assert theProject.projOpened > 0 assert theProject.projOpened > 0
# Spell language # Spell language