Document tree is now refreshed when status colours change
This commit is contained in:
+3
-5
@@ -229,7 +229,7 @@ class GuiDocTree(QTreeWidget):
|
|||||||
trItemP.takeChild(tIndex)
|
trItemP.takeChild(tIndex)
|
||||||
self.clearSelection()
|
self.clearSelection()
|
||||||
trItemP.setSelected(True)
|
trItemP.setSelected(True)
|
||||||
self.theProject.setProjectChanged(True)
|
self.theProject.deleteItem(tHandle)
|
||||||
else:
|
else:
|
||||||
self.makeAlert(["Cannot delete folder.","It is not empty."], nwAlert.ERROR)
|
self.makeAlert(["Cannot delete folder.","It is not empty."], nwAlert.ERROR)
|
||||||
return
|
return
|
||||||
@@ -261,12 +261,10 @@ class GuiDocTree(QTreeWidget):
|
|||||||
tStatus += "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
|
tStatus += "."+nwLabels.LAYOUT_FLAG[nwItem.itemLayout]
|
||||||
iStatus = nwItem.itemStatus
|
iStatus = nwItem.itemStatus
|
||||||
if tClass == nwItemClass.NOVEL:
|
if tClass == nwItemClass.NOVEL:
|
||||||
if iStatus is None:
|
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's a valid index
|
||||||
iStatus = self.theProject.statusItems.checkEntry(iStatus)
|
|
||||||
flagIcon = self.theParent.statusIcons[iStatus]
|
flagIcon = self.theParent.statusIcons[iStatus]
|
||||||
else:
|
else:
|
||||||
if iStatus is None:
|
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's a valid index
|
||||||
iStatus = self.theProject.importItems.checkEntry(iStatus)
|
|
||||||
flagIcon = self.theParent.importIcons[iStatus]
|
flagIcon = self.theParent.importIcons[iStatus]
|
||||||
|
|
||||||
trItem.setText(self.C_NAME, tName)
|
trItem.setText(self.C_NAME, tName)
|
||||||
|
|||||||
@@ -82,10 +82,14 @@ class GuiProjectEditor(QDialog):
|
|||||||
self.theProject.setBookTitle(bookTitle)
|
self.theProject.setBookTitle(bookTitle)
|
||||||
self.theProject.setBookAuthors(bookAuthors)
|
self.theProject.setBookAuthors(bookAuthors)
|
||||||
|
|
||||||
statusCol = self.tabStatus.getNewList()
|
if self.tabStatus.colChanged:
|
||||||
importCol = self.tabImport.getNewList()
|
statusCol = self.tabStatus.getNewList()
|
||||||
self.theProject.setStatusColours(statusCol)
|
self.theProject.setStatusColours(statusCol)
|
||||||
self.theProject.setImportColours(importCol)
|
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()
|
self.close()
|
||||||
|
|
||||||
|
|||||||
+8
-4
@@ -184,12 +184,9 @@ class GuiMain(QMainWindow):
|
|||||||
projFile = self.openProjectDialog()
|
projFile = self.openProjectDialog()
|
||||||
if projFile is None:
|
if projFile is None:
|
||||||
return False
|
return False
|
||||||
self.treeView.clearTree()
|
|
||||||
self.theProject.openProject(projFile)
|
self.theProject.openProject(projFile)
|
||||||
self.treeView.buildTree()
|
|
||||||
self._setWindowTitle(self.theProject.projName)
|
self._setWindowTitle(self.theProject.projName)
|
||||||
self._makeStatusIcons()
|
self.rebuildTree()
|
||||||
self._makeImportIcons()
|
|
||||||
self.docEditor.setPwl(path.join(self.theProject.projMeta,"wordlist.txt"))
|
self.docEditor.setPwl(path.join(self.theProject.projMeta,"wordlist.txt"))
|
||||||
self.docEditor.setSpellCheck(self.theProject.spellCheck)
|
self.docEditor.setSpellCheck(self.theProject.spellCheck)
|
||||||
self.mainMenu.updateMenu()
|
self.mainMenu.updateMenu()
|
||||||
@@ -300,6 +297,13 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def rebuildTree(self):
|
||||||
|
self._makeStatusIcons()
|
||||||
|
self._makeImportIcons()
|
||||||
|
self.treeView.clearTree()
|
||||||
|
self.treeView.buildTree()
|
||||||
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Main Dialogs
|
# Main Dialogs
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -430,6 +430,13 @@ class NWProject():
|
|||||||
# Class Methods
|
# 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):
|
def findRootItem(self, theClass):
|
||||||
for aRoot in self.treeRoots:
|
for aRoot in self.treeRoots:
|
||||||
if theClass == self.projTree[aRoot].itemClass:
|
if theClass == self.projTree[aRoot].itemClass:
|
||||||
|
|||||||
Reference in New Issue
Block a user