From 045a595537a6390639a56a609a667d92271aa4cf Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 20 Feb 2022 22:05:31 +0100 Subject: [PATCH 1/4] Implement project file format 1.4 (#993) * Update the item class with more compact item storage format * Bump version and file version * Update tests * Add explicit test coverage for format conversions for item class * Update the documentation --- docs/source/usage_projectformat.rst | 25 +- novelwriter/__init__.py | 4 +- novelwriter/core/item.py | 63 ++-- novelwriter/core/project.py | 7 +- sample/nwProject.nwx | 316 +++++------------- tests/lipsum/nwProject.nwx | 270 ++++----------- tests/minimal/nwProject.nwx | 93 ++---- .../coreProject_NewCustomA_nwProject.nwx | 274 ++++----------- .../coreProject_NewCustomB_nwProject.nwx | 163 +++------ .../coreProject_NewFile_nwProject.nwx | 117 ++----- .../coreProject_NewMinimal_nwProject.nwx | 89 ++--- .../coreProject_NewRoot_nwProject.nwx | 125 ++----- .../guiEditor_Main_Final_nwProject.nwx | 142 +++----- .../guiEditor_Main_Initial_nwProject.nwx | 89 ++--- .../guiProjSettings_Dialog_nwProject.nwx | 89 ++--- tests/test_core/test_core_item.py | 136 ++++++-- tests/test_core/test_core_tree.py | 53 ++- 17 files changed, 666 insertions(+), 1389 deletions(-) diff --git a/docs/source/usage_projectformat.rst b/docs/source/usage_projectformat.rst index ea0b55b5..6a7c4c8b 100644 --- a/docs/source/usage_projectformat.rst +++ b/docs/source/usage_projectformat.rst @@ -11,13 +11,32 @@ changes require minor actions from the user. The key changes in the formats are listed below, as well as the user actions required where applicable. +.. caution:: + + When you update a project from one format version to the next, the project can no longer be + opened by a version of novelWriter prior to the version where the new file format was + introduced. You will get a notification about any updates to your project file format and will + have the option to decline the upgrade. + + +.. _a_prjfmt_1_4: + +Format 1.4 Changes +================== + +This project format was introduced in novelWriter version 1.7. + +This format changes the way project items (folders, documents and notes) are stored. It is a more +compact format that is simpler and faster to parse, and easier to extend. The conversion is done +automatically the first time a project is loaded. No user action is required. + .. _a_prjfmt_1_3: Format 1.3 Changes ================== -This project format vas introduces in novelWriter version 1.5. +This project format was introduced in novelWriter version 1.5. With this format, the number of document layouts was reduced from 8 to 2. The conversion of document layouts is performed automatically when the project is opened. @@ -55,7 +74,7 @@ should be used only a few places in any given project. These are as follows: Format 1.2 Changes ================== -This project format was introduces in novelWriter version 0.10. +This project format was introduced in novelWriter version 0.10. With this format, the way auto-replace entries were stored in the main project XML file changed. Opening an old project automatically converts the storage format up to and including version 1.1.1. @@ -69,7 +88,7 @@ auto-replace is not being used, can still be opened in novelWriter as of version Format 1.1 Changes ================== -This project format was introduces in novelWriter version 0.7. +This project format was introduced in novelWriter version 0.7. With this format, the ``content`` folder was introduced in the project storage. Previously, all novelWriter documents were saved in a series of folders numbered from ``data_0`` to ``data_f``. diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index 98247c68..740ed327 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -60,8 +60,8 @@ __license__ = "GPLv3" __author__ = "Veronica Berglyd Olsen" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" -__version__ = "1.6" -__hexversion__ = "0x010600f0" +__version__ = "1.7-alpha0" +__hexversion__ = "0x010700a0" __date__ = "2022-02-20" __status__ = "Stable" __domain__ = "novelwriter.io" diff --git a/novelwriter/core/item.py b/novelwriter/core/item.py index 8c7b2ef4..07db4a41 100644 --- a/novelwriter/core/item.py +++ b/novelwriter/core/item.py @@ -139,24 +139,32 @@ class NWItem(): def packXML(self, xParent): """Pack all the data in the class instance into an XML object. """ - xPack = etree.SubElement(xParent, "item", attrib={ - "handle": str(self._handle), - "order": str(self._order), - "parent": str(self._parent), - }) - self._subPack(xPack, "name", text=str(self._name)) - self._subPack(xPack, "type", text=str(self._type.name)) - self._subPack(xPack, "class", text=str(self._class.name)) - self._subPack(xPack, "status", text=str(self._status)) + itemAttrib = {} + itemAttrib["handle"] = str(self._handle) + itemAttrib["parent"] = str(self._parent) + itemAttrib["order"] = str(self._order) + itemAttrib["type"] = str(self._type.name) + itemAttrib["class"] = str(self._class.name) if self._type == nwItemType.FILE: - self._subPack(xPack, "exported", text=str(self._exported)) - self._subPack(xPack, "layout", text=str(self._layout.name)) - self._subPack(xPack, "charCount", text=str(self._charCount), none=False) - self._subPack(xPack, "wordCount", text=str(self._wordCount), none=False) - self._subPack(xPack, "paraCount", text=str(self._paraCount), none=False) - self._subPack(xPack, "cursorPos", text=str(self._cursorPos), none=False) + itemAttrib["layout"] = str(self._layout.name) + + metaAttrib = {} + if self._type == nwItemType.FILE: + metaAttrib["charCount"] = str(self._charCount) + metaAttrib["wordCount"] = str(self._wordCount) + metaAttrib["paraCount"] = str(self._paraCount) + metaAttrib["cursorPos"] = str(self._cursorPos) else: - self._subPack(xPack, "expanded", text=str(self._expanded)) + metaAttrib["expanded"] = str(self._expanded) + + nameAttrib = {} + nameAttrib["status"] = str(self._status) + if self._type == nwItemType.FILE: + nameAttrib["exported"] = str(self._exported) + + xPack = etree.SubElement(xParent, "item", attrib=itemAttrib) + self._subPack(xPack, "meta", attrib=metaAttrib) + self._subPack(xPack, "name", text=str(self._name), attrib=nameAttrib) return @@ -175,19 +183,31 @@ class NWItem(): self.setParent(xItem.attrib.get("parent", None)) self.setOrder(xItem.attrib.get("order", 0)) + self.setType(xItem.attrib.get("type", None)) + self.setClass(xItem.attrib.get("class", None)) + self.setLayout(xItem.attrib.get("layout", None)) - tmpStatus = "" for xValue in xItem: - if xValue.tag == "name": + if xValue.tag == "meta": + self.setExpanded(xValue.attrib.get("expanded", False)) + self.setCharCount(xValue.attrib.get("charCount", 0)) + self.setWordCount(xValue.attrib.get("wordCount", 0)) + self.setParaCount(xValue.attrib.get("paraCount", 0)) + self.setCursorPos(xValue.attrib.get("cursorPos", 0)) + elif xValue.tag == "name": self.setName(xValue.text) + self.setStatus(xValue.attrib.get("status", None)) + self.setExported(xValue.attrib.get("exported", True)) + + # Legacy Format (1.3 and earlier) + elif xValue.tag == "status": + self.setStatus(xValue.text) elif xValue.tag == "type": self.setType(xValue.text) elif xValue.tag == "class": self.setClass(xValue.text) elif xValue.tag == "layout": self.setLayout(xValue.text) - elif xValue.tag == "status": - tmpStatus = xValue.text elif xValue.tag == "expanded": self.setExpanded(xValue.text) elif xValue.tag == "exported": @@ -206,9 +226,6 @@ class NWItem(): # version of novelWriter that doesn't know the tag logger.error("Unknown tag '%s'", xValue.tag) - # Guarantees that is parsed after - self.setStatus(tmpStatus) - return True @staticmethod diff --git a/novelwriter/core/project.py b/novelwriter/core/project.py index 26d2c098..556f6e18 100644 --- a/novelwriter/core/project.py +++ b/novelwriter/core/project.py @@ -53,7 +53,7 @@ logger = logging.getLogger(__name__) class NWProject(): - FILE_VERSION = "1.3" + FILE_VERSION = "1.4" def __init__(self, theParent): @@ -479,8 +479,11 @@ class NWProject(): # 1.3 : Reduces the number of layouts to only two. One for novel # documents and one for project notes. Introduced in # version 1.5. + # 1.4 : Introduces a more compact format for storing items. All + # settings aside from name are now attributes. Introduced + # in version 1.7. - if fileVersion not in ("1.0", "1.1", "1.2", "1.3"): + if fileVersion not in ("1.0", "1.1", "1.2", "1.3", "1.4"): self.theParent.makeAlert(self.tr( "Unknown or unsupported novelWriter project file format. " "The project cannot be opened by this version of novelWriter. " diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 9e37d34a..bf40e1ee 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 1299 + 1303 199 - 64923 + 64457 False @@ -49,265 +49,105 @@ - - Novel - ROOT - NOVEL - Started - True + + + Novel - - Title Page - FILE - NOVEL - Started - True - DOCUMENT - 93 - 19 - 2 - 2 + + + Title Page - - Page - FILE - NOVEL - New - True - DOCUMENT - 186 - 39 - 2 - 212 + + + Page - - Part One - FILE - NOVEL - New - True - DOCUMENT - 26 - 6 - 1 - 33 + + + Part One - - A Folder - FOLDER - NOVEL - 1st Draft - True + + + A Folder - - Chapter One - FILE - NOVEL - Notes - True - DOCUMENT - 75 - 14 - 1 - 279 + + + Chapter One - - Making a Scene - FILE - NOVEL - 1st Draft - True - DOCUMENT - 2429 - 432 - 14 - 219 + + + Making a Scene - - Another Scene - FILE - NOVEL - 1st Draft - True - DOCUMENT - 476 - 93 - 3 - 577 + + + Another Scene - - Interlude - FILE - NOVEL - New - True - DOCUMENT - 617 - 101 - 3 - 4 + + + Interlude - - A Note on Structure - FILE - NOVEL - 2nd Draft - False - NOTE - 1692 - 313 - 6 - 1110 + + + A Note on Structure - - Chapter Two - FILE - NOVEL - 1st Draft - True - DOCUMENT - 139 - 28 - 1 - 343 + + + Chapter Two - - We Found John! - FILE - NOVEL - 1st Draft - True - DOCUMENT - 189 - 37 - 1 - 224 + + + We Found John! - - Characters - ROOT - CHARACTER - None - True + + + Characters - - Main Characters - FOLDER - CHARACTER - None - True + + + Main Characters - - John Smith - FILE - CHARACTER - Minor - True - NOTE - 49 - 9 - 1 - 24 + + + John Smith - - Jane Smith - FILE - CHARACTER - Major - True - NOTE - 55 - 9 - 1 - 25 + + + Jane Smith - - Locations - ROOT - WORLD - None - True + + + Locations - - Earth - FILE - WORLD - Main - True - NOTE - 76 - 15 - 1 - 20 + + + Earth - - Space - FILE - WORLD - Minor - True - NOTE - 115 - 24 - 1 - 133 + + + Space - - Mars - FILE - WORLD - Major - True - NOTE - 28 - 6 - 1 - 45 + + + Mars - - Archive - ROOT - ARCHIVE - New - True + + + Archive - - Scenes - FOLDER - ARCHIVE - New - True + + + Scenes - - Old File - FILE - NOVEL - 1st Draft - True - DOCUMENT - 315 - 55 - 1 - 322 + + + Old File - - Trash - TRASH - TRASH - None - True + + + Trash - - Delete Me! - FILE - NOVEL - New - True - DOCUMENT - 30 - 6 - 1 - 36 + + + Delete Me! diff --git a/tests/lipsum/nwProject.nwx b/tests/lipsum/nwProject.nwx index 02803bbd..c6eab805 100644 --- a/tests/lipsum/nwProject.nwx +++ b/tests/lipsum/nwProject.nwx @@ -1,12 +1,12 @@ - + Lorem Ipsum Lorem Ipsum lipsum.com - 17 + 21 24 - 1777 + 1847 False @@ -44,227 +44,89 @@ - - Novel - ROOT - NOVEL - New - True + + + Novel - - Lorem Ipsum - FILE - NOVEL - Finished - True - DOCUMENT - 230 - 40 - 3 - 148 + + + Lorem Ipsum - - Front Matter - FILE - NOVEL - Finished - True - DOCUMENT - 1058 - 176 - 2 - 43 + + + Front Matter - - Prologue - FILE - NOVEL - Draft - True - DOCUMENT - 584 - 92 - 1 - 4 + + + Prologue - - Act One - FILE - NOVEL - New - True - DOCUMENT - 35 - 6 - 1 - 42 + + + Act One - - Chapter One - FOLDER - NOVEL - Draft - True + + + Chapter One - - Chapter One - FILE - NOVEL - Draft - True - DOCUMENT - 419 - 67 - 1 - 56 + + + Chapter One - - Scene One - FILE - NOVEL - Finished - True - DOCUMENT - 2758 - 404 - 4 - 1528 + + + Scene One - - Scene Two - FILE - NOVEL - Finished - True - DOCUMENT - 4043 - 600 - 6 - 2335 + + + Scene Two - - Interlude - FILE - NOVEL - New - False - DOCUMENT - 631 - 109 - 3 - 376 + + + Interlude - - Chapter Two - FOLDER - NOVEL - Draft - True + + + Chapter Two - - Chapter Two - FILE - NOVEL - Draft - True - DOCUMENT - 477 - 70 - 1 - 56 + + + Chapter Two - - Scene Three - FILE - NOVEL - Finished - True - DOCUMENT - 3006 - 439 - 4 - 57 + + + Scene Three - - Scene Four - FILE - NOVEL - Finished - True - DOCUMENT - 3839 - 563 - 6 - 56 + + + Scene Four - - Scene Five - FILE - NOVEL - Finished - True - DOCUMENT - 3644 - 543 - 5 - 351 + + + Scene Five - - Characters - ROOT - CHARACTER - New - True + + + Characters - - Mr. Nobody - FILE - CHARACTER - Major - True - NOTE - 1864 - 284 - 3 - 1883 + + + Mr. Nobody - - Plot - ROOT - PLOT - New - True + + + Plot - - Main - FILE - PLOT - Main - True - NOTE - 1369 - 195 - 2 - 1387 + + + Main - - World - ROOT - WORLD - New - True + + + World - - Ancient Europe - FILE - WORLD - Minor - True - NOTE - 1770 - 259 - 3 - 1792 + + + Ancient Europe diff --git a/tests/minimal/nwProject.nwx b/tests/minimal/nwProject.nwx index c1f2a901..991d8b68 100644 --- a/tests/minimal/nwProject.nwx +++ b/tests/minimal/nwProject.nwx @@ -1,13 +1,13 @@ - + Test Minimal Minimal Jane Doe John Doh - 9 + 12 2 - 113 + 129 True @@ -42,76 +42,37 @@ - - Novel - ROOT - NOVEL - New - True + + + Novel - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 28 - 6 - 1 - 33 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - True + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 16 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 9 - 2 - 0 - 15 + + + New Scene - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - World - ROOT - WORLD - New - False + + + World diff --git a/tests/reference/coreProject_NewCustomA_nwProject.nwx b/tests/reference/coreProject_NewCustomA_nwProject.nwx index 3ba6a538..4b8a67bf 100644 --- a/tests/reference/coreProject_NewCustomA_nwProject.nwx +++ b/tests/reference/coreProject_NewCustomA_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -42,231 +42,97 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - Locations - ROOT - WORLD - New - False + + + Locations - - Timeline - ROOT - TIMELINE - New - False + + + Timeline - - Objects - ROOT - OBJECT - New - False + + + Objects - - Entities - ROOT - ENTITY - New - False + + + Entities - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Title Page - - Chapter 1 - FOLDER - NOVEL - New - False + + + Chapter 1 - - Chapter 1 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Chapter 1 - - Scene 1.1 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 1.1 - - Scene 1.2 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 1.2 - - Scene 1.3 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 1.3 - - Chapter 2 - FOLDER - NOVEL - New - False + + + Chapter 2 - - Chapter 2 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Chapter 2 - - Scene 2.1 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 2.1 - - Scene 2.2 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 2.2 - - Scene 2.3 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 2.3 - - Chapter 3 - FOLDER - NOVEL - New - False + + + Chapter 3 - - Chapter 3 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Chapter 3 - - Scene 3.1 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 3.1 - - Scene 3.2 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 3.2 - - Scene 3.3 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 3.3 diff --git a/tests/reference/coreProject_NewCustomB_nwProject.nwx b/tests/reference/coreProject_NewCustomB_nwProject.nwx index 2afad85a..3f55663e 100644 --- a/tests/reference/coreProject_NewCustomB_nwProject.nwx +++ b/tests/reference/coreProject_NewCustomB_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -42,138 +42,61 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - Locations - ROOT - WORLD - New - False + + + Locations - - Timeline - ROOT - TIMELINE - New - False + + + Timeline - - Objects - ROOT - OBJECT - New - False + + + Objects - - Entities - ROOT - ENTITY - New - False + + + Entities - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Title Page - - Scene 1 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 1 - - Scene 2 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 2 - - Scene 3 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 3 - - Scene 4 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 4 - - Scene 5 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 5 - - Scene 6 - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Scene 6 diff --git a/tests/reference/coreProject_NewFile_nwProject.nwx b/tests/reference/coreProject_NewFile_nwProject.nwx index 88c9aafb..d623ee2d 100644 --- a/tests/reference/coreProject_NewFile_nwProject.nwx +++ b/tests/reference/coreProject_NewFile_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -40,100 +40,45 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - World - ROOT - WORLD - New - False + + + World - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - False + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + New Scene - - Hello - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Hello - - Jane - FILE - CHARACTER - New - True - NOTE - 0 - 0 - 0 - 0 + + + Jane diff --git a/tests/reference/coreProject_NewMinimal_nwProject.nwx b/tests/reference/coreProject_NewMinimal_nwProject.nwx index d3702a07..6becb112 100644 --- a/tests/reference/coreProject_NewMinimal_nwProject.nwx +++ b/tests/reference/coreProject_NewMinimal_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -40,76 +40,37 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - World - ROOT - WORLD - New - False + + + World - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - False + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + New Scene diff --git a/tests/reference/coreProject_NewRoot_nwProject.nwx b/tests/reference/coreProject_NewRoot_nwProject.nwx index 58344c12..cf55336e 100644 --- a/tests/reference/coreProject_NewRoot_nwProject.nwx +++ b/tests/reference/coreProject_NewRoot_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -40,104 +40,53 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - World - ROOT - WORLD - New - False + + + World - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - False + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 0 - 0 - 0 - 0 + + + New Scene - - Timeline - ROOT - TIMELINE - New - False + + + Timeline - - Object - ROOT - OBJECT - New - False + + + Object - - Custom1 - ROOT - CUSTOM - New - False + + + Custom1 - - Custom2 - ROOT - CUSTOM - New - False + + + Custom2 diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index 1111c579..4dd43b9a 100644 --- a/tests/reference/guiEditor_Main_Final_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Final_nwProject.nwx @@ -1,11 +1,11 @@ - + New Project 5 2 - 4 + 3 True @@ -40,119 +40,53 @@ - - Novel - ROOT - NOVEL - New - True + + + Novel - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 0 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - True + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 0 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 612 - 95 - 10 - 768 + + + New Scene - - Plot - ROOT - PLOT - New - True + + + Plot - - New File - FILE - PLOT - New - True - NOTE - 48 - 10 - 1 - 69 + + + New File - - Characters - ROOT - CHARACTER - New - True + + + Characters - - New File - FILE - CHARACTER - New - True - NOTE - 34 - 8 - 1 - 51 + + + New File - - World - ROOT - WORLD - New - True + + + World - - New File - FILE - WORLD - New - True - NOTE - 51 - 9 - 1 - 68 + + + New File - - Trash - TRASH - TRASH - None - True + + + Trash diff --git a/tests/reference/guiEditor_Main_Initial_nwProject.nwx b/tests/reference/guiEditor_Main_Initial_nwProject.nwx index 7d2cfe5f..f1b17740 100644 --- a/tests/reference/guiEditor_Main_Initial_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Initial_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -40,76 +40,37 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 0 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - False + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 0 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 9 - 2 - 0 - 0 + + + New Scene - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - World - ROOT - WORLD - New - False + + + World diff --git a/tests/reference/guiProjSettings_Dialog_nwProject.nwx b/tests/reference/guiProjSettings_Dialog_nwProject.nwx index 96334e16..b88e7f17 100644 --- a/tests/reference/guiProjSettings_Dialog_nwProject.nwx +++ b/tests/reference/guiProjSettings_Dialog_nwProject.nwx @@ -1,5 +1,5 @@ - + Project Name Project Title @@ -46,76 +46,37 @@ - - Novel - ROOT - NOVEL - New - False + + + Novel - - Title Page - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 0 + + + Title Page - - New Chapter - FOLDER - NOVEL - New - False + + + New Chapter - - New Chapter - FILE - NOVEL - New - True - DOCUMENT - 11 - 2 - 0 - 0 + + + New Chapter - - New Scene - FILE - NOVEL - New - True - DOCUMENT - 9 - 2 - 0 - 0 + + + New Scene - - Plot - ROOT - PLOT - New - False + + + Plot - - Characters - ROOT - CHARACTER - New - False + + + Characters - - World - ROOT - WORLD - New - False + + + World diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index dea2b3c7..368592f1 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -306,22 +306,6 @@ def testCoreItem_LayoutSetter(mockGUI): theItem.setLayout("NOTE") assert theItem.itemLayout == nwItemLayout.NOTE - # Deprecated Layouts - theItem.setLayout("TITLE") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - theItem.setLayout("PAGE") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - theItem.setLayout("BOOK") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - theItem.setLayout("PARTITION") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - theItem.setLayout("UNNUMBERED") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - theItem.setLayout("CHAPTER") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - theItem.setLayout("SCENE") - assert theItem.itemLayout == nwItemLayout.DOCUMENT - # Alternatives theItem.setLayout(nwItemLayout.NOTE) assert theItem.itemLayout == nwItemLayout.NOTE @@ -358,12 +342,9 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog): xContent = etree.SubElement(nwXML, "content") theItem.packXML(xContent) assert etree.tostring(xContent, pretty_print=False, encoding="utf-8") == ( - b"" - b"" - b"A NameFILENOVELNew" - b"FalseNOTE7" - b"5311" - b"" + b'A Name' ) # Unpack @@ -404,11 +385,8 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog): xContent = etree.SubElement(nwXML, "content") theItem.packXML(xContent) assert etree.tostring(xContent, pretty_print=False, encoding="utf-8") == ( - b"" - b"" - b"A NameFOLDERNOVELNew" - b"True" - b"" + b'A Name' ) # Unpack @@ -462,3 +440,107 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog): ) # END Test testCoreItem_XMLPackUnpack + + +@pytest.mark.core +def testCoreItem_ConvertFromFmt12(mockGUI): + """Test the setter for all the nwItemLayout values for the NWItem + class using the class names that were present in file format 1.2. + """ + theProject = NWProject(mockGUI) + theItem = NWItem(theProject) + + # Deprecated Layouts + theItem.setLayout("TITLE") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("PAGE") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("BOOK") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("PARTITION") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("UNNUMBERED") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("CHAPTER") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("SCENE") + assert theItem.itemLayout == nwItemLayout.DOCUMENT + theItem.setLayout("MUMBOJUMBO") + assert theItem.itemLayout == nwItemLayout.NO_LAYOUT + +# END Test testCoreItem_ConvertFromFmt12 + + +@pytest.mark.core +def testCoreItem_ConvertFromFmt13(mockGUI): + """Test packing and unpacking XML objects for the NWItem class from + format version 1.3 + """ + theProject = NWProject(mockGUI) + + # Make Version 1.3 XML + nwXML = etree.Element("novelWriterXML") + xContent = etree.SubElement(nwXML, "content") + + # Folder + xPack = etree.SubElement(xContent, "item", attrib={ + "handle": "a000000000001", + "order": "1", + "parent": "b000000000001", + }) + NWItem._subPack(xPack, "name", text="Folder") + NWItem._subPack(xPack, "type", text="FOLDER") + NWItem._subPack(xPack, "class", text="NOVEL") + NWItem._subPack(xPack, "status", text="New") + NWItem._subPack(xPack, "expanded", text="True") + + # Unpack Folder + theItem = NWItem(theProject) + theItem.unpackXML(xContent[0]) + assert theItem.itemHandle == "a000000000001" + assert theItem.itemParent == "b000000000001" + assert theItem.itemOrder == 1 + assert theItem.isExpanded is True + assert theItem.isExported is True + assert theItem.charCount == 0 + assert theItem.wordCount == 0 + assert theItem.paraCount == 0 + assert theItem.cursorPos == 0 + assert theItem.itemClass == nwItemClass.NOVEL + assert theItem.itemType == nwItemType.FOLDER + assert theItem.itemLayout == nwItemLayout.NO_LAYOUT + + # File + xPack = etree.SubElement(xContent, "item", attrib={ + "handle": "c000000000001", + "order": "2", + "parent": "a000000000001", + }) + NWItem._subPack(xPack, "name", text="Scene") + NWItem._subPack(xPack, "type", text="FILE") + NWItem._subPack(xPack, "class", text="NOVEL") + NWItem._subPack(xPack, "status", text="New") + NWItem._subPack(xPack, "exported", text="True") + NWItem._subPack(xPack, "layout", text="DOCUMENT") + NWItem._subPack(xPack, "charCount", text="600") + NWItem._subPack(xPack, "wordCount", text="100") + NWItem._subPack(xPack, "paraCount", text="6") + NWItem._subPack(xPack, "cursorPos", text="50") + + # Unpack File + theItem = NWItem(theProject) + theItem.unpackXML(xContent[1]) + assert theItem.itemHandle == "c000000000001" + assert theItem.itemParent == "a000000000001" + assert theItem.itemOrder == 2 + assert theItem.isExpanded is False + assert theItem.isExported is True + assert theItem.charCount == 600 + assert theItem.wordCount == 100 + assert theItem.paraCount == 6 + assert theItem.cursorPos == 50 + assert theItem.itemClass == nwItemClass.NOVEL + assert theItem.itemType == nwItemType.FILE + assert theItem.itemLayout == nwItemLayout.DOCUMENT + +# END Test testCoreItem_ConvertFromFmt13 diff --git a/tests/test_core/test_core_tree.py b/tests/test_core/test_core_tree.py index dc49c41a..e0e82f39 100644 --- a/tests/test_core/test_core_tree.py +++ b/tests/test_core/test_core_tree.py @@ -385,36 +385,29 @@ def testCoreTree_XMLPackUnpack(mockGUI, mockItems): nwXML = etree.Element("novelWriterXML") theTree.packXML(nwXML) assert etree.tostring(nwXML, pretty_print=False, encoding="utf-8") == ( - b"" - b"" - b"" - b"NovelROOTNOVELNone" - b"True" - b"" - b"Act OneFOLDERNOVELNone" - b"True" - b"" - b"Chapter OneFILENOVELNone" - b"TrueDOCUMENT300" - b"5020" - b"" - b"Scene OneFILENOVELNone" - b"TrueDOCUMENT3000" - b"500200" - b"" - b"OuttakesROOTARCHIVENone" - b"False" - b"" - b"TrashTRASHTRASHNone" - b"False" - b"" - b"CharactersROOTCHARACTERNone" - b"True" - b"" - b"Jane DoeFILECHARACTERNone" - b"TrueNOTE2000" - b"400160" - b"" + b'' + b'' + b'' + b'Novel' + b'Act One' + b'' + b'Chapter One' + b'' + b'Scene One' + b'' + b'Outtakes' + b'' + b'Trash' + b'' + b'Characters' + b'Jane Doe' + b'' + b'' ) theTree.clear() From 011291f225d7032f375b4473a43a0749e27cf92d Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 20 Feb 2022 23:35:33 +0100 Subject: [PATCH 2/4] Drop support for Python 3.6 (#1004) * Drop support for Python 3.6 * Remove unused time parsing function * Use Python 3.7 datetime function for writing stats data conversion * Test against Python 3.10 on macOS and Windows --- .github/workflows/test_linux.yml | 2 +- .github/workflows/test_mac.yml | 2 +- .github/workflows/test_win.yml | 2 +- README.md | 6 +++--- docs/source/int_started.rst | 2 +- novelwriter/__init__.py | 4 ++-- novelwriter/common.py | 13 ------------- novelwriter/core/toodt.py | 2 +- novelwriter/tools/writingstats.py | 8 ++------ setup.cfg | 3 +-- setup/debian/control | 6 +++--- setup/description_pypi.md | 6 +++--- tests/test_base/test_base_common.py | 23 +++-------------------- 13 files changed, 22 insertions(+), 57 deletions(-) diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index 5699d8a8..45de8226 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -12,7 +12,7 @@ jobs: testLinux: strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] runs-on: ubuntu-latest steps: - name: Python Setup diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index c9b4497c..b11a2a71 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -15,7 +15,7 @@ jobs: - name: Python Setup uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" architecture: x64 - name: Install Packages run: | diff --git a/.github/workflows/test_win.yml b/.github/workflows/test_win.yml index 85a0fda6..fd0ad402 100644 --- a/.github/workflows/test_win.yml +++ b/.github/workflows/test_win.yml @@ -15,7 +15,7 @@ jobs: - name: Python Setup uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" architecture: x64 - name: Checkout Source uses: actions/checkout@v2 diff --git a/README.md b/README.md index 36aa11d2..60ca008b 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ The full credits are listed in ## Implementation -The application is written in Python 3 (3.6+) using Qt5 and PyQt5 (5.3+). It is developed on Linux, -but should in principle work fine on other operating systems as well as long as dependencies are -met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS. +The application is written with Python 3 (3.7+) using Qt5 and PyQt5 (5.3+). It is developed on +Linux, but should in principle work fine on other operating systems as well as long as dependencies +are met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS. ## Installation diff --git a/docs/source/int_started.rst b/docs/source/int_started.rst index f398a8b6..5b5fff70 100644 --- a/docs/source/int_started.rst +++ b/docs/source/int_started.rst @@ -115,7 +115,7 @@ Windows ------- First, make sure you have Python installed on your system. If you don't, you can download it from -`python.org`_. Python 3.6 or higher is required, but it is recommended that you install the latest +`python.org`_. Python 3.7 or higher is required, but it is recommended that you install the latest version. Make sure you select the "Add Python to PATH" option during installation, otherwise the ``python`` diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index 740ed327..164a05e7 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -209,9 +209,9 @@ def main(sysArgs=None): # Check Packages and Versions errorData = [] errorCode = 0 - if sys.hexversion < 0x030600f0: + if sys.hexversion < 0x030700f0: errorData.append( - "At least Python 3.6 is required, found %s" % CONFIG.verPyString + "At least Python 3.7 is required, found %s" % CONFIG.verPyString ) errorCode |= 0x04 if CONFIG.verQtValue < 50300: diff --git a/novelwriter/common.py b/novelwriter/common.py index 8d6f9a8c..8e17a7ee 100644 --- a/novelwriter/common.py +++ b/novelwriter/common.py @@ -241,19 +241,6 @@ def formatTime(tS): return "ERROR" -def parseTimeStamp(theStamp, default, allowNone=False): - """Parses a text representation of a timestamp and converts it into - a float. Note that negative timestamps cause an OSError on Windows. - See https://bugs.python.org/issue29097 - """ - if str(theStamp).lower() == "none" and allowNone: - return None - try: - return datetime.strptime(theStamp, nwConst.FMT_TSTAMP).timestamp() - except Exception: - return default - - # =============================================================================================== # # String Functions # =============================================================================================== # diff --git a/novelwriter/core/toodt.py b/novelwriter/core/toodt.py index c68f8991..c0b1daee 100644 --- a/novelwriter/core/toodt.py +++ b/novelwriter/core/toodt.py @@ -330,7 +330,7 @@ class ToOdt(Tokenizer): # Meta Data xMeta = etree.SubElement(self._xMeta, _mkTag("meta", "creation-date")) - xMeta.text = datetime.now().strftime(r"%Y-%m-%dT%H:%M:%S") + xMeta.text = datetime.now().isoformat(sep="T", timespec="seconds") xMeta = etree.SubElement(self._xMeta, _mkTag("meta", "generator")) xMeta.text = f"novelWriter/{novelwriter.__version__}" diff --git a/novelwriter/tools/writingstats.py b/novelwriter/tools/writingstats.py index e0a338bb..4ce83b66 100644 --- a/novelwriter/tools/writingstats.py +++ b/novelwriter/tools/writingstats.py @@ -457,12 +457,8 @@ class GuiWritingStats(QDialog): if len(inData) < 6: continue - dStart = datetime.strptime( - "%s %s" % (inData[0], inData[1]), nwConst.FMT_TSTAMP - ) - dEnd = datetime.strptime( - "%s %s" % (inData[2], inData[3]), nwConst.FMT_TSTAMP - ) + dStart = datetime.fromisoformat(" ".join(inData[0:2])) + dEnd = datetime.fromisoformat(" ".join(inData[2:4])) sIdle = 0 if len(inData) > 6: diff --git a/setup.cfg b/setup.cfg index d3bbcf41..0e005bf5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,6 @@ license_file = LICENSE.md license = GNU General Public License v3 classifiers = Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -29,7 +28,7 @@ project_urls = Source Code = https://github.com/vkbo/novelWriter [options] -python_requires = >=3.6 +python_requires = >=3.7 include_package_data = True packages = find: install_requires = diff --git a/setup/debian/control b/setup/debian/control index d32c56ba..e2d40f90 100644 --- a/setup/debian/control +++ b/setup/debian/control @@ -2,14 +2,14 @@ Source: novelwriter Maintainer: Veronica Berglyd Olsen Section: text Priority: optional -Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9), python3 (>=3.6), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0) +Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9), python3 (>=3.7), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0) Standards-Version: 4.5.1 Homepage: https://novelwriter.io -X-Python3-Version: >= 3.6 +X-Python3-Version: >= 3.7 Package: novelwriter Architecture: all -Depends: ${misc:Depends}, ${python3:Depends}, python3 (>=3.6), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0) +Depends: ${misc:Depends}, ${python3:Depends}, python3 (>=3.7), python3-pyqt5 (>= 5.3), python3-lxml (>= 4.0), python3-enchant (>= 2.0) Description: A markdown-like text editor for planning and writing novels novelWriter is a plain text editor designed for writing novels assembled from many smaller text documents. It uses a minimal formatting syntax inspired by diff --git a/setup/description_pypi.md b/setup/description_pypi.md index 8c15b1be..ed98ffda 100644 --- a/setup/description_pypi.md +++ b/setup/description_pypi.md @@ -10,9 +10,9 @@ synchronisation tools. All text is saved as plain text files with a meta data he project structure is stored in a single project XML file, and other meta data is primarily saved as JSON files. -The application is written in Python 3 (3.6+) using Qt5 and PyQt5 (5.3+). It is developed on Linux, -but should in principle work fine on other operating systems as well as long as dependencies are -met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS. +The application is written with Python 3 (3.7+) using Qt5 and PyQt5 (5.3+). It is developed on +Linux, but should in principle work fine on other operating systems as well as long as dependencies +are met. It is regularly tested on Debian and Ubuntu Linux, Windows, and macOS. novelWriter is developed and maintained by [Veronica Berglyd Olsen](https://github.com/vkbo). diff --git a/tests/test_base/test_base_common.py b/tests/test_base/test_base_common.py index 5b9b9c13..f5eef8fe 100644 --- a/tests/test_base/test_base_common.py +++ b/tests/test_base/test_base_common.py @@ -24,8 +24,6 @@ import os import time import pytest -from datetime import datetime - from mock import causeOSError from tools import writeFile @@ -33,9 +31,9 @@ from novelwriter.guimain import GuiMain from novelwriter.common import ( checkString, checkInt, checkFloat, checkBool, checkHandle, isHandle, isTitleTag, isItemClass, isItemType, isItemLayout, hexToInt, checkIntRange, - checkIntTuple, formatInt, formatTimeStamp, formatTime, parseTimeStamp, - splitVersionNumber, transferCase, fuzzyTime, numberToRoman, jsonEncode, - readTextFile, makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser + checkIntTuple, formatInt, formatTimeStamp, formatTime, splitVersionNumber, + transferCase, fuzzyTime, numberToRoman, jsonEncode, readTextFile, + makeFileNameSafe, sha256sum, getGuiItem, NWConfigParser ) @@ -272,21 +270,6 @@ def testBaseCommon_FormatTime(): # END Test testBaseCommon_FormatTime -@pytest.mark.base -def testBaseCommon_ParseTimeStamp(): - """Test the parseTimeStamp function. - """ - localEpoch = datetime(2000, 1, 1).timestamp() - assert parseTimeStamp(None, 0.0, allowNone=True) is None - assert parseTimeStamp("None", 0.0, allowNone=True) is None - assert parseTimeStamp("None", 0.0) == 0.0 - assert parseTimeStamp("2000-01-01 00:00:00", 123.0) == localEpoch - assert parseTimeStamp("2000-13-01 00:00:00", 123.0) == 123.0 - assert parseTimeStamp("2000-01-32 00:00:00", 123.0) == 123.0 - -# END Test testBaseCommon_ParseTimeStamp - - @pytest.mark.base def testBaseCommon_SplitVersionNumber(): """Test the splitVersionNumber function. From 7f43584ed535a421887916e79b8074bb725850cc Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:19:12 +0100 Subject: [PATCH 3/4] Merge bugfixes (#1009) * Fix document margin recursion error (#1007) * Fix project file icon path in Windows installer (#1006) --- novelwriter/gui/doceditor.py | 2 +- novelwriter/gui/docviewer.py | 5 +++-- setup/win_setup_embed.iss | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index 41442385..b1760be4 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -1061,8 +1061,8 @@ class GuiDocEditor(QTextEdit): """If the text editor is resized, we must make sure the document has its margins adjusted according to user preferences. """ - QTextEdit.resizeEvent(self, theEvent) self.updateDocMargins() + QTextEdit.resizeEvent(self, theEvent) return ## diff --git a/novelwriter/gui/docviewer.py b/novelwriter/gui/docviewer.py index 72c142a0..4ec59570 100644 --- a/novelwriter/gui/docviewer.py +++ b/novelwriter/gui/docviewer.py @@ -471,10 +471,11 @@ class GuiDocViewer(QTextBrowser): ## def resizeEvent(self, theEvent): - """Make sure the document title is the same width as the window. + """If the text editor is resized, we must make sure the document + has its margins adjusted according to user preferences. """ - QTextBrowser.resizeEvent(self, theEvent) self.updateDocMargins() + QTextBrowser.resizeEvent(self, theEvent) return def mouseReleaseEvent(self, theEvent): diff --git a/setup/win_setup_embed.iss b/setup/win_setup_embed.iss index 84911592..7505f6c1 100644 --- a/setup/win_setup_embed.iss +++ b/setup/win_setup_embed.iss @@ -51,6 +51,6 @@ Filename: "{app}\pythonw.exe"; Parameters: "{#nwAppExeName}"; Description: "{cm [Registry] Root: HKA; Subkey: "Software\Classes\.nwx\OpenWithProgids"; ValueType: string; ValueName: "novelWriterProject.nwx"; ValueData: ""; Flags: uninsdeletevalue Root: HKA; Subkey: "Software\Classes\novelWriterProject.nwx"; ValueType: string; ValueName: ""; ValueData: "novelWriter Project File"; Flags: uninsdeletekey -Root: HKA; Subkey: "Software\Classes\novelWriterProject.nwx\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\assets\icons\x-novelwriter-project.ico" +Root: HKA; Subkey: "Software\Classes\novelWriterProject.nwx\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\novelwriter\assets\icons\x-novelwriter-project.ico" Root: HKA; Subkey: "Software\Classes\novelWriterProject.nwx\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\pythonw.exe"" ""{app}\{#nwAppExeName}"" ""%1""" Root: HKA; Subkey: "Software\Classes\Applications\{#nwAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".nwx"; ValueData: ""; Flags: uninsdeletekey From ce4d3c0b5cb5e3f4d7a29db3992c1f9d256637b1 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 15 Mar 2022 22:07:33 +0100 Subject: [PATCH 4/4] Update linting settings, and drop Ubuntu 18.04 releases (#1014) * Add E133 and W503 to ignored list for flake8 * Drop making releases for Ubuntu 18.04 --- .github/workflows/syntax.yml | 4 ++-- setup.cfg | 2 +- setup.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/syntax.yml b/.github/workflows/syntax.yml index 560dd7dc..5294afe0 100644 --- a/.github/workflows/syntax.yml +++ b/.github/workflows/syntax.yml @@ -27,5 +27,5 @@ jobs: flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics - name: Coding Style Violations run: | - flake8 novelwriter --count --max-line-length=99 --ignore E221,E226,E228,E241 --show-source --statistics - flake8 tests --count --max-line-length=99 --ignore E221,E226,E228,E241 --show-source --statistics + flake8 novelwriter --count --max-line-length=99 --ignore E133,E221,E226,E228,E241,W503 --show-source --statistics + flake8 tests --count --max-line-length=99 --ignore E133,E221,E226,E228,E241,W503 --show-source --statistics diff --git a/setup.cfg b/setup.cfg index 0e005bf5..b88b656b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,6 +49,6 @@ gui_scripts = universal = 0 [flake8] -ignore = E221,E226,E228,E241 +ignore = E133,E221,E226,E228,E241,W503 max-line-length = 99 exclude = docs/* diff --git a/setup.py b/setup.py index 44d5cb1f..f72ce936 100755 --- a/setup.py +++ b/setup.py @@ -786,7 +786,6 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False): bldNum = "0" distLoop = [ - ("18.04", "bionic"), ("20.04", "focal"), ("21.10", "impish"), ("22.04", "jammy"),