From 64da2793ac061e278319b3f6f17f7f0049909b96 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 23 Apr 2022 15:38:53 +0200 Subject: [PATCH] Allow file items to save expanded status --- novelwriter/core/item.py | 3 +- tests/lipsum/nwProject.nwx | 36 +++++++++---------- tests/minimal/nwProject.nwx | 12 +++---- .../coreProject_NewCustomA_nwProject.nwx | 28 +++++++-------- .../coreProject_NewCustomB_nwProject.nwx | 16 ++++----- .../coreProject_NewFile_nwProject.nwx | 12 +++---- .../coreProject_NewMinimal_nwProject.nwx | 8 ++--- .../coreProject_NewRoot_nwProject.nwx | 8 ++--- .../guiEditor_Main_Final_nwProject.nwx | 16 ++++----- .../guiEditor_Main_Initial_nwProject.nwx | 8 ++--- .../guiProjSettings_Dialog_nwProject.nwx | 8 ++--- tests/test_core/test_core_item.py | 5 +-- tests/test_core/test_core_tree.py | 12 +++---- 13 files changed, 86 insertions(+), 86 deletions(-) diff --git a/novelwriter/core/item.py b/novelwriter/core/item.py index f6d93b36..0aed8991 100644 --- a/novelwriter/core/item.py +++ b/novelwriter/core/item.py @@ -160,13 +160,12 @@ class NWItem(): itemAttrib["layout"] = str(self._layout.name) metaAttrib = {} + metaAttrib["expanded"] = str(self._expanded) 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: - metaAttrib["expanded"] = str(self._expanded) nameAttrib = {} nameAttrib["status"] = str(self._status) diff --git a/tests/lipsum/nwProject.nwx b/tests/lipsum/nwProject.nwx index d8d7a49e..02e3df49 100644 --- a/tests/lipsum/nwProject.nwx +++ b/tests/lipsum/nwProject.nwx @@ -1,12 +1,12 @@ - + Lorem Ipsum Lorem Ipsum lipsum.com - 24 + 26 24 - 1856 + 1863 False @@ -49,19 +49,19 @@ Novel - + Lorem Ipsum - + Front Matter - + Prologue - + Act One @@ -69,19 +69,19 @@ Chapter One - + Chapter One - + Scene One - + Scene Two - + Interlude @@ -89,19 +89,19 @@ Chapter Two - + Chapter Two - + Scene Three - + Scene Four - + Scene Five @@ -109,7 +109,7 @@ Characters - + Mr. Nobody @@ -117,7 +117,7 @@ Plot - + Main @@ -125,7 +125,7 @@ World - + Ancient Europe diff --git a/tests/minimal/nwProject.nwx b/tests/minimal/nwProject.nwx index 6945dc08..af7595a4 100644 --- a/tests/minimal/nwProject.nwx +++ b/tests/minimal/nwProject.nwx @@ -1,13 +1,13 @@ - + Test Minimal Minimal Jane Doe John Doh - 15 + 17 2 - 146 + 150 True @@ -47,7 +47,7 @@ Novel - + Title Page @@ -55,11 +55,11 @@ New Chapter - + New Chapter - + New Scene diff --git a/tests/reference/coreProject_NewCustomA_nwProject.nwx b/tests/reference/coreProject_NewCustomA_nwProject.nwx index 8747363b..14abf9e2 100644 --- a/tests/reference/coreProject_NewCustomA_nwProject.nwx +++ b/tests/reference/coreProject_NewCustomA_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -71,7 +71,7 @@ Entities - + Title Page @@ -79,19 +79,19 @@ Chapter 1 - + Chapter 1 - + Scene 1.1 - + Scene 1.2 - + Scene 1.3 @@ -99,19 +99,19 @@ Chapter 2 - + Chapter 2 - + Scene 2.1 - + Scene 2.2 - + Scene 2.3 @@ -119,19 +119,19 @@ Chapter 3 - + Chapter 3 - + Scene 3.1 - + Scene 3.2 - + Scene 3.3 diff --git a/tests/reference/coreProject_NewCustomB_nwProject.nwx b/tests/reference/coreProject_NewCustomB_nwProject.nwx index 7f397e85..bca6ea80 100644 --- a/tests/reference/coreProject_NewCustomB_nwProject.nwx +++ b/tests/reference/coreProject_NewCustomB_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -71,31 +71,31 @@ Entities - + Title Page - + Scene 1 - + Scene 2 - + Scene 3 - + Scene 4 - + Scene 5 - + Scene 6 diff --git a/tests/reference/coreProject_NewFile_nwProject.nwx b/tests/reference/coreProject_NewFile_nwProject.nwx index 86f9cf11..d253ebcc 100644 --- a/tests/reference/coreProject_NewFile_nwProject.nwx +++ b/tests/reference/coreProject_NewFile_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -57,7 +57,7 @@ World - + Title Page @@ -65,19 +65,19 @@ New Chapter - + New Chapter - + New Scene - + Hello - + Jane diff --git a/tests/reference/coreProject_NewMinimal_nwProject.nwx b/tests/reference/coreProject_NewMinimal_nwProject.nwx index 37a5428b..a6711a84 100644 --- a/tests/reference/coreProject_NewMinimal_nwProject.nwx +++ b/tests/reference/coreProject_NewMinimal_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -57,7 +57,7 @@ World - + Title Page @@ -65,11 +65,11 @@ New Chapter - + New Chapter - + New Scene diff --git a/tests/reference/coreProject_NewRoot_nwProject.nwx b/tests/reference/coreProject_NewRoot_nwProject.nwx index 67c49f05..2ab62301 100644 --- a/tests/reference/coreProject_NewRoot_nwProject.nwx +++ b/tests/reference/coreProject_NewRoot_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -57,7 +57,7 @@ World - + Title Page @@ -65,11 +65,11 @@ New Chapter - + New Chapter - + New Scene diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index 3900c6d2..61abe4f3 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 @@ -45,7 +45,7 @@ Novel - + Title Page @@ -53,11 +53,11 @@ New Chapter - + New Chapter - + New Scene @@ -65,7 +65,7 @@ Plot - + New Note @@ -73,7 +73,7 @@ Characters - + New Note @@ -81,7 +81,7 @@ World - + New Note diff --git a/tests/reference/guiEditor_Main_Initial_nwProject.nwx b/tests/reference/guiEditor_Main_Initial_nwProject.nwx index 66a4c94e..1a5fd5be 100644 --- a/tests/reference/guiEditor_Main_Initial_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Initial_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -45,7 +45,7 @@ Novel - + Title Page @@ -53,11 +53,11 @@ New Chapter - + New Chapter - + New Scene diff --git a/tests/reference/guiProjSettings_Dialog_nwProject.nwx b/tests/reference/guiProjSettings_Dialog_nwProject.nwx index 77d01d45..326c63e5 100644 --- a/tests/reference/guiProjSettings_Dialog_nwProject.nwx +++ b/tests/reference/guiProjSettings_Dialog_nwProject.nwx @@ -1,5 +1,5 @@ - + Project Name Project Title @@ -51,7 +51,7 @@ Novel - + Title Page @@ -59,11 +59,11 @@ New Chapter - + New Chapter - + New Scene diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index 572b31d7..dec95cd7 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -500,8 +500,9 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd): assert etree.tostring(xContent, pretty_print=False, encoding="utf-8") == ( b'' b'A Name' + b'type="FILE" class="NOVEL" layout="NOTE">A Name' b'' ) % bytes(importKeys[3], encoding="utf8") diff --git a/tests/test_core/test_core_tree.py b/tests/test_core/test_core_tree.py index c70cc4bb..e8734936 100644 --- a/tests/test_core/test_core_tree.py +++ b/tests/test_core/test_core_tree.py @@ -419,12 +419,12 @@ def testCoreTree_XMLPackUnpack(mockGUI, mockItems): b'type="FOLDER" class="NOVEL">Act One' b'Chapter One' b'Scene One' b'Characters' b'Jane Doe' b'' b''