From e2d553495998bb4ee0a388a9fe37a7c967ea6c6d Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 9 Jan 2021 20:21:32 +0100 Subject: [PATCH] Some minor code cleanup and redundant code removed --- nw/gui/statusbar.py | 24 +++++++----------------- nw/guimain.py | 2 +- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/nw/gui/statusbar.py b/nw/gui/statusbar.py index 8fceafa5..bbebb7cb 100644 --- a/nw/gui/statusbar.py +++ b/nw/gui/statusbar.py @@ -51,9 +51,6 @@ class GuiMainStatus(QStatusBar): self.theTheme = theParent.theTheme self.refTime = None - self.projWords = 0 - self.sessWords = 0 - colNone = QColor(*self.theTheme.statNone) colTrue = QColor(*self.theTheme.statUnsaved) colFalse = QColor(*self.theTheme.statSaved) @@ -182,26 +179,19 @@ class GuiMainStatus(QStatusBar): def setStats(self, pWC, sWC): """Set the current project statistics. """ - self.projWords = pWC - self.sessWords = sWC - self._updateStats() + self.statsText.setToolTip( + "Project word count (session change)" + ) + self.statsText.setText( + f"Words: {pWC:n} ({sWC:+n})" + ) + return ## # Internal Functions ## - def _updateStats(self): - """Update statistics. - """ - self.statsText.setToolTip( - "Project word count (session change)" - ) - self.statsText.setText( - f"Words: {self.projWords:n} ({self.sessWords:+n})" - ) - return - def _updateTime(self): """Update the session clock. """ diff --git a/nw/guimain.py b/nw/guimain.py index b9816c42..cc8f61bd 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -467,7 +467,7 @@ class GuiMain(QMainWindow): return False self.treeView.saveTreeOrder() - self.theProject.saveProject(autoSave) + self.theProject.saveProject(autoSave=autoSave) self.theIndex.saveIndex() return True