Document tree is now refreshed when status colours change

This commit is contained in:
Veronica K. B. Olsen
2019-05-19 22:20:54 +02:00
parent edb6c41788
commit fdd9c58235
4 changed files with 26 additions and 13 deletions
+3 -5
View File
@@ -229,7 +229,7 @@ class GuiDocTree(QTreeWidget):
trItemP.takeChild(tIndex)
self.clearSelection()
trItemP.setSelected(True)
self.theProject.setProjectChanged(True)
self.theProject.deleteItem(tHandle)
else:
self.makeAlert(["Cannot delete folder.","It is not empty."], nwAlert.ERROR)
return
@@ -261,12 +261,10 @@ class GuiDocTree(QTreeWidget):
tStatus += "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
iStatus = nwItem.itemStatus
if tClass == nwItemClass.NOVEL:
if iStatus is None:
iStatus = self.theProject.statusItems.checkEntry(iStatus)
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's a valid index
flagIcon = self.theParent.statusIcons[iStatus]
else:
if iStatus is None:
iStatus = self.theProject.importItems.checkEntry(iStatus)
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's a valid index
flagIcon = self.theParent.importIcons[iStatus]
trItem.setText(self.C_NAME, tName)
+8 -4
View File
@@ -82,10 +82,14 @@ class GuiProjectEditor(QDialog):
self.theProject.setBookTitle(bookTitle)
self.theProject.setBookAuthors(bookAuthors)
statusCol = self.tabStatus.getNewList()
importCol = self.tabImport.getNewList()
self.theProject.setStatusColours(statusCol)
self.theProject.setImportColours(importCol)
if self.tabStatus.colChanged:
statusCol = self.tabStatus.getNewList()
self.theProject.setStatusColours(statusCol)
if self.tabImport.colChanged:
importCol = self.tabImport.getNewList()
self.theProject.setImportColours(importCol)
if self.tabStatus.colChanged or self.tabImport.colChanged:
self.theParent.rebuildTree()
self.close()
+8 -4
View File
@@ -184,12 +184,9 @@ class GuiMain(QMainWindow):
projFile = self.openProjectDialog()
if projFile is None:
return False
self.treeView.clearTree()
self.theProject.openProject(projFile)
self.treeView.buildTree()
self._setWindowTitle(self.theProject.projName)
self._makeStatusIcons()
self._makeImportIcons()
self.rebuildTree()
self.docEditor.setPwl(path.join(self.theProject.projMeta,"wordlist.txt"))
self.docEditor.setSpellCheck(self.theProject.spellCheck)
self.mainMenu.updateMenu()
@@ -300,6 +297,13 @@ class GuiMain(QMainWindow):
return
def rebuildTree(self):
self._makeStatusIcons()
self._makeImportIcons()
self.treeView.clearTree()
self.treeView.buildTree()
return
##
# Main Dialogs
##
+7
View File
@@ -430,6 +430,13 @@ class NWProject():
# Class Methods
##
def deleteItem(self, tHandle):
"""This only removed the item from the order list, but not from the project tree.
"""
self.treeOrder.remove(tHandle)
self.setProjectChanged(True)
return True
def findRootItem(self, theClass):
for aRoot in self.treeRoots:
if theClass == self.projTree[aRoot].itemClass: