Make sure information is synced properly when item label is changed

This commit is contained in:
Veronica K. B. Olsen
2020-05-09 21:49:05 +02:00
parent 91dd15ab57
commit 1ad156054c
5 changed files with 24 additions and 5 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ class GuiItemEditor(QDialog):
def __init__(self, theParent, theProject, tHandle): def __init__(self, theParent, theProject, tHandle):
QDialog.__init__(self, theParent) QDialog.__init__(self, theParent)
logger.debug("Initialising ItemEditor ...") logger.debug("Initialising GuiItemEditor ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theProject = theProject self.theProject = theProject
@@ -141,7 +141,7 @@ class GuiItemEditor(QDialog):
self.editName.selectAll() self.editName.selectAll()
logger.debug("ItemEditor initialisation complete") logger.debug("GuiItemEditor initialisation complete")
return return
+8
View File
@@ -352,6 +352,14 @@ class GuiDocEditor(QTextEdit):
return return
def updateDocTitle(self, tHandle):
"""Called when an item label is changed to check if the document
title bar needs updating,
"""
if tHandle == self.theHandle:
self.docTitle.setTitleFromHandle(self.theHandle)
return
## ##
# Setters and Getters # Setters and Getters
## ##
+2 -2
View File
@@ -526,8 +526,8 @@ class GuiDocTree(QTreeWidget):
newItem.setText(self.C_HANDLE, tHandle) newItem.setText(self.C_HANDLE, tHandle)
# newItem.setForeground(self.C_COUNT,QColor(*self.theParent.theTheme.treeWCount)) # newItem.setForeground(self.C_COUNT,QColor(*self.theParent.theTheme.treeWCount))
newItem.setTextAlignment(self.C_COUNT,Qt.AlignRight) newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight)
newItem.setFont(self.C_FLAGS,self.fontFlags) newItem.setFont(self.C_FLAGS, self.fontFlags)
self.theMap[tHandle] = newItem self.theMap[tHandle] = newItem
if pHandle is None: if pHandle is None:
+8
View File
@@ -192,6 +192,14 @@ class GuiDocViewer(QTextBrowser):
return False return False
return True return True
def updateDocTitle(self, tHandle):
"""Called when an item label is changed to check if the document
title bar needs updating,
"""
if tHandle == self.theHandle:
self.docTitle.setTitleFromHandle(self.theHandle)
return
## ##
# Events # Events
## ##
+4 -1
View File
@@ -629,6 +629,9 @@ class GuiMain(QMainWindow):
dlgProj = GuiItemEditor(self, self.theProject, tHandle) dlgProj = GuiItemEditor(self, self.theProject, tHandle)
if dlgProj.exec_(): if dlgProj.exec_():
self.treeView.setTreeItemValues(tHandle) self.treeView.setTreeItemValues(tHandle)
self.treeMeta.updateViewBox(tHandle)
self.docEditor.updateDocTitle(tHandle)
self.docViewer.updateDocTitle(tHandle)
return return
@@ -1006,7 +1009,7 @@ class GuiMain(QMainWindow):
def _treeSingleClick(self): def _treeSingleClick(self):
sHandle = self.treeView.getSelectedHandle() sHandle = self.treeView.getSelectedHandle()
if sHandle is not None: if sHandle is not None:
self.treeMeta.buildViewBox(sHandle) self.treeMeta.updateViewBox(sHandle)
return return
def _treeDoubleClick(self, tItem, colNo): def _treeDoubleClick(self, tItem, colNo):