Improve itemEditor test, and refactor actions

This commit is contained in:
Veronica K. B. Olsen
2020-10-01 20:34:48 +02:00
parent 0179965a8d
commit 26ebcd496d
13 changed files with 91 additions and 40 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ class GuiDocMerge(QDialog):
theDoc.openDocument(nHandle, False)
theDoc.saveDocument(theText)
self.theParent.treeView.revealTreeItem(nHandle)
self.theParent.treeView.revealNewTreeItem(nHandle)
self.theParent.openDocument(nHandle, doScroll=True)
self._doClose()
+2 -2
View File
@@ -178,7 +178,7 @@ class GuiDocSplit(QDialog):
fHandle = self.theProject.newFolder(
srcItem.itemName, srcItem.itemClass, srcItem.parHandle
)
self.theParent.treeView.revealTreeItem(fHandle)
self.theParent.treeView.revealNewTreeItem(fHandle)
logger.verbose("Creating folder %s" % fHandle)
# Loop through, and create the files
@@ -213,7 +213,7 @@ class GuiDocSplit(QDialog):
theDoc.openDocument(nHandle, False)
theDoc.saveDocument(theText)
theDoc.clearDocument()
self.theParent.treeView.revealTreeItem(nHandle)
self.theParent.treeView.revealNewTreeItem(nHandle)
self._doClose()
+2 -2
View File
@@ -240,12 +240,12 @@ class GuiProjectTree(QTreeWidget):
# Add the new item to the tree
if tHandle is not None:
self.revealTreeItem(tHandle, nHandle)
self.revealNewTreeItem(tHandle, nHandle)
self.theParent.editItem(tHandle)
return True
def revealTreeItem(self, tHandle, nHandle=None):
def revealNewTreeItem(self, tHandle, nHandle=None):
"""Reveal a newly added project item in the project tree.
"""
nwItem = self.theProject.projTree[tHandle]
+7 -8
View File
@@ -659,14 +659,13 @@ class GuiMain(QMainWindow):
return
logger.verbose("Requesting change to item %s" % tHandle)
if self.mainConf.showGUI:
dlgProj = GuiItemEditor(self, self.theProject, tHandle)
dlgProj.exec_()
if dlgProj.result() == QDialog.Accepted:
self.treeView.setTreeItemValues(tHandle)
self.treeMeta.updateViewBox(tHandle)
self.docEditor.updateDocInfo(tHandle)
self.docViewer.updateDocInfo(tHandle)
dlgProj = GuiItemEditor(self, self.theProject, tHandle)
dlgProj.exec_()
if dlgProj.result() == QDialog.Accepted:
self.treeView.setTreeItemValues(tHandle)
self.treeMeta.updateViewBox(tHandle)
self.docEditor.updateDocInfo(tHandle)
self.docViewer.updateDocInfo(tHandle)
return