Clear the outline header between projects

This commit is contained in:
Veronica K. B. Olsen
2020-04-14 22:20:40 +02:00
parent 6a9ff4c46b
commit 5e90b1ff77
3 changed files with 17 additions and 5 deletions
+10 -5
View File
@@ -97,24 +97,29 @@ class GuiProjectOutline(QTreeWidget):
self.colIndex = {} self.colIndex = {}
self.treeNCols = 0 self.treeNCols = 0
self.initOutline() self.clearOutline()
self.headerMenu.setHiddenState(self.colHidden) self.headerMenu.setHiddenState(self.colHidden)
logger.debug("ProjectOutline initialisation complete") logger.debug("ProjectOutline initialisation complete")
return return
def initOutline(self): def clearOutline(self):
"""Set the default values for the Outline tree. """Clear the tree and header and set the default values for the
columns arrays.
""" """
self.clear()
self.setColumnCount(1)
self.setHeaderLabel(nwLabels.OUTLINE_COLS[nwOutline.TITLE])
self.treeOrder = [] self.treeOrder = []
self.colWidth = {} self.colWidth = {}
self.colHidden = {} self.colHidden = {}
self.colIndex = {} self.colIndex = {}
self.treeNCols = 0 self.treeNCols = 0
for hItem in nwOutline: for i, hItem in enumerate(nwOutline):
self.treeOrder.append(hItem) self.treeOrder.append(hItem)
self.colWidth[hItem] = self.DEF_WIDTH[hItem] self.colWidth[hItem] = self.DEF_WIDTH[hItem]
self.colHidden[hItem] = self.DEF_HIDDEN[hItem] self.colHidden[hItem] = self.DEF_HIDDEN[hItem]
@@ -153,7 +158,7 @@ class GuiProjectOutline(QTreeWidget):
"""Called before a project is closed. """Called before a project is closed.
""" """
self._saveHeaderState() self._saveHeaderState()
self.clear() self.clearOutline()
self.firstView = True self.firstView = True
return return
+1
View File
@@ -315,6 +315,7 @@ class GuiMain(QMainWindow):
self.theIndex.clearIndex() self.theIndex.clearIndex()
self.clearGUI() self.clearGUI()
self.hasProject = False self.hasProject = False
self.tabWidget.setCurrentWidget(self.splitView)
return saveOK return saveOK
+6
View File
@@ -38,6 +38,9 @@ class OptionState():
"""Load the options dictionary from the project settings file. """Load the options dictionary from the project settings file.
""" """
if self.theProject.projMeta is None:
return False
stateFile = path.join(self.theProject.projMeta, nwFiles.OPTS_FILE) stateFile = path.join(self.theProject.projMeta, nwFiles.OPTS_FILE)
theState = {} theState = {}
@@ -60,6 +63,9 @@ class OptionState():
"""Save the options dictionary to the project settings file. """Save the options dictionary to the project settings file.
""" """
if self.theProject.projMeta is None:
return False
stateFile = path.join(self.theProject.projMeta, nwFiles.OPTS_FILE) stateFile = path.join(self.theProject.projMeta, nwFiles.OPTS_FILE)
logger.debug("Saving GUI options file") logger.debug("Saving GUI options file")