Added outline details panel, and removed project in constructor of GUI classes

This commit is contained in:
Veronica K. B. Olsen
2020-06-02 22:00:23 +02:00
parent 3a22863875
commit 8199c2f4e9
10 changed files with 107 additions and 47 deletions
+13 -13
View File
@@ -39,7 +39,7 @@ from nw.constants import nwKeyWords, nwLabels, nwOutline
logger = logging.getLogger(__name__)
class GuiProjectOutline(QTreeWidget):
class GuiOutline(QTreeWidget):
DEF_WIDTH = {
nwOutline.TITLE : 200,
@@ -79,17 +79,17 @@ class GuiProjectOutline(QTreeWidget):
nwOutline.SYNOP : False,
}
def __init__(self, theParent, theProject):
def __init__(self, theParent):
QTreeWidget.__init__(self, theParent)
logger.debug("Initialising ProjectOutline ...")
logger.debug("Initialising GuiOutline ...")
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.theProject = theParent.theProject
self.theTheme = theParent.theTheme
self.theIndex = theParent.theIndex
self.optState = theProject.optState
self.optState = theParent.theProject.optState
self.headerMenu = GuiOutlineHeaderMenu(self)
self.firstView = True
@@ -120,7 +120,7 @@ class GuiProjectOutline(QTreeWidget):
self.clearOutline()
self.headerMenu.setHiddenState(self.colHidden)
logger.debug("ProjectOutline initialisation complete")
logger.debug("GuiOutline initialisation complete")
return
@@ -233,7 +233,7 @@ class GuiProjectOutline(QTreeWidget):
# Load whatever we saved last time, regardless of wether it
# contains the correct names or number of columns. The names
# must be valid though.
tempOrder = self.optState.getValue("GuiProjectOutline", "headerOrder", [])
tempOrder = self.optState.getValue("GuiOutline", "headerOrder", [])
treeOrder = []
for hName in tempOrder:
try:
@@ -256,14 +256,14 @@ class GuiProjectOutline(QTreeWidget):
# We load whatever column widths and hidden states we find in
# the file, and leave the rest in their default state.
tmpWidth = self.optState.getValue("GuiProjectOutline", "columnWidth", {})
tmpWidth = self.optState.getValue("GuiOutline", "columnWidth", {})
for hName in tmpWidth:
try:
self.colWidth[nwOutline[hName]] = tmpWidth[hName]
except:
logger.warning("Ignored unknown outline column '%s'" % str(hName))
tmpHidden = self.optState.getValue("GuiProjectOutline", "columnHidden", {})
tmpHidden = self.optState.getValue("GuiOutline", "columnHidden", {})
for hName in tmpHidden:
try:
self.colHidden[nwOutline[hName]] = tmpHidden[hName]
@@ -304,9 +304,9 @@ class GuiProjectOutline(QTreeWidget):
if not logHidden and logWidth > 0:
colWidth[hName] = logWidth
self.optState.setValue("GuiProjectOutline", "headerOrder", treeOrder)
self.optState.setValue("GuiProjectOutline", "columnWidth", colWidth)
self.optState.setValue("GuiProjectOutline", "columnHidden", colHidden)
self.optState.setValue("GuiOutline", "headerOrder", treeOrder)
self.optState.setValue("GuiOutline", "columnWidth", colWidth)
self.optState.setValue("GuiOutline", "columnHidden", colHidden)
self.optState.saveSettings()
return
@@ -438,7 +438,7 @@ class GuiProjectOutline(QTreeWidget):
return newItem
# END Class GuiProjectOutline
# END Class GuiOutline
class GuiOutlineHeaderMenu(QMenu):