Rename item isInactive to isInactiveClass
This commit is contained in:
@@ -273,7 +273,7 @@ class NWIndex:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
logger.debug("Indexing item with handle '%s'", tHandle)
|
logger.debug("Indexing item with handle '%s'", tHandle)
|
||||||
if theItem.isInactive():
|
if theItem.isInactiveClass():
|
||||||
self._scanInactive(theItem, theText)
|
self._scanInactive(theItem, theText)
|
||||||
else:
|
else:
|
||||||
self._scanActive(tHandle, theItem, theText, itemTags)
|
self._scanActive(tHandle, theItem, theText, itemTags)
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class NWItem:
|
|||||||
"""
|
"""
|
||||||
return self._class in (nwItemClass.NOVEL, nwItemClass.ARCHIVE, nwItemClass.TRASH)
|
return self._class in (nwItemClass.NOVEL, nwItemClass.ARCHIVE, nwItemClass.TRASH)
|
||||||
|
|
||||||
def isInactive(self):
|
def isInactiveClass(self):
|
||||||
"""Returns true if the item is in an inactive class.
|
"""Returns true if the item is in an inactive class.
|
||||||
"""
|
"""
|
||||||
return self._class in (nwItemClass.NO_CLASS, nwItemClass.ARCHIVE, nwItemClass.TRASH)
|
return self._class in (nwItemClass.NO_CLASS, nwItemClass.ARCHIVE, nwItemClass.TRASH)
|
||||||
|
|||||||
@@ -1404,7 +1404,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
self.theProject.tree.updateItemData(mHandle)
|
self.theProject.tree.updateItemData(mHandle)
|
||||||
|
|
||||||
# Update the index
|
# Update the index
|
||||||
if nwItemS.isInactive():
|
if nwItemS.isInactiveClass():
|
||||||
self.theProject.index.deleteHandle(mHandle)
|
self.theProject.index.deleteHandle(mHandle)
|
||||||
else:
|
else:
|
||||||
self.theProject.index.reIndexHandle(mHandle)
|
self.theProject.index.reIndexHandle(mHandle)
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
iRow = 0
|
iRow = 0
|
||||||
self.rootSelection = {}
|
self.rootSelection = {}
|
||||||
for tHandle, nwItem in self.theProject.tree.iterRoots(None):
|
for tHandle, nwItem in self.theProject.tree.iterRoots(None):
|
||||||
if not nwItem.isInactive():
|
if not nwItem.isInactiveClass():
|
||||||
rootLabel = QLabel(nwItem.itemName)
|
rootLabel = QLabel(nwItem.itemName)
|
||||||
rootLabel.setWordWrap(True)
|
rootLabel.setWordWrap(True)
|
||||||
|
|
||||||
@@ -823,7 +823,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
|
|
||||||
isNone = not theItem.isFileType()
|
isNone = not theItem.isFileType()
|
||||||
isNone |= theItem.itemLayout == nwItemLayout.NO_LAYOUT
|
isNone |= theItem.itemLayout == nwItemLayout.NO_LAYOUT
|
||||||
isNone |= theItem.isInactive()
|
isNone |= theItem.isInactiveClass()
|
||||||
isNone |= theItem.itemParent is None
|
isNone |= theItem.itemParent is None
|
||||||
isNote = theItem.isNoteLayout()
|
isNote = theItem.isNoteLayout()
|
||||||
isNovel = not isNone and not isNote
|
isNovel = not isNone and not isNote
|
||||||
|
|||||||
@@ -340,67 +340,67 @@ def testCoreItem_ClassSetter(mockGUI):
|
|||||||
assert theItem.itemClass == nwItemClass.NO_CLASS
|
assert theItem.itemClass == nwItemClass.NO_CLASS
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is True
|
assert theItem.isInactiveClass() is True
|
||||||
|
|
||||||
theItem.setClass("NOVEL")
|
theItem.setClass("NOVEL")
|
||||||
assert theItem.itemClass == nwItemClass.NOVEL
|
assert theItem.itemClass == nwItemClass.NOVEL
|
||||||
assert theItem.isNovelLike() is True
|
assert theItem.isNovelLike() is True
|
||||||
assert theItem.documentAllowed() is True
|
assert theItem.documentAllowed() is True
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("PLOT")
|
theItem.setClass("PLOT")
|
||||||
assert theItem.itemClass == nwItemClass.PLOT
|
assert theItem.itemClass == nwItemClass.PLOT
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("CHARACTER")
|
theItem.setClass("CHARACTER")
|
||||||
assert theItem.itemClass == nwItemClass.CHARACTER
|
assert theItem.itemClass == nwItemClass.CHARACTER
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("WORLD")
|
theItem.setClass("WORLD")
|
||||||
assert theItem.itemClass == nwItemClass.WORLD
|
assert theItem.itemClass == nwItemClass.WORLD
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("TIMELINE")
|
theItem.setClass("TIMELINE")
|
||||||
assert theItem.itemClass == nwItemClass.TIMELINE
|
assert theItem.itemClass == nwItemClass.TIMELINE
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("OBJECT")
|
theItem.setClass("OBJECT")
|
||||||
assert theItem.itemClass == nwItemClass.OBJECT
|
assert theItem.itemClass == nwItemClass.OBJECT
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("ENTITY")
|
theItem.setClass("ENTITY")
|
||||||
assert theItem.itemClass == nwItemClass.ENTITY
|
assert theItem.itemClass == nwItemClass.ENTITY
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("CUSTOM")
|
theItem.setClass("CUSTOM")
|
||||||
assert theItem.itemClass == nwItemClass.CUSTOM
|
assert theItem.itemClass == nwItemClass.CUSTOM
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is False
|
assert theItem.documentAllowed() is False
|
||||||
assert theItem.isInactive() is False
|
assert theItem.isInactiveClass() is False
|
||||||
|
|
||||||
theItem.setClass("ARCHIVE")
|
theItem.setClass("ARCHIVE")
|
||||||
assert theItem.itemClass == nwItemClass.ARCHIVE
|
assert theItem.itemClass == nwItemClass.ARCHIVE
|
||||||
assert theItem.isNovelLike() is True
|
assert theItem.isNovelLike() is True
|
||||||
assert theItem.documentAllowed() is True
|
assert theItem.documentAllowed() is True
|
||||||
assert theItem.isInactive() is True
|
assert theItem.isInactiveClass() is True
|
||||||
|
|
||||||
theItem.setClass("TRASH")
|
theItem.setClass("TRASH")
|
||||||
assert theItem.itemClass == nwItemClass.TRASH
|
assert theItem.itemClass == nwItemClass.TRASH
|
||||||
assert theItem.isNovelLike() is False
|
assert theItem.isNovelLike() is False
|
||||||
assert theItem.documentAllowed() is True
|
assert theItem.documentAllowed() is True
|
||||||
assert theItem.isInactive() is True
|
assert theItem.isInactiveClass() is True
|
||||||
|
|
||||||
# Alternative
|
# Alternative
|
||||||
theItem.setClass(nwItemClass.NOVEL)
|
theItem.setClass(nwItemClass.NOVEL)
|
||||||
|
|||||||
Reference in New Issue
Block a user