From cfd1b950d36bfab1bc91a73d9eeaf7571df1d7c2 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 28 Feb 2023 22:40:02 +0100 Subject: [PATCH] Rename item isInactive to isInactiveClass --- novelwriter/core/index.py | 2 +- novelwriter/core/item.py | 2 +- novelwriter/gui/projtree.py | 2 +- novelwriter/tools/build.py | 4 ++-- tests/test_core/test_core_item.py | 22 +++++++++++----------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/novelwriter/core/index.py b/novelwriter/core/index.py index deaea5c3..920eef22 100644 --- a/novelwriter/core/index.py +++ b/novelwriter/core/index.py @@ -273,7 +273,7 @@ class NWIndex: return False logger.debug("Indexing item with handle '%s'", tHandle) - if theItem.isInactive(): + if theItem.isInactiveClass(): self._scanInactive(theItem, theText) else: self._scanActive(tHandle, theItem, theText, itemTags) diff --git a/novelwriter/core/item.py b/novelwriter/core/item.py index e04d7c25..dfee50a3 100644 --- a/novelwriter/core/item.py +++ b/novelwriter/core/item.py @@ -294,7 +294,7 @@ class NWItem: """ 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. """ return self._class in (nwItemClass.NO_CLASS, nwItemClass.ARCHIVE, nwItemClass.TRASH) diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index df29903b..0d8c6bed 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -1404,7 +1404,7 @@ class GuiProjectTree(QTreeWidget): self.theProject.tree.updateItemData(mHandle) # Update the index - if nwItemS.isInactive(): + if nwItemS.isInactiveClass(): self.theProject.index.deleteHandle(mHandle) else: self.theProject.index.reIndexHandle(mHandle) diff --git a/novelwriter/tools/build.py b/novelwriter/tools/build.py index b90893b2..bc80c2bb 100644 --- a/novelwriter/tools/build.py +++ b/novelwriter/tools/build.py @@ -367,7 +367,7 @@ class GuiBuildNovel(QDialog): iRow = 0 self.rootSelection = {} for tHandle, nwItem in self.theProject.tree.iterRoots(None): - if not nwItem.isInactive(): + if not nwItem.isInactiveClass(): rootLabel = QLabel(nwItem.itemName) rootLabel.setWordWrap(True) @@ -823,7 +823,7 @@ class GuiBuildNovel(QDialog): isNone = not theItem.isFileType() isNone |= theItem.itemLayout == nwItemLayout.NO_LAYOUT - isNone |= theItem.isInactive() + isNone |= theItem.isInactiveClass() isNone |= theItem.itemParent is None isNote = theItem.isNoteLayout() isNovel = not isNone and not isNote diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index 892bf250..b388a548 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -340,67 +340,67 @@ def testCoreItem_ClassSetter(mockGUI): assert theItem.itemClass == nwItemClass.NO_CLASS assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is True + assert theItem.isInactiveClass() is True theItem.setClass("NOVEL") assert theItem.itemClass == nwItemClass.NOVEL assert theItem.isNovelLike() is True assert theItem.documentAllowed() is True - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("PLOT") assert theItem.itemClass == nwItemClass.PLOT assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("CHARACTER") assert theItem.itemClass == nwItemClass.CHARACTER assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("WORLD") assert theItem.itemClass == nwItemClass.WORLD assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("TIMELINE") assert theItem.itemClass == nwItemClass.TIMELINE assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("OBJECT") assert theItem.itemClass == nwItemClass.OBJECT assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("ENTITY") assert theItem.itemClass == nwItemClass.ENTITY assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("CUSTOM") assert theItem.itemClass == nwItemClass.CUSTOM assert theItem.isNovelLike() is False assert theItem.documentAllowed() is False - assert theItem.isInactive() is False + assert theItem.isInactiveClass() is False theItem.setClass("ARCHIVE") assert theItem.itemClass == nwItemClass.ARCHIVE assert theItem.isNovelLike() is True assert theItem.documentAllowed() is True - assert theItem.isInactive() is True + assert theItem.isInactiveClass() is True theItem.setClass("TRASH") assert theItem.itemClass == nwItemClass.TRASH assert theItem.isNovelLike() is False assert theItem.documentAllowed() is True - assert theItem.isInactive() is True + assert theItem.isInactiveClass() is True # Alternative theItem.setClass(nwItemClass.NOVEL)