Let the main gui handle the novel tree refresh decision
This commit is contained in:
+1
-3
@@ -416,9 +416,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
self.theIndex.scanText(tHandle, docText)
|
self.theIndex.scanText(tHandle, docText)
|
||||||
if self._updateHeaders(checkLevel=True):
|
if self._updateHeaders(checkLevel=True):
|
||||||
if self.theParent.projTabs.currentIndex() == self.theParent.idxNovelView:
|
self.theParent.requestNovelTreeRefresh()
|
||||||
logger.verbose("Document headers have changed, updating novel tree")
|
|
||||||
self.theParent.novelView.refreshTree()
|
|
||||||
else:
|
else:
|
||||||
self.theParent.novelView.updateWordCounts(tHandle)
|
self.theParent.novelView.updateWordCounts(tHandle)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -131,10 +131,11 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
def refreshTree(self, overRide=False):
|
def refreshTree(self, overRide=False):
|
||||||
"""Called whenever the Novel tab is activated.
|
"""Called whenever the Novel tab is activated.
|
||||||
"""
|
"""
|
||||||
|
logger.verbose("Requesting refresh of the novel tree")
|
||||||
treeChanged = self.theParent.treeView.changedSince(self._lastBuild)
|
treeChanged = self.theParent.treeView.changedSince(self._lastBuild)
|
||||||
indexChanged = self.theIndex.novelChangedSince(self._lastBuild)
|
indexChanged = self.theIndex.novelChangedSince(self._lastBuild)
|
||||||
if not (treeChanged or indexChanged):
|
if not (treeChanged or indexChanged):
|
||||||
logger.verbose("No changes made to the novel")
|
logger.verbose("No changes have been made to the novel index")
|
||||||
return
|
return
|
||||||
|
|
||||||
selItem = self.selectedItems()
|
selItem = self.selectedItems()
|
||||||
|
|||||||
@@ -817,6 +817,14 @@ class GuiMain(QMainWindow):
|
|||||||
self.novelView.refreshTree()
|
self.novelView.refreshTree()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def requestNovelTreeRefresh(self):
|
||||||
|
"""Update the novel tree, but only if it is visible.
|
||||||
|
"""
|
||||||
|
if self.projTabs.currentIndex() == self.idxNovelView and self.hasProject:
|
||||||
|
self.novelView.refreshTree()
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def rebuildIndex(self, beQuiet=False):
|
def rebuildIndex(self, beQuiet=False):
|
||||||
"""Rebuild the entire index.
|
"""Rebuild the entire index.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user