diff --git a/nw/core/options.py b/nw/core/options.py index a9a06e0d..3bdf88f3 100644 --- a/nw/core/options.py +++ b/nw/core/options.py @@ -45,7 +45,7 @@ class OptionState(): self.theState = {} self.validMap = { - "GuiSessionLog": { + "GuiWritingStats": { "winWidth", "winHeight", "widthCol0", diff --git a/nw/gui/__init__.py b/nw/gui/__init__.py index 3a57b557..6359a342 100644 --- a/nw/gui/__init__.py +++ b/nw/gui/__init__.py @@ -15,7 +15,7 @@ from nw.gui.preferences import GuiPreferences from nw.gui.projload import GuiProjectLoad from nw.gui.projsettings import GuiProjectSettings from nw.gui.projtree import GuiProjectTree -from nw.gui.sessionlog import GuiSessionLog +from nw.gui.writingstats import GuiWritingStats from nw.gui.statusbar import GuiMainStatus from nw.gui.theme import GuiIcons, GuiTheme @@ -36,7 +36,7 @@ __all__ = [ "GuiProjectLoad", "GuiProjectSettings", "GuiProjectTree", - "GuiSessionLog", + "GuiWritingStats", "GuiMainStatus", "GuiIcons", "GuiTheme", diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index 1f78212d..b6ce5275 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -207,12 +207,6 @@ class GuiMainMenu(QMenuBar): self.aBuildProject.triggered.connect(self.theParent.buildProjectDialog) self.projMenu.addAction(self.aBuildProject) - # Project > Session Log - self.aSessionLog = QAction("Session Log", self) - self.aSessionLog.setStatusTip("Show the session log") - self.aSessionLog.triggered.connect(self.theParent.showSessionLogDialog) - self.projMenu.addAction(self.aSessionLog) - # Project > Separator self.projMenu.addSeparator() @@ -759,6 +753,13 @@ class GuiMainMenu(QMenuBar): self.aBackupProject.triggered.connect(self._doBackup) self.toolsMenu.addAction(self.aBackupProject) + # Tools > Writing Stats + self.aWritingStats = QAction("Show Writing Statistics", self) + self.aWritingStats.setStatusTip("Show the writing statistics dialog") + self.aWritingStats.setShortcut("F6") + self.aWritingStats.triggered.connect(self.theParent.showWritingStatsDialog) + self.toolsMenu.addAction(self.aWritingStats) + # Tools > Settings self.aPreferences = QAction("Preferences", self) self.aPreferences.setStatusTip("Preferences") diff --git a/nw/gui/sessionlog.py b/nw/gui/writingstats.py similarity index 89% rename from nw/gui/sessionlog.py rename to nw/gui/writingstats.py index e00feb21..40df85c9 100644 --- a/nw/gui/sessionlog.py +++ b/nw/gui/writingstats.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -"""novelWriter GUI Session Log Viewer +"""novelWriter GUI Writing Statistics - novelWriter – GUI Session Log Viewer + novelWriter – GUI Writing Statistics ====================================== - Class holding the session log view window + Class showing the word count and session statistics File History: Created: 2019-10-20 [0.3] @@ -44,7 +44,7 @@ from nw.gui.custom import QSwitch logger = logging.getLogger(__name__) -class GuiSessionLog(QDialog): +class GuiWritingStats(QDialog): C_TIME = 0 C_LENGTH = 1 @@ -57,7 +57,7 @@ class GuiSessionLog(QDialog): def __init__(self, theParent, theProject): QDialog.__init__(self, theParent) - logger.debug("Initialising GuiSessionLog ...") + logger.debug("Initialising GuiWritingStats ...") self.mainConf = nw.CONFIG self.theParent = theParent @@ -70,23 +70,23 @@ class GuiSessionLog(QDialog): self.timeFilter = 0.0 self.wordOffset = 0 - self.setWindowTitle("Session Log") + self.setWindowTitle("Writing Statistics") self.setMinimumWidth(self.mainConf.pxInt(420)) self.setMinimumHeight(self.mainConf.pxInt(400)) self.resize( - self.mainConf.pxInt(self.optState.getInt("GuiSessionLog", "winWidth", 550)), - self.mainConf.pxInt(self.optState.getInt("GuiSessionLog", "winHeight", 500)) + self.mainConf.pxInt(self.optState.getInt("GuiWritingStats", "winWidth", 550)), + self.mainConf.pxInt(self.optState.getInt("GuiWritingStats", "winHeight", 500)) ) # List Box wCol0 = self.mainConf.pxInt( - self.optState.getInt("GuiSessionLog", "widthCol0", 180) + self.optState.getInt("GuiWritingStats", "widthCol0", 180) ) wCol1 = self.mainConf.pxInt( - self.optState.getInt("GuiSessionLog", "widthCol1", 80) + self.optState.getInt("GuiWritingStats", "widthCol1", 80) ) wCol2 = self.mainConf.pxInt( - self.optState.getInt("GuiSessionLog", "widthCol2", 80) + self.optState.getInt("GuiWritingStats", "widthCol2", 80) ) self.listBox = QTreeWidget() @@ -106,10 +106,10 @@ class GuiSessionLog(QDialog): sortValid = (Qt.AscendingOrder, Qt.DescendingOrder) sortCol = self.optState.validIntRange( - self.optState.getInt("GuiSessionLog", "sortCol", 0), 0, 2, 0 + self.optState.getInt("GuiWritingStats", "sortCol", 0), 0, 2, 0 ) sortOrder = self.optState.validIntTuple( - self.optState.getInt("GuiSessionLog", "sortOrder", Qt.DescendingOrder), + self.optState.getInt("GuiWritingStats", "sortOrder", Qt.DescendingOrder), sortValid, Qt.DescendingOrder ) self.listBox.sortByColumn(sortCol, sortOrder) @@ -167,31 +167,31 @@ class GuiSessionLog(QDialog): self.incNovel = QSwitch(width=2*sPx, height=sPx) self.incNovel.setChecked( - self.optState.getBool("GuiSessionLog", "incNovel", True) + self.optState.getBool("GuiWritingStats", "incNovel", True) ) self.incNovel.clicked.connect(self._updateListBox) self.incNotes = QSwitch(width=2*sPx, height=sPx) self.incNotes.setChecked( - self.optState.getBool("GuiSessionLog", "incNotes", True) + self.optState.getBool("GuiWritingStats", "incNotes", True) ) self.incNotes.clicked.connect(self._updateListBox) self.hideZeros = QSwitch(width=2*sPx, height=sPx) self.hideZeros.setChecked( - self.optState.getBool("GuiSessionLog", "hideZeros", True) + self.optState.getBool("GuiWritingStats", "hideZeros", True) ) self.hideZeros.clicked.connect(self._updateListBox) self.hideNegative = QSwitch(width=2*sPx, height=sPx) self.hideNegative.setChecked( - self.optState.getBool("GuiSessionLog", "hideNegative", False) + self.optState.getBool("GuiWritingStats", "hideNegative", False) ) self.hideNegative.clicked.connect(self._updateListBox) self.groupByDay = QSwitch(width=2*sPx, height=sPx) self.groupByDay.setChecked( - self.optState.getBool("GuiSessionLog", "groupByDay", False) + self.optState.getBool("GuiWritingStats", "groupByDay", False) ) self.groupByDay.clicked.connect(self._updateListBox) @@ -233,7 +233,7 @@ class GuiSessionLog(QDialog): self.setLayout(self.outerBox) - logger.debug("GuiSessionLog initialisation complete") + logger.debug("GuiWritingStats initialisation complete") qApp.processEvents() self._loadLogFile() @@ -263,18 +263,18 @@ class GuiSessionLog(QDialog): hideNegative = self.hideNegative.isChecked() groupByDay = self.groupByDay.isChecked() - self.optState.setValue("GuiSessionLog", "winWidth", winWidth) - self.optState.setValue("GuiSessionLog", "winHeight", winHeight) - self.optState.setValue("GuiSessionLog", "widthCol0", widthCol0) - self.optState.setValue("GuiSessionLog", "widthCol1", widthCol1) - self.optState.setValue("GuiSessionLog", "widthCol2", widthCol2) - self.optState.setValue("GuiSessionLog", "sortCol", sortCol) - self.optState.setValue("GuiSessionLog", "sortOrder", sortOrder) - self.optState.setValue("GuiSessionLog", "incNovel", incNovel) - self.optState.setValue("GuiSessionLog", "incNotes", incNotes) - self.optState.setValue("GuiSessionLog", "hideZeros", hideZeros) - self.optState.setValue("GuiSessionLog", "hideNegative", hideNegative) - self.optState.setValue("GuiSessionLog", "groupByDay", groupByDay) + self.optState.setValue("GuiWritingStats", "winWidth", winWidth) + self.optState.setValue("GuiWritingStats", "winHeight", winHeight) + self.optState.setValue("GuiWritingStats", "widthCol0", widthCol0) + self.optState.setValue("GuiWritingStats", "widthCol1", widthCol1) + self.optState.setValue("GuiWritingStats", "widthCol2", widthCol2) + self.optState.setValue("GuiWritingStats", "sortCol", sortCol) + self.optState.setValue("GuiWritingStats", "sortOrder", sortOrder) + self.optState.setValue("GuiWritingStats", "incNovel", incNovel) + self.optState.setValue("GuiWritingStats", "incNotes", incNotes) + self.optState.setValue("GuiWritingStats", "hideZeros", hideZeros) + self.optState.setValue("GuiWritingStats", "hideNegative", hideNegative) + self.optState.setValue("GuiWritingStats", "groupByDay", groupByDay) self.optState.saveSettings() self.close() @@ -553,4 +553,4 @@ class GuiSessionLog(QDialog): tS = tS - tM*60 - tH*3600 return "%02d:%02d:%02d" % (tH,tM,tS) -# END Class GuiSessionLog +# END Class GuiWritingStats diff --git a/nw/guimain.py b/nw/guimain.py index 5c0714d4..0e04a56d 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -43,7 +43,7 @@ from nw.gui import ( GuiBuildNovel, GuiDocEditor, GuiDocMerge, GuiDocSplit, GuiDocViewDetails, GuiDocViewer, GuiItemDetails, GuiItemEditor, GuiMainMenu, GuiMainStatus, GuiOutline, GuiOutlineDetails, GuiPreferences, GuiProjectLoad, GuiTheme, - GuiProjectSettings, GuiProjectTree, GuiSessionLog + GuiProjectSettings, GuiProjectTree, GuiWritingStats ) from nw.core import NWProject, NWDoc, NWIndex from nw.constants import nwFiles, nwItemType, nwAlert @@ -806,11 +806,11 @@ class GuiMain(QMainWindow): dlgExport.exec_() return True - def showSessionLogDialog(self): + def showWritingStatsDialog(self): """Open the session log dialog. """ if self.hasProject: - dlgTLine = GuiSessionLog(self, self.theProject) + dlgTLine = GuiWritingStats(self, self.theProject) dlgTLine.exec_() return True