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
data classes have been improved, and a new XML file formart version 1.5 added. Issue #1189.
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
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.
@@ -83,6 +85,8 @@ opened, a request to update the file format will show up.
Issue #1152. PR #1225.
* 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.
* 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
self._projOpened = 0 # The time stamp of when the project file was opened
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._projFiles = [] # A list of all files in the content folder on load
@@ -118,10 +117,6 @@ class NWProject(QObject):
def projChanged(self):
return self._projChanged
@property
def projAltered(self):
return self._projAltered
@property
def projFiles(self):
return self._projFiles
@@ -236,7 +231,6 @@ class NWProject(QObject):
# Project Status
self._projOpened = 0
self._projChanged = False
self._projAltered = False
# Project Tree
self._storage.clear()
@@ -375,7 +369,6 @@ class NWProject(QObject):
self.updateWordCounts()
self._projOpened = time()
self._projAltered = False
self._storage.writeLockFile()
self.setProjectChanged(False)
@@ -559,9 +552,6 @@ class NWProject(QObject):
if isinstance(value, bool):
self._projChanged = value
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
##
+14 -16
View File
@@ -404,22 +404,20 @@ class GuiMain(QMainWindow):
if self.docEditor.docChanged():
self.saveDocument()
if self.theProject.projAltered:
saveOK = self.saveProject()
doBackup = False
if self.theProject.data.doBackup and self.mainConf.backupOnClose:
doBackup = True
if self.mainConf.askBeforeBackup:
msgYes = self.askQuestion(
self.tr("Backup Project"),
self.tr("Backup the current project?")
)
if not msgYes:
doBackup = False
if doBackup:
self.theProject.backupProject(False)
else:
saveOK = True
saveOK = self.saveProject()
doBackup = False
if self.theProject.data.doBackup and self.mainConf.backupOnClose:
doBackup = True
if self.mainConf.askBeforeBackup:
msgYes = self.askQuestion(
self.tr("Backup Project"),
self.tr("Backup the current project?")
)
if not msgYes:
doBackup = False
if doBackup:
self.theProject.backupProject(False)
if saveOK:
self.closeDocument()
-2
View File
@@ -516,11 +516,9 @@ def testCoreProject_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
# Spell check
theProject.setProjectChanged(False)
theProject._projAltered = False
theProject.data.setSpellCheck(True)
theProject.data.setSpellCheck(False)
assert theProject.projChanged is True
assert theProject.projAltered is True
assert theProject.projOpened > 0
# Spell language