diff --git a/nw/core/index.py b/nw/core/index.py index 60129b35..346fdb36 100644 --- a/nw/core/index.py +++ b/nw/core/index.py @@ -529,13 +529,18 @@ class NWIndex(): # Extract Data ## - def getNovelStructure(self): + def getNovelStructure(self, skipExcluded=True): """Builds a list of all titles in the novel, in the correct order as they appear in the tree view and in the respective document files, but skipping all note files. """ theStructure = [] - for tHandle in self.theProject.projTree.handles(): + for tItem in self.theProject.projTree: + if tItem is None: + continue + if not tItem.isExported and skipExcluded: + continue + tHandle = tItem.itemHandle if tHandle not in self.novelIndex: continue for sTitle in sorted(self.novelIndex[tHandle].keys()): diff --git a/nw/gui/elements/outline.py b/nw/gui/elements/outline.py index 54cfbf5a..408dc126 100644 --- a/nw/gui/elements/outline.py +++ b/nw/gui/elements/outline.py @@ -319,7 +319,6 @@ class GuiProjectOutline(QTreeWidget): if they are hidden. This ensures that showing and hiding columns is fast and doesn't require a rebuild of the tree. """ - self.clear() if self.firstView: @@ -347,7 +346,7 @@ class GuiProjectOutline(QTreeWidget): currChapter = None currScene = None - for titleKey in self.theIndex.getNovelStructure(): + for titleKey in self.theIndex.getNovelStructure(skipExcluded=True): if len(titleKey) < 16: continue @@ -404,7 +403,6 @@ class GuiProjectOutline(QTreeWidget): def _createTreeItem(self, tHandle, sTitle): """Populate a tree item with all the column values. """ - nwItem = self.theProject.projTree[tHandle] novIdx = self.theIndex.novelIndex[tHandle][sTitle]