Fixed a bug where outline header state from previous seession was restored on outline update

This commit is contained in:
Veronica K. B. Olsen
2020-04-13 16:57:43 +02:00
parent 861556d32a
commit 7b9da12aa4
3 changed files with 22 additions and 17 deletions
+18 -14
View File
@@ -130,7 +130,7 @@ class GuiProjectOutline(QTreeWidget):
"""
# If it's the first time, we always build
if self.firstView or overRide:
if self.firstView or self.firstView and overRide:
self._loadHeaderState()
self._populateTree()
self.firstView = False
@@ -176,6 +176,7 @@ class GuiProjectOutline(QTreeWidget):
of the columns.
"""
self.treeOrder.insert(newVisualIdx, self.treeOrder.pop(oldVisualIdx))
self._saveHeaderState()
return
def _menuColumnToggled(self, isChecked, theItem):
@@ -185,6 +186,7 @@ class GuiProjectOutline(QTreeWidget):
logger.verbose("User toggled Outline column '%s'" % theItem.name)
if theItem in self.colIndex:
self.setColumnHidden(self.colIndex[theItem], not isChecked)
self._saveHeaderState()
return
##
@@ -282,21 +284,23 @@ class GuiProjectOutline(QTreeWidget):
"""Build the tree based on the project index.
"""
theLabels = []
for i, hItem in enumerate(self.treeOrder):
theLabels.append(nwLabels.OUTLINE_COLS[hItem])
self.colIndex[hItem] = i
self.clear()
self.setHeaderLabels(theLabels)
for hItem in self.treeOrder:
self.setColumnWidth(self.colIndex[hItem], self.colWidth[hItem])
self.setColumnHidden(self.colIndex[hItem], self.colHidden[hItem])
headItem = self.headerItem()
headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.WCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.PCOUNT], Qt.AlignRight)
if self.firstView:
theLabels = []
for i, hItem in enumerate(self.treeOrder):
theLabels.append(nwLabels.OUTLINE_COLS[hItem])
self.colIndex[hItem] = i
self.setHeaderLabels(theLabels)
for hItem in self.treeOrder:
self.setColumnWidth(self.colIndex[hItem], self.colWidth[hItem])
self.setColumnHidden(self.colIndex[hItem], self.colHidden[hItem])
headItem = self.headerItem()
headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.WCOUNT], Qt.AlignRight)
headItem.setTextAlignment(self.colIndex[nwOutline.PCOUNT], Qt.AlignRight)
currTitle = None
currChapter = None
@@ -3,4 +3,5 @@
@pov: Jane
@location: Earth
%synopsis: We can add a chapter file, but keep the scene files separate. In the chapter file we can set the meta data that applies to the whole chapter if we wish to.
%synopsis: We can add a chapter file, but keep the scene files separate. In the chapter file we can set the meta data that applies to the whole chapter if we wish to.
+2 -2
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="31" autoCount="5" timeStamp="2020-04-13 15:55:18">
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="38" autoCount="8" timeStamp="2020-04-13 16:55:55">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -71,7 +71,7 @@
<charCount>12</charCount>
<wordCount>3</wordCount>
<paraCount>0</paraCount>
<cursorPos>15</cursorPos>
<cursorPos>214</cursorPos>
</item>
<item handle="636b6aa9b697b" order="1" parent="e7ded148d6e4a">
<name>Making a Scene</name>