From dece58faf6a63726d4423bc9f69b4d14e2786d85 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 14 Jan 2021 18:35:53 +0100 Subject: [PATCH] Backport from 1.1: clear project tree meta panel on close --- nw/gui/itemdetails.py | 28 +++++++++++++++++----------- nw/guimain.py | 7 +++++++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/nw/gui/itemdetails.py b/nw/gui/itemdetails.py index cbb006df..1a48e9cb 100644 --- a/nw/gui/itemdetails.py +++ b/nw/gui/itemdetails.py @@ -190,6 +190,22 @@ class GuiItemDetails(QWidget): # Class Methods ## + def clearDetails(self): + """Clear all the data values. + """ + self.labelFlag.setPixmap(QPixmap(1, 1)) + self.labelData.setText("") + self.statusFlag.setPixmap(QPixmap(1, 1)) + self.statusData.setText("") + self.classFlag.setText("") + self.classData.setText("") + self.layoutFlag.setText("") + self.layoutData.setText("") + self.cCountData.setText("–") + self.wCountData.setText("–") + self.pCountData.setText("–") + return + def updateCounts(self, tHandle, cC, wC, pC): """Just update the counts if the handle is the same as the one we're already showing. @@ -207,17 +223,7 @@ class GuiItemDetails(QWidget): nwItem = self.theProject.projTree[tHandle] if nwItem is None: - self.labelFlag.setText("") - self.labelData.setText("") - self.statusFlag.setText("") - self.statusData.setText("") - self.classFlag.setText("") - self.classData.setText("") - self.layoutFlag.setText("") - self.layoutData.setText("") - self.cCountData.setText("–") - self.wCountData.setText("–") - self.pCountData.setText("–") + self.clearDetails() else: theLabel = nwItem.itemName diff --git a/nw/guimain.py b/nw/guimain.py index cc8f61bd..70879986 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -252,10 +252,17 @@ class GuiMain(QMainWindow): def clearGUI(self): """Wrapper function to clear all sub-elements of the main GUI. """ + # Project Area self.treeView.clearTree() + self.treeMeta.clearDetails() + + # Work Area self.docEditor.clearEditor() self.closeDocViewer() + + # General self.statusBar.clearStatus() + return True def initMain(self):