diff --git a/CHANGELOG.md b/CHANGELOG.md index 413df241..f1a356d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## Version 0.10.0 RC1 [2020-xx-xx] +Note: If the project file is opened by this version of novelWriter, the project file can no longer be read by an earlier version due to the change of how autoReplace settings are stored. + +**User Interface** + +* The Session Log dialog has been redesigned and now has a few more filter options. The filters now also update the filtered time count properly. The dialog now shows a histogram of words added in a given session, or optionally, on a given date. The filtered log data can also be saved as a JSON or CSV file, the latter suitable for importing to a spread sheet. The new dialog tool required a new session log file format, so the new session log has been given a new file name. The old log file will be left untouched in the project's `meta` folder. For projects created prior to this change, the log will record a word count offset that will be subtracted from the first entry such that the first word diff will always be 0 instead of the total word count of the entire project. Such a large word diff would otherwise saturate the histogram. PR #339. + +**Other Changes** + +* The way the auto-replace settings are stored in the project XML file has been changed in order to be more consistent with other features, and to avoid a potential pitfall in defining the tag name from a user-entered string. The project class retains its ability to read the old format of the file, and will save in the new format. PR #344. + ## Version 0.9.2 [2020-06-26] diff --git a/nw/core/project.py b/nw/core/project.py index 6b17b51a..5e5400c9 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -356,6 +356,15 @@ class NWProject(): # Check Project Storage Version # ============================= + # Changes: + # 1.0 : Original file format. + # 1.1 : Changes the way documents are structure in the project + # folder from data_X, where X is the first hex value of + # the handle, to a single content folder. + # 1.2 : Changes the way autoReplace entries are stored. The 1.1 + # parser will lose the autoReplace settings if allowed to + # read the file. Introduced in version 0.10. + if fileVersion == "1.0": msgBox = QMessageBox() msgRes = msgBox.question(self.theParent, "Old Project Version", ( @@ -369,12 +378,14 @@ class NWProject(): if msgRes != QMessageBox.Yes: return False - elif fileVersion != "1.1": + elif fileVersion != "1.1" and fileVersion != "1.2": self.makeAlert(( - "Unknown or unsupported %s project format. " - "The project cannot be opened by this version of %s." - ) % ( - nw.__package__, nw.__package__ + "Unknown or unsupported {nw:s} project file format. " + "The project cannot be opened by this version of {nw:s}. " + "The file was saved with {nw:s} version {vers:s}." + ).format( + nw = nw.__package__, + vers = appVersion, ), nwAlert.ERROR) return False @@ -512,7 +523,7 @@ class NWProject(): nwXML = etree.Element("novelWriterXML", attrib={ "appVersion" : str(nw.__version__), "hexVersion" : str(nw.__hexversion__), - "fileVersion" : "1.1", + "fileVersion" : "1.2", "timeStamp" : formatTimeStamp(saveTime), }) diff --git a/nw/gui/sessionlog.py b/nw/gui/sessionlog.py index cab4a92c..9e620f13 100644 --- a/nw/gui/sessionlog.py +++ b/nw/gui/sessionlog.py @@ -497,16 +497,17 @@ class GuiSessionLog(QDialog): wcTotal += wcNotes dwTotal = wcTotal - pcTotal + if isFirst: + # Subtract the offset from the first list entry + dwTotal -= self.wordOffset + dwTotal = max(dwTotal, 0) # But don't go negative + isFirst = False + if hideZeros and dwTotal == 0: continue if hideNegative and dwTotal < 0: continue - if isFirst: - # Subtract the offset from the first list entry - dwTotal -= self.wordOffset - isFirst = False - if groupByDay: sStart = dStart.strftime(nwConst.dStampFmt) else: diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 015816ff..c5a194a5 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 589 - 102 - 24247 + 593 + 103 + 24563 False