From cc3c938e16fde37daa5e0dd0351dc4196123cd92 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 16 Aug 2020 17:39:18 +0200 Subject: [PATCH] Fix build to exclude archived files --- nw/core/tree.py | 12 ++++++++++++ nw/gui/build.py | 2 ++ 2 files changed, 14 insertions(+) diff --git a/nw/core/tree.py b/nw/core/tree.py index 3181892a..aab0e563 100644 --- a/nw/core/tree.py +++ b/nw/core/tree.py @@ -67,6 +67,7 @@ class NWTree(): self._treeOrder = [] self._treeRoots = [] self._trashRoot = None + self._archRoot = None self._theLength = 0 self._theIndex = 0 self._treeChanged = False @@ -96,6 +97,9 @@ class NWTree(): if nwItem.itemType == nwItemType.ROOT: logger.verbose("Entry %s is a root item" % str(tHandle)) self._treeRoots.append(tHandle) + if nwItem.itemClass == nwItemClass.ARCHIVE: + logger.verbose("Entry %s is the archive folder" % str(tHandle)) + self._archRoot = tHandle if nwItem.itemType == nwItemType.TRASH: if self._trashRoot is None: @@ -211,6 +215,14 @@ class NWTree(): return self._trashRoot return None + def archiveRoot(self): + """Returns the handle of the archive folder, or None if there + isn't one. + """ + if self._archRoot: + return self._archRoot + return None + def findRoot(self, theClass): """Find the root item for a given class. Note: This returns the first item for class CUSTOM. diff --git a/nw/gui/build.py b/nw/gui/build.py index 9bc09e61..c5949e4e 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -478,6 +478,7 @@ class GuiBuildNovel(QDialog): noteRoot = noteFiles noteRoot &= tItem.itemType == nwItemType.ROOT noteRoot &= tItem.itemClass != nwItemClass.NOVEL + noteRoot &= tItem.itemClass != nwItemClass.ARCHIVE try: if noteRoot: @@ -551,6 +552,7 @@ class GuiBuildNovel(QDialog): isNone |= theItem.itemClass == nwItemClass.NO_CLASS isNone |= theItem.itemClass == nwItemClass.TRASH isNone |= theItem.parHandle == self.theProject.projTree.trashRoot() + isNone |= theItem.parHandle == self.theProject.projTree.archiveRoot() isNone |= theItem.parHandle is None isNote = theItem.itemLayout == nwItemLayout.NOTE isNovel = not isNone and not isNote