Project tree status and total word count changes (#882)

* Fix some inconsistencies in source file docstrings
* Remove the option to show status text in project tree
* Change how total word counts are calculated and propagated
* Fix tests and improve coverage
* Add setting in preferences
* Add missing word count timer to config file
This commit is contained in:
Veronica Berglyd Olsen
2021-09-10 00:38:45 +02:00
committed by GitHub
parent b9311e84ce
commit 3c8cb34b0a
19 changed files with 246 additions and 134 deletions
+14 -11
View File
@@ -4,7 +4,8 @@ novelWriter GUI Main Window Status Bar
GUI class for the main window status bar
File History:
Created: 2019-04-20 [0.0.1]
Created: 2019-04-20 [0.0.1] GuiMainStatus
Created: 2020-05-17 [0.5.1] StatusLED
This file is a part of novelWriter
Copyright 20182021, Veronica Berglyd Olsen
@@ -28,7 +29,7 @@ import novelwriter
from time import time
from PyQt5.QtCore import QLocale, pyqtSlot
from PyQt5.QtCore import pyqtSlot, QLocale
from PyQt5.QtGui import QColor, QPainter
from PyQt5.QtWidgets import qApp, QStatusBar, QLabel, QAbstractButton
@@ -125,7 +126,7 @@ class GuiMainStatus(QStatusBar):
"""
self.setRefTime(None)
self.setLanguage(None, "")
self.doUpdateProjectStats(0, 0)
self.setProjectStats(0, 0)
self.setProjectStatus(nwState.NONE)
self.setDocumentStatus(nwState.NONE)
self.updateTime()
@@ -176,6 +177,16 @@ class GuiMainStatus(QStatusBar):
return
def setProjectStats(self, pWC, sWC):
"""Update the current project statistics.
"""
self.statsText.setText(self.tr("Words: {0} ({1})").format(f"{pWC:n}", f"{sWC:+n}"))
if self.mainConf.incNotesWCount:
self.statsText.setToolTip(self.tr("Project word count (session change)"))
else:
self.statsText.setToolTip(self.tr("Novel word count (session change)"))
return
def updateTime(self, idleTime=0.0):
"""Update the session clock.
"""
@@ -211,14 +222,6 @@ 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.