Fix build to exclude archived files

This commit is contained in:
Veronica K. B. Olsen
2020-08-16 17:39:18 +02:00
parent 68a7dd4390
commit cc3c938e16
2 changed files with 14 additions and 0 deletions
+12
View File
@@ -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.
+2
View File
@@ -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