Ensure project tree is up to date before building project

This commit is contained in:
Veronica K. B. Olsen
2020-05-24 11:57:31 +02:00
parent 10215dfb83
commit 4de2b713f9
3 changed files with 11 additions and 1 deletions
+3
View File
@@ -314,6 +314,9 @@ class GuiBuildNovel(QDialog):
makeHtml.setKeywords(incKeywords)
makeHtml.setJustify(justifyText)
# Make sure the tree order is correct
self.theParent.treeView.saveTreeOrder()
self.buildProgress.setMaximum(len(self.theProject.projTree))
self.buildProgress.setValue(0)
+6
View File
@@ -235,11 +235,17 @@ class GuiDocTree(QTreeWidget):
return True
def saveTreeOrder(self):
"""Build a list of the items in the project tree and send them
to the project class. This syncs up the two versions of the
project structure, and must be called before any code that
depends on this order to be up to date.
"""
theList = []
for i in range(self.topLevelItemCount()):
if self.topLevelItem(i) == self.orphRoot:
continue
theList = self._scanChildren(theList, self.topLevelItem(i), i)
logger.debug("Saving project tree item order")
self.theProject.setTreeOrder(theList)
return True