Add a signal for updated word counts

This commit is contained in:
Veronica K. B. Olsen
2021-05-16 17:31:12 +02:00
parent 872b8e7902
commit 1a5076438d
5 changed files with 63 additions and 31 deletions
+9 -8
View File
@@ -125,7 +125,7 @@ class GuiMainStatus(QStatusBar):
"""
self.setRefTime(None)
self.setLanguage(None, "")
self.setStats(0, 0)
self.doUpdateProjectStats(0, 0)
self.setProjectStatus(nwState.NONE)
self.setDocumentStatus(nwState.NONE)
self.updateTime()
@@ -160,13 +160,6 @@ class GuiMainStatus(QStatusBar):
self.docIcon.setState(theState)
return
def setStats(self, pWC, sWC):
"""Set the current project statistics.
"""
self.statsText.setText(self.tr("Words: {0} ({1})").format(f"{pWC:n}", f"{sWC:+n}"))
self.statsText.setToolTip(self.tr("Project word count (session change)"))
return
def setUserIdle(self, userIdle):
"""Change the idle status icon.
"""
@@ -218,6 +211,14 @@ class GuiMainStatus(QStatusBar):
return
@pyqtSlot(int, int)
def doUpdateProjectStats(self, pWC, sWC):
"""Update the current project statistics.
"""
self.statsText.setText(self.tr("Words: {0} ({1})").format(f"{pWC:n}", f"{sWC:+n}"))
self.statsText.setToolTip(self.tr("Project word count (session change)"))
return
@pyqtSlot(bool)
def doUpdateProjectStatus(self, isChanged):
"""Slot for updating the project status.