From 93a79f3605343a94f97e55f41a00682bac6c300a Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 20 Oct 2022 18:14:40 +0200 Subject: [PATCH 1/3] Rename the access metods of the item class from exported to active --- novelwriter/core/index.py | 2 +- novelwriter/core/item.py | 8 +++---- novelwriter/gui/itemdetails.py | 2 +- novelwriter/gui/projtree.py | 10 ++++---- novelwriter/tools/build.py | 2 +- tests/test_core/test_core_index.py | 4 ++-- tests/test_core/test_core_item.py | 36 ++++++++++++++--------------- tests/test_gui/test_gui_projtree.py | 6 ++--- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/novelwriter/core/index.py b/novelwriter/core/index.py index 6b8109d3..1058628b 100644 --- a/novelwriter/core/index.py +++ b/novelwriter/core/index.py @@ -802,7 +802,7 @@ class ItemIndex: continue if tItem.isNoteLayout(): continue - if skipExcl and not tItem.isExported: + if skipExcl and not tItem.isActive: continue tHandle = tItem.itemHandle diff --git a/novelwriter/core/item.py b/novelwriter/core/item.py index 22f48cdd..d8bbc88e 100644 --- a/novelwriter/core/item.py +++ b/novelwriter/core/item.py @@ -120,7 +120,7 @@ class NWItem: return self._expanded @property - def isExported(self): + def isActive(self): return self._exported @property @@ -217,7 +217,7 @@ class NWItem: self.setName(xValue.text) self.setStatus(xValue.attrib.get("status", None)) self.setImport(xValue.attrib.get("import", None)) - self.setExported(xValue.attrib.get("exported", True)) + self.setActive(xValue.attrib.get("exported", True)) # Legacy Format (1.3 and earlier) elif xValue.tag == "status": @@ -231,7 +231,7 @@ class NWItem: elif xValue.tag == "expanded": self.setExpanded(xValue.text) elif xValue.tag == "exported": - self.setExported(xValue.text) + self.setActive(xValue.text) elif xValue.tag == "charCount": self.setCharCount(xValue.text) elif xValue.tag == "wordCount": @@ -505,7 +505,7 @@ class NWItem: self._expanded = (state is True) return - def setExported(self, state): + def setActive(self, state): """Set the export flag. """ if isinstance(state, str): diff --git a/novelwriter/gui/itemdetails.py b/novelwriter/gui/itemdetails.py index 56258667..a99650c2 100644 --- a/novelwriter/gui/itemdetails.py +++ b/novelwriter/gui/itemdetails.py @@ -247,7 +247,7 @@ class GuiItemDetails(QWidget): theLabel = theLabel[:96].rstrip()+" ..." if nwItem.isFileType(): - if nwItem.isExported: + if nwItem.isActive: self.labelIcon.setPixmap(self._expCheck) else: self.labelIcon.setPixmap(self._expCross) diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index 5480cafe..d535964e 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -909,7 +909,7 @@ class GuiProjectTree(QTreeWidget): if nwItem.isFileType(): trItem.setIcon( - self.C_EXPORT, self.mainTheme.getIcon("check" if nwItem.isExported else "cross") + self.C_EXPORT, self.mainTheme.getIcon("check" if nwItem.isActive else "cross") ) if self.mainConf.emphLabels and nwItem.isDocumentLayout(): @@ -1157,7 +1157,7 @@ class GuiProjectTree(QTreeWidget): if isFile: ctxMenu.addAction( - self.tr("Toggle Exported"), lambda: self._toggleItemExported(tHandle) + self.tr("Toggle Exported"), lambda: self._toggleItemActive(tHandle) ) if tItem.isNovelLike(): @@ -1367,12 +1367,12 @@ class GuiProjectTree(QTreeWidget): """ return self._treeMap.get(tHandle, None) - def _toggleItemExported(self, tHandle): - """Toggle the exported status of an item. + def _toggleItemActive(self, tHandle): + """Toggle the active status of an item. """ tItem = self.theProject.tree[tHandle] if tItem is not None: - tItem.setExported(not tItem.isExported) + tItem.setActive(not tItem.isActive) self.setTreeItemValues(tItem.itemHandle) self._alertTreeChange(tHandle, flush=False) return diff --git a/novelwriter/tools/build.py b/novelwriter/tools/build.py index d2b3faf7..c372eb78 100644 --- a/novelwriter/tools/build.py +++ b/novelwriter/tools/build.py @@ -813,7 +813,7 @@ class GuiBuildNovel(QDialog): if theItem is None: return False - if not (theItem.isExported or ignoreFlag): + if not (theItem.isActive or ignoreFlag): return False if theItem.itemRoot in rootFilter: diff --git a/tests/test_core/test_core_index.py b/tests/test_core/test_core_index.py index 0d3518c6..0e416e09 100644 --- a/tests/test_core/test_core_index.py +++ b/tests/test_core/test_core_index.py @@ -524,7 +524,7 @@ def testCoreIndex_ExtractData(mockGUI, fncDir, mockRnd): ] # Check that excluded files can be skipped - theProject.tree[nHandle].setExported(False) + theProject.tree[nHandle].setActive(False) theKeys = [] for aKey, _, _, _ in theIndex.novelStructure(skipExcl=False): @@ -1072,7 +1072,7 @@ def testCoreIndex_ItemIndex(mockGUI, fncDir, mockRnd): assert nStruct[3][0] == uHandle # Skip excluded - theProject.tree[sHandle].setExported(False) + theProject.tree[sHandle].setActive(False) nStruct = list(itemIndex.iterNovelStructure(skipExcl=True)) assert len(nStruct) == 3 assert nStruct[0][0] == nHandle diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index bd166b47..97688df5 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -136,18 +136,18 @@ def testCoreItem_Setters(mockGUI, mockRnd): assert theItem.isExpanded is True # Exported - theItem.setExported(8) - assert theItem.isExported is False - theItem.setExported(None) - assert theItem.isExported is False - theItem.setExported("None") - assert theItem.isExported is False - theItem.setExported("What?") - assert theItem.isExported is False - theItem.setExported("True") - assert theItem.isExported is True - theItem.setExported(True) - assert theItem.isExported is True + theItem.setActive(8) + assert theItem.isActive is False + theItem.setActive(None) + assert theItem.isActive is False + theItem.setActive("None") + assert theItem.isActive is False + theItem.setActive("What?") + assert theItem.isActive is False + theItem.setActive("True") + assert theItem.isActive is True + theItem.setActive(True) + assert theItem.isActive is True # CharCount theItem.setCharCount(None) @@ -513,7 +513,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd): theItem.setType("FILE") theItem.setImport(importKeys[3]) theItem.setLayout("NOTE") - theItem.setExported(False) + theItem.setActive(False) theItem.setParaCount(3) theItem.setWordCount(5) theItem.setCharCount(7) @@ -538,7 +538,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd): assert theItem.itemParent == "0123456789abc" assert theItem.itemRoot == "0123456789abc" assert theItem.itemOrder == 1 - assert theItem.isExported is False + assert theItem.isActive is False assert theItem.paraCount == 3 assert theItem.wordCount == 5 assert theItem.charCount == 7 @@ -563,7 +563,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd): theItem.setStatus(statusKeys[1]) theItem.setLayout("NOTE") theItem.setExpanded(True) - theItem.setExported(False) + theItem.setActive(False) theItem.setParaCount(3) theItem.setWordCount(5) theItem.setCharCount(7) @@ -588,7 +588,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd): assert theItem.itemRoot == "0123456789abc" assert theItem.itemOrder == 1 assert theItem.isExpanded is True - assert theItem.isExported is True + assert theItem.isActive is True assert theItem.paraCount == 0 assert theItem.wordCount == 0 assert theItem.charCount == 0 @@ -695,7 +695,7 @@ def testCoreItem_ConvertFromFmt13(mockGUI): assert theItem.itemParent == "b000000000001" assert theItem.itemOrder == 1 assert theItem.isExpanded is True - assert theItem.isExported is True + assert theItem.isActive is True assert theItem.charCount == 0 assert theItem.wordCount == 0 assert theItem.paraCount == 0 @@ -728,7 +728,7 @@ def testCoreItem_ConvertFromFmt13(mockGUI): assert theItem.itemParent == "a000000000001" assert theItem.itemOrder == 2 assert theItem.isExpanded is False - assert theItem.isExported is True + assert theItem.isActive is True assert theItem.charCount == 600 assert theItem.wordCount == 100 assert theItem.paraCount == 6 diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index 54384205..7cadfca2 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -621,9 +621,9 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, fncDir, mockRnd): nwItem = projTree.theProject.tree[hNovelNote] # Toggle exported flag - assert nwItem.isExported is True - projTree._toggleItemExported(hNovelNote) - assert nwItem.isExported is False + assert nwItem.isActive is True + projTree._toggleItemActive(hNovelNote) + assert nwItem.isActive is False # Change item status assert nwItem.itemStatus == "s000000" From 6b16b7c3b7bf022c99092525488ba18aa10d3594 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 20 Oct 2022 18:28:32 +0200 Subject: [PATCH 2/3] Rename project file attribute --- novelwriter/core/item.py | 36 ++++++++------- sample/nwProject.nwx | 44 +++++++++---------- tests/lipsum/nwProject.nwx | 30 ++++++------- tests/minimal/nwProject.nwx | 6 +-- .../coreProject_NewCustomA_nwProject.nwx | 34 +++++++------- .../coreProject_NewCustomB_nwProject.nwx | 22 +++++----- .../coreProject_NewFileFolder_nwProject.nwx | 12 ++--- .../coreProject_NewMinimal_nwProject.nwx | 8 ++-- .../coreProject_NewRoot_nwProject.nwx | 8 ++-- .../guiEditor_Main_Final_nwProject.nwx | 14 +++--- .../guiEditor_Main_Initial_nwProject.nwx | 8 ++-- .../guiProjSettings_Dialog_nwProject.nwx | 8 ++-- tests/test_core/test_core_item.py | 2 +- tests/test_core/test_core_tree.py | 6 +-- 14 files changed, 121 insertions(+), 117 deletions(-) diff --git a/novelwriter/core/item.py b/novelwriter/core/item.py index d8bbc88e..40426d67 100644 --- a/novelwriter/core/item.py +++ b/novelwriter/core/item.py @@ -52,8 +52,8 @@ class NWItem: self._layout = nwItemLayout.NO_LAYOUT self._status = None self._import = None + self._active = True self._expanded = False - self._exported = True # Document Meta Data self._heading = "H0" # The main heading @@ -116,12 +116,12 @@ class NWItem: return self._import @property - def isExpanded(self): - return self._expanded + def isActive(self): + return self._active @property - def isActive(self): - return self._exported + def isExpanded(self): + return self._expanded @property def mainHeading(self): @@ -177,7 +177,7 @@ class NWItem: nameAttrib["status"] = str(self._status) nameAttrib["import"] = str(self._import) if self._type == nwItemType.FILE: - nameAttrib["exported"] = str(self._exported) + nameAttrib["active"] = str(self._active) xPack = etree.SubElement(xParent, "item", attrib=itemAttrib) self._subPack(xPack, "meta", attrib=metaAttrib) @@ -217,7 +217,11 @@ class NWItem: self.setName(xValue.text) self.setStatus(xValue.attrib.get("status", None)) self.setImport(xValue.attrib.get("import", None)) - self.setActive(xValue.attrib.get("exported", True)) + self.setActive(xValue.attrib.get("active", True)) + + # ToDo: Remove before 2.0 release. Only needed for 2.0 pre-releases. + if "exported" in xValue.attrib: + self.setActive(xValue.attrib.get("exported", True)) # Legacy Format (1.3 and earlier) elif xValue.tag == "status": @@ -496,6 +500,15 @@ class NWItem: self._import = self.theProject.importItems.check(value) return + def setActive(self, state): + """Set the export flag. + """ + if isinstance(state, str): + self._active = (state == str(True)) + else: + self._active = (state is True) + return + def setExpanded(self, state): """Set the expanded status of an item in the project tree. """ @@ -505,15 +518,6 @@ class NWItem: self._expanded = (state is True) return - def setActive(self, state): - """Set the export flag. - """ - if isinstance(state, str): - self._exported = (state == str(True)) - else: - self._exported = (state is True) - return - ## # Set Document Meta Data ## diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 75f59236..e32d66f8 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,13 +1,13 @@ - + Sample Project Sample Project Jane Smith Jay Doh - 1383 + 1385 236 - 69344 + 69348 False @@ -56,43 +56,43 @@ - Title Page + Title Page - Page + Page - Part One + Part One - Chapter One + Chapter One - Making a Scene + Making a Scene - Another Scene + Another Scene - Interlude + Interlude - A Note on Structure + A Note on Structure - Chapter Two + Chapter Two - We Found John! + We Found John! @@ -100,11 +100,11 @@ - Title Page + Title Page - Chapter One + Chapter One @@ -116,11 +116,11 @@ - John Smith + John Smith - Jane Smith + Jane Smith @@ -128,15 +128,15 @@ - Earth + Earth - Space + Space - Mars + Mars @@ -148,7 +148,7 @@ - Old File + Old File @@ -156,7 +156,7 @@ - Delete Me! + Delete Me! diff --git a/tests/lipsum/nwProject.nwx b/tests/lipsum/nwProject.nwx index ea5519c4..bfaedd84 100644 --- a/tests/lipsum/nwProject.nwx +++ b/tests/lipsum/nwProject.nwx @@ -51,19 +51,19 @@ - Lorem Ipsum + Lorem Ipsum - Front Matter + Front Matter - Prologue + Prologue - Act One + Act One @@ -71,19 +71,19 @@ - Chapter One + Chapter One - Scene One + Scene One - Scene Two + Scene Two - Interlude + Interlude @@ -91,19 +91,19 @@ - Chapter Two + Chapter Two - Scene Three + Scene Three - Scene Four + Scene Four - Scene Five + Scene Five @@ -111,7 +111,7 @@ - Mr. Nobody + Mr. Nobody @@ -119,7 +119,7 @@ - Main + Main @@ -127,7 +127,7 @@ - Ancient Europe + Ancient Europe diff --git a/tests/minimal/nwProject.nwx b/tests/minimal/nwProject.nwx index 99f81105..b9180838 100644 --- a/tests/minimal/nwProject.nwx +++ b/tests/minimal/nwProject.nwx @@ -49,7 +49,7 @@ - Title Page + Title Page @@ -57,11 +57,11 @@ - New Chapter + New Chapter - New Scene + New Scene diff --git a/tests/reference/coreProject_NewCustomA_nwProject.nwx b/tests/reference/coreProject_NewCustomA_nwProject.nwx index c61b7f3f..ef2056f7 100644 --- a/tests/reference/coreProject_NewCustomA_nwProject.nwx +++ b/tests/reference/coreProject_NewCustomA_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -49,55 +49,55 @@ - Title Page + Title Page - Chapter 1 + Chapter 1 - Scene 1.1 + Scene 1.1 - Scene 1.2 + Scene 1.2 - Scene 1.3 + Scene 1.3 - Chapter 2 + Chapter 2 - Scene 2.1 + Scene 2.1 - Scene 2.2 + Scene 2.2 - Scene 2.3 + Scene 2.3 - Chapter 3 + Chapter 3 - Scene 3.1 + Scene 3.1 - Scene 3.2 + Scene 3.2 - Scene 3.3 + Scene 3.3 @@ -105,7 +105,7 @@ - Main Plot + Main Plot @@ -113,7 +113,7 @@ - Protagonist + Protagonist @@ -121,7 +121,7 @@ - Main Location + Main Location diff --git a/tests/reference/coreProject_NewCustomB_nwProject.nwx b/tests/reference/coreProject_NewCustomB_nwProject.nwx index 9bc1bbf0..30d6c2a9 100644 --- a/tests/reference/coreProject_NewCustomB_nwProject.nwx +++ b/tests/reference/coreProject_NewCustomB_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -49,31 +49,31 @@ - Title Page + Title Page - Scene 1 + Scene 1 - Scene 2 + Scene 2 - Scene 3 + Scene 3 - Scene 4 + Scene 4 - Scene 5 + Scene 5 - Scene 6 + Scene 6 @@ -81,7 +81,7 @@ - Main Plot + Main Plot @@ -89,7 +89,7 @@ - Protagonist + Protagonist @@ -97,7 +97,7 @@ - Main Location + Main Location diff --git a/tests/reference/coreProject_NewFileFolder_nwProject.nwx b/tests/reference/coreProject_NewFileFolder_nwProject.nwx index 94655075..e1faf5a7 100644 --- a/tests/reference/coreProject_NewFileFolder_nwProject.nwx +++ b/tests/reference/coreProject_NewFileFolder_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -60,7 +60,7 @@ - Title Page + Title Page @@ -68,11 +68,11 @@ - New Chapter + New Chapter - New Scene + New Scene @@ -80,11 +80,11 @@ - Hello + Hello - Jane + Jane diff --git a/tests/reference/coreProject_NewMinimal_nwProject.nwx b/tests/reference/coreProject_NewMinimal_nwProject.nwx index 08a5d568..282aa1f3 100644 --- a/tests/reference/coreProject_NewMinimal_nwProject.nwx +++ b/tests/reference/coreProject_NewMinimal_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project @@ -47,15 +47,15 @@ - Title Page + Title Page - New Chapter + New Chapter - New Scene + New Scene diff --git a/tests/reference/coreProject_NewRoot_nwProject.nwx b/tests/reference/coreProject_NewRoot_nwProject.nwx index 24be3ad5..af7e0b73 100644 --- a/tests/reference/coreProject_NewRoot_nwProject.nwx +++ b/tests/reference/coreProject_NewRoot_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -60,7 +60,7 @@ - Title Page + Title Page @@ -68,11 +68,11 @@ - New Chapter + New Chapter - New Scene + New Scene diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index 1f8718b2..fb58330e 100644 --- a/tests/reference/guiEditor_Main_Final_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Final_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -48,7 +48,7 @@ - Title Page + Title Page @@ -56,11 +56,11 @@ - New Chapter + New Chapter - New Scene + New Scene @@ -68,7 +68,7 @@ - New Note + New Note @@ -76,7 +76,7 @@ - New Note + New Note @@ -84,7 +84,7 @@ - New Note + New Note diff --git a/tests/reference/guiEditor_Main_Initial_nwProject.nwx b/tests/reference/guiEditor_Main_Initial_nwProject.nwx index 2ee65716..aa3b3057 100644 --- a/tests/reference/guiEditor_Main_Initial_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Initial_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -48,7 +48,7 @@ - Title Page + Title Page @@ -56,11 +56,11 @@ - New Chapter + New Chapter - New Scene + New Scene diff --git a/tests/reference/guiProjSettings_Dialog_nwProject.nwx b/tests/reference/guiProjSettings_Dialog_nwProject.nwx index cff9285d..307aae55 100644 --- a/tests/reference/guiProjSettings_Dialog_nwProject.nwx +++ b/tests/reference/guiProjSettings_Dialog_nwProject.nwx @@ -1,5 +1,5 @@ - + Project Name Project Title @@ -53,7 +53,7 @@ - Title Page + Title Page @@ -61,11 +61,11 @@ - New Chapter + New Chapter - New Scene + New Scene diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index 97688df5..e7a72336 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -527,7 +527,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd): b'A Name' + b'import="%s" active="False">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 c3c20d34..588d23f5 100644 --- a/tests/test_core/test_core_tree.py +++ b/tests/test_core/test_core_tree.py @@ -422,11 +422,11 @@ def testCoreTree_XMLPackUnpack(mockGUI, mockItems): b'Chapter One' + b'import="i000004" active="True">Chapter One' b'Scene One' + b'import="i000004" active="True">Scene One' b'Outtakes' @@ -439,7 +439,7 @@ def testCoreTree_XMLPackUnpack(mockGUI, mockItems): b'Jane Doe' + b'import="i000004" active="True">Jane Doe' b'' b'' ) From 871cef8af9923e3ec0ba142e3d7db0db29646eae Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 20 Oct 2022 22:37:42 +0200 Subject: [PATCH 3/3] Add tooltip to active status icons and update build tool --- novelwriter/gui/projtree.py | 23 ++++++++++++++--------- novelwriter/tools/build.py | 4 ++-- tests/test_gui/test_gui_projtree.py | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index d535964e..96dc98f1 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -384,7 +384,7 @@ class GuiProjectTree(QTreeWidget): C_NAME = 0 C_COUNT = 1 - C_EXPORT = 2 + C_ACTIVE = 2 C_STATUS = 3 def __init__(self, projView): @@ -430,9 +430,9 @@ class GuiProjectTree(QTreeWidget): treeHeader.setMinimumSectionSize(iPx + cMg) treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.Stretch) treeHeader.setSectionResizeMode(self.C_COUNT, QHeaderView.ResizeToContents) - treeHeader.setSectionResizeMode(self.C_EXPORT, QHeaderView.Fixed) + treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.Fixed) treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.Fixed) - treeHeader.resizeSection(self.C_EXPORT, iPx + cMg) + treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg) treeHeader.resizeSection(self.C_STATUS, iPx + cMg) # Allow Move by Drag & Drop @@ -443,6 +443,10 @@ class GuiProjectTree(QTreeWidget): trRoot = self.invisibleRootItem() trRoot.setFlags(trRoot.flags() ^ Qt.ItemIsDropEnabled) + # Cached values + self._lblActive = self.tr("Active") + self._lblInactive = self.tr("Inactive") + # Set selection options self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSelectionBehavior(QAbstractItemView.SelectRows) @@ -908,9 +912,10 @@ class GuiProjectTree(QTreeWidget): trItem.setToolTip(self.C_STATUS, itemStatus) if nwItem.isFileType(): - trItem.setIcon( - self.C_EXPORT, self.mainTheme.getIcon("check" if nwItem.isActive else "cross") - ) + iconName = "check" if nwItem.isActive else "cross" + toolTip = self._lblActive if nwItem.isActive else self._lblInactive + trItem.setIcon(self.C_ACTIVE, self.mainTheme.getIcon(iconName)) + trItem.setToolTip(self.C_ACTIVE, toolTip) if self.mainConf.emphLabels and nwItem.isDocumentLayout(): trFont = trItem.font(self.C_NAME) @@ -1157,7 +1162,7 @@ class GuiProjectTree(QTreeWidget): if isFile: ctxMenu.addAction( - self.tr("Toggle Exported"), lambda: self._toggleItemActive(tHandle) + self.tr("Toggle Active"), lambda: self._toggleItemActive(tHandle) ) if tItem.isNovelLike(): @@ -1605,12 +1610,12 @@ class GuiProjectTree(QTreeWidget): newItem.setText(self.C_NAME, "") newItem.setText(self.C_COUNT, "0") - newItem.setText(self.C_EXPORT, "") + newItem.setText(self.C_ACTIVE, "") newItem.setText(self.C_STATUS, "") newItem.setTextAlignment(self.C_NAME, Qt.AlignLeft) newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight) - newItem.setTextAlignment(self.C_EXPORT, Qt.AlignLeft) + newItem.setTextAlignment(self.C_ACTIVE, Qt.AlignLeft) newItem.setTextAlignment(self.C_STATUS, Qt.AlignLeft) newItem.setData(self.C_NAME, Qt.UserRole, tHandle) diff --git a/novelwriter/tools/build.py b/novelwriter/tools/build.py index c372eb78..683f8e99 100644 --- a/novelwriter/tools/build.py +++ b/novelwriter/tools/build.py @@ -405,13 +405,13 @@ class GuiBuildNovel(QDialog): novelLabel = QLabel(self.tr("Include novel files")) notesLabel = QLabel(self.tr("Include note files")) - exportLabel = QLabel(self.tr("Ignore export flag")) + activeLabel = QLabel(self.tr("Include inactive files")) self.fileForm.addWidget(novelLabel, 0, 0, 1, 1, Qt.AlignLeft) self.fileForm.addWidget(self.novelFiles, 0, 1, 1, 1, Qt.AlignRight) self.fileForm.addWidget(notesLabel, 1, 0, 1, 1, Qt.AlignLeft) self.fileForm.addWidget(self.noteFiles, 1, 1, 1, 1, Qt.AlignRight) - self.fileForm.addWidget(exportLabel, 2, 0, 1, 1, Qt.AlignLeft) + self.fileForm.addWidget(activeLabel, 2, 0, 1, 1, Qt.AlignLeft) self.fileForm.addWidget(self.ignoreFlag, 2, 1, 1, 1, Qt.AlignRight) self.fileForm.setColumnStretch(0, 1) diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index 7cadfca2..b5201846 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -620,7 +620,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, fncDir, mockRnd): # Trigger the dedicated functions the menu entries connect to nwItem = projTree.theProject.tree[hNovelNote] - # Toggle exported flag + # Toggle active flag assert nwItem.isActive is True projTree._toggleItemActive(hNovelNote) assert nwItem.isActive is False