Rename the access metods of the item class from exported to active
This commit is contained in:
@@ -802,7 +802,7 @@ class ItemIndex:
|
|||||||
continue
|
continue
|
||||||
if tItem.isNoteLayout():
|
if tItem.isNoteLayout():
|
||||||
continue
|
continue
|
||||||
if skipExcl and not tItem.isExported:
|
if skipExcl and not tItem.isActive:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
tHandle = tItem.itemHandle
|
tHandle = tItem.itemHandle
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class NWItem:
|
|||||||
return self._expanded
|
return self._expanded
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def isExported(self):
|
def isActive(self):
|
||||||
return self._exported
|
return self._exported
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -217,7 +217,7 @@ class NWItem:
|
|||||||
self.setName(xValue.text)
|
self.setName(xValue.text)
|
||||||
self.setStatus(xValue.attrib.get("status", None))
|
self.setStatus(xValue.attrib.get("status", None))
|
||||||
self.setImport(xValue.attrib.get("import", 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)
|
# Legacy Format (1.3 and earlier)
|
||||||
elif xValue.tag == "status":
|
elif xValue.tag == "status":
|
||||||
@@ -231,7 +231,7 @@ class NWItem:
|
|||||||
elif xValue.tag == "expanded":
|
elif xValue.tag == "expanded":
|
||||||
self.setExpanded(xValue.text)
|
self.setExpanded(xValue.text)
|
||||||
elif xValue.tag == "exported":
|
elif xValue.tag == "exported":
|
||||||
self.setExported(xValue.text)
|
self.setActive(xValue.text)
|
||||||
elif xValue.tag == "charCount":
|
elif xValue.tag == "charCount":
|
||||||
self.setCharCount(xValue.text)
|
self.setCharCount(xValue.text)
|
||||||
elif xValue.tag == "wordCount":
|
elif xValue.tag == "wordCount":
|
||||||
@@ -505,7 +505,7 @@ class NWItem:
|
|||||||
self._expanded = (state is True)
|
self._expanded = (state is True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setExported(self, state):
|
def setActive(self, state):
|
||||||
"""Set the export flag.
|
"""Set the export flag.
|
||||||
"""
|
"""
|
||||||
if isinstance(state, str):
|
if isinstance(state, str):
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class GuiItemDetails(QWidget):
|
|||||||
theLabel = theLabel[:96].rstrip()+" ..."
|
theLabel = theLabel[:96].rstrip()+" ..."
|
||||||
|
|
||||||
if nwItem.isFileType():
|
if nwItem.isFileType():
|
||||||
if nwItem.isExported:
|
if nwItem.isActive:
|
||||||
self.labelIcon.setPixmap(self._expCheck)
|
self.labelIcon.setPixmap(self._expCheck)
|
||||||
else:
|
else:
|
||||||
self.labelIcon.setPixmap(self._expCross)
|
self.labelIcon.setPixmap(self._expCross)
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
|
|
||||||
if nwItem.isFileType():
|
if nwItem.isFileType():
|
||||||
trItem.setIcon(
|
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():
|
if self.mainConf.emphLabels and nwItem.isDocumentLayout():
|
||||||
@@ -1157,7 +1157,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
|
|
||||||
if isFile:
|
if isFile:
|
||||||
ctxMenu.addAction(
|
ctxMenu.addAction(
|
||||||
self.tr("Toggle Exported"), lambda: self._toggleItemExported(tHandle)
|
self.tr("Toggle Exported"), lambda: self._toggleItemActive(tHandle)
|
||||||
)
|
)
|
||||||
|
|
||||||
if tItem.isNovelLike():
|
if tItem.isNovelLike():
|
||||||
@@ -1367,12 +1367,12 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
"""
|
"""
|
||||||
return self._treeMap.get(tHandle, None)
|
return self._treeMap.get(tHandle, None)
|
||||||
|
|
||||||
def _toggleItemExported(self, tHandle):
|
def _toggleItemActive(self, tHandle):
|
||||||
"""Toggle the exported status of an item.
|
"""Toggle the active status of an item.
|
||||||
"""
|
"""
|
||||||
tItem = self.theProject.tree[tHandle]
|
tItem = self.theProject.tree[tHandle]
|
||||||
if tItem is not None:
|
if tItem is not None:
|
||||||
tItem.setExported(not tItem.isExported)
|
tItem.setActive(not tItem.isActive)
|
||||||
self.setTreeItemValues(tItem.itemHandle)
|
self.setTreeItemValues(tItem.itemHandle)
|
||||||
self._alertTreeChange(tHandle, flush=False)
|
self._alertTreeChange(tHandle, flush=False)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
if theItem is None:
|
if theItem is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not (theItem.isExported or ignoreFlag):
|
if not (theItem.isActive or ignoreFlag):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if theItem.itemRoot in rootFilter:
|
if theItem.itemRoot in rootFilter:
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ def testCoreIndex_ExtractData(mockGUI, fncDir, mockRnd):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Check that excluded files can be skipped
|
# Check that excluded files can be skipped
|
||||||
theProject.tree[nHandle].setExported(False)
|
theProject.tree[nHandle].setActive(False)
|
||||||
|
|
||||||
theKeys = []
|
theKeys = []
|
||||||
for aKey, _, _, _ in theIndex.novelStructure(skipExcl=False):
|
for aKey, _, _, _ in theIndex.novelStructure(skipExcl=False):
|
||||||
@@ -1072,7 +1072,7 @@ def testCoreIndex_ItemIndex(mockGUI, fncDir, mockRnd):
|
|||||||
assert nStruct[3][0] == uHandle
|
assert nStruct[3][0] == uHandle
|
||||||
|
|
||||||
# Skip excluded
|
# Skip excluded
|
||||||
theProject.tree[sHandle].setExported(False)
|
theProject.tree[sHandle].setActive(False)
|
||||||
nStruct = list(itemIndex.iterNovelStructure(skipExcl=True))
|
nStruct = list(itemIndex.iterNovelStructure(skipExcl=True))
|
||||||
assert len(nStruct) == 3
|
assert len(nStruct) == 3
|
||||||
assert nStruct[0][0] == nHandle
|
assert nStruct[0][0] == nHandle
|
||||||
|
|||||||
@@ -136,18 +136,18 @@ def testCoreItem_Setters(mockGUI, mockRnd):
|
|||||||
assert theItem.isExpanded is True
|
assert theItem.isExpanded is True
|
||||||
|
|
||||||
# Exported
|
# Exported
|
||||||
theItem.setExported(8)
|
theItem.setActive(8)
|
||||||
assert theItem.isExported is False
|
assert theItem.isActive is False
|
||||||
theItem.setExported(None)
|
theItem.setActive(None)
|
||||||
assert theItem.isExported is False
|
assert theItem.isActive is False
|
||||||
theItem.setExported("None")
|
theItem.setActive("None")
|
||||||
assert theItem.isExported is False
|
assert theItem.isActive is False
|
||||||
theItem.setExported("What?")
|
theItem.setActive("What?")
|
||||||
assert theItem.isExported is False
|
assert theItem.isActive is False
|
||||||
theItem.setExported("True")
|
theItem.setActive("True")
|
||||||
assert theItem.isExported is True
|
assert theItem.isActive is True
|
||||||
theItem.setExported(True)
|
theItem.setActive(True)
|
||||||
assert theItem.isExported is True
|
assert theItem.isActive is True
|
||||||
|
|
||||||
# CharCount
|
# CharCount
|
||||||
theItem.setCharCount(None)
|
theItem.setCharCount(None)
|
||||||
@@ -513,7 +513,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd):
|
|||||||
theItem.setType("FILE")
|
theItem.setType("FILE")
|
||||||
theItem.setImport(importKeys[3])
|
theItem.setImport(importKeys[3])
|
||||||
theItem.setLayout("NOTE")
|
theItem.setLayout("NOTE")
|
||||||
theItem.setExported(False)
|
theItem.setActive(False)
|
||||||
theItem.setParaCount(3)
|
theItem.setParaCount(3)
|
||||||
theItem.setWordCount(5)
|
theItem.setWordCount(5)
|
||||||
theItem.setCharCount(7)
|
theItem.setCharCount(7)
|
||||||
@@ -538,7 +538,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd):
|
|||||||
assert theItem.itemParent == "0123456789abc"
|
assert theItem.itemParent == "0123456789abc"
|
||||||
assert theItem.itemRoot == "0123456789abc"
|
assert theItem.itemRoot == "0123456789abc"
|
||||||
assert theItem.itemOrder == 1
|
assert theItem.itemOrder == 1
|
||||||
assert theItem.isExported is False
|
assert theItem.isActive is False
|
||||||
assert theItem.paraCount == 3
|
assert theItem.paraCount == 3
|
||||||
assert theItem.wordCount == 5
|
assert theItem.wordCount == 5
|
||||||
assert theItem.charCount == 7
|
assert theItem.charCount == 7
|
||||||
@@ -563,7 +563,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd):
|
|||||||
theItem.setStatus(statusKeys[1])
|
theItem.setStatus(statusKeys[1])
|
||||||
theItem.setLayout("NOTE")
|
theItem.setLayout("NOTE")
|
||||||
theItem.setExpanded(True)
|
theItem.setExpanded(True)
|
||||||
theItem.setExported(False)
|
theItem.setActive(False)
|
||||||
theItem.setParaCount(3)
|
theItem.setParaCount(3)
|
||||||
theItem.setWordCount(5)
|
theItem.setWordCount(5)
|
||||||
theItem.setCharCount(7)
|
theItem.setCharCount(7)
|
||||||
@@ -588,7 +588,7 @@ def testCoreItem_XMLPackUnpack(mockGUI, caplog, mockRnd):
|
|||||||
assert theItem.itemRoot == "0123456789abc"
|
assert theItem.itemRoot == "0123456789abc"
|
||||||
assert theItem.itemOrder == 1
|
assert theItem.itemOrder == 1
|
||||||
assert theItem.isExpanded is True
|
assert theItem.isExpanded is True
|
||||||
assert theItem.isExported is True
|
assert theItem.isActive is True
|
||||||
assert theItem.paraCount == 0
|
assert theItem.paraCount == 0
|
||||||
assert theItem.wordCount == 0
|
assert theItem.wordCount == 0
|
||||||
assert theItem.charCount == 0
|
assert theItem.charCount == 0
|
||||||
@@ -695,7 +695,7 @@ def testCoreItem_ConvertFromFmt13(mockGUI):
|
|||||||
assert theItem.itemParent == "b000000000001"
|
assert theItem.itemParent == "b000000000001"
|
||||||
assert theItem.itemOrder == 1
|
assert theItem.itemOrder == 1
|
||||||
assert theItem.isExpanded is True
|
assert theItem.isExpanded is True
|
||||||
assert theItem.isExported is True
|
assert theItem.isActive is True
|
||||||
assert theItem.charCount == 0
|
assert theItem.charCount == 0
|
||||||
assert theItem.wordCount == 0
|
assert theItem.wordCount == 0
|
||||||
assert theItem.paraCount == 0
|
assert theItem.paraCount == 0
|
||||||
@@ -728,7 +728,7 @@ def testCoreItem_ConvertFromFmt13(mockGUI):
|
|||||||
assert theItem.itemParent == "a000000000001"
|
assert theItem.itemParent == "a000000000001"
|
||||||
assert theItem.itemOrder == 2
|
assert theItem.itemOrder == 2
|
||||||
assert theItem.isExpanded is False
|
assert theItem.isExpanded is False
|
||||||
assert theItem.isExported is True
|
assert theItem.isActive is True
|
||||||
assert theItem.charCount == 600
|
assert theItem.charCount == 600
|
||||||
assert theItem.wordCount == 100
|
assert theItem.wordCount == 100
|
||||||
assert theItem.paraCount == 6
|
assert theItem.paraCount == 6
|
||||||
|
|||||||
@@ -621,9 +621,9 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, fncDir, mockRnd):
|
|||||||
nwItem = projTree.theProject.tree[hNovelNote]
|
nwItem = projTree.theProject.tree[hNovelNote]
|
||||||
|
|
||||||
# Toggle exported flag
|
# Toggle exported flag
|
||||||
assert nwItem.isExported is True
|
assert nwItem.isActive is True
|
||||||
projTree._toggleItemExported(hNovelNote)
|
projTree._toggleItemActive(hNovelNote)
|
||||||
assert nwItem.isExported is False
|
assert nwItem.isActive is False
|
||||||
|
|
||||||
# Change item status
|
# Change item status
|
||||||
assert nwItem.itemStatus == "s000000"
|
assert nwItem.itemStatus == "s000000"
|
||||||
|
|||||||
Reference in New Issue
Block a user