Simplify how the project tree is populated
This commit is contained in:
@@ -166,6 +166,7 @@ class GuiProjectView(QWidget):
|
|||||||
|
|
||||||
def openProjectTasks(self) -> None:
|
def openProjectTasks(self) -> None:
|
||||||
"""Run open project tasks."""
|
"""Run open project tasks."""
|
||||||
|
self.populateTree()
|
||||||
self.projBar.buildQuickLinksMenu()
|
self.projBar.buildQuickLinksMenu()
|
||||||
self.projBar.setEnabled(True)
|
self.projBar.setEnabled(True)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -189,9 +189,6 @@ class GuiMain(QMainWindow):
|
|||||||
self.splitView.setVisible(False)
|
self.splitView.setVisible(False)
|
||||||
self.docEditor.closeSearch()
|
self.docEditor.closeSearch()
|
||||||
|
|
||||||
# Initialise the Project Tree
|
|
||||||
self.rebuildTrees()
|
|
||||||
|
|
||||||
# Assemble Main Window Elements
|
# Assemble Main Window Elements
|
||||||
self.mainBox = QHBoxLayout()
|
self.mainBox = QHBoxLayout()
|
||||||
self.mainBox.addWidget(self.sideBar)
|
self.mainBox.addWidget(self.sideBar)
|
||||||
@@ -463,7 +460,6 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
# Update GUI
|
# Update GUI
|
||||||
self._updateWindowTitle(SHARED.project.data.name)
|
self._updateWindowTitle(SHARED.project.data.name)
|
||||||
self.rebuildTrees()
|
|
||||||
self.docEditor.toggleSpellCheck(SHARED.project.data.spellCheck)
|
self.docEditor.toggleSpellCheck(SHARED.project.data.spellCheck)
|
||||||
self.mainStatus.setRefTime(SHARED.project.projOpened)
|
self.mainStatus.setRefTime(SHARED.project.projOpened)
|
||||||
self.projView.openProjectTasks()
|
self.projView.openProjectTasks()
|
||||||
@@ -737,11 +733,6 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def rebuildTrees(self) -> None:
|
|
||||||
"""Rebuild the project tree."""
|
|
||||||
self.projView.populateTree()
|
|
||||||
return
|
|
||||||
|
|
||||||
def rebuildIndex(self, beQuiet: bool = False) -> None:
|
def rebuildIndex(self, beQuiet: bool = False) -> None:
|
||||||
"""Rebuild the entire index."""
|
"""Rebuild the entire index."""
|
||||||
if SHARED.hasProject:
|
if SHARED.hasProject:
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ def testDlgProjSettings_StatusImport(qtbot, monkeypatch, nwGUI, projPath, mockRn
|
|||||||
project.tree[hCharNote].setImport(C.iMajor) # type: ignore
|
project.tree[hCharNote].setImport(C.iMajor) # type: ignore
|
||||||
project.tree[hWorldNote].setImport(C.iMain) # type: ignore
|
project.tree[hWorldNote].setImport(C.iMain) # type: ignore
|
||||||
|
|
||||||
nwGUI.rebuildTrees()
|
nwGUI.projView.populateTree()
|
||||||
project.countStatus()
|
project.countStatus()
|
||||||
|
|
||||||
assert [e.count for _, e in project.data.itemStatus.iterItems()] == [2, 0, 2, 1]
|
assert [e.count for _, e in project.data.itemStatus.iterItems()] == [2, 0, 2, 1]
|
||||||
|
|||||||
+1
-1
@@ -197,7 +197,7 @@ def buildTestProject(obj: object, projPath: Path) -> None:
|
|||||||
project._valid = True
|
project._valid = True
|
||||||
|
|
||||||
if nwGUI is not None:
|
if nwGUI is not None:
|
||||||
nwGUI.rebuildTrees()
|
nwGUI.projView.populateTree()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user