Renamed Session Log to Writing Statistics
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ class OptionState():
|
|||||||
|
|
||||||
self.theState = {}
|
self.theState = {}
|
||||||
self.validMap = {
|
self.validMap = {
|
||||||
"GuiSessionLog": {
|
"GuiWritingStats": {
|
||||||
"winWidth",
|
"winWidth",
|
||||||
"winHeight",
|
"winHeight",
|
||||||
"widthCol0",
|
"widthCol0",
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ from nw.gui.preferences import GuiPreferences
|
|||||||
from nw.gui.projload import GuiProjectLoad
|
from nw.gui.projload import GuiProjectLoad
|
||||||
from nw.gui.projsettings import GuiProjectSettings
|
from nw.gui.projsettings import GuiProjectSettings
|
||||||
from nw.gui.projtree import GuiProjectTree
|
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.statusbar import GuiMainStatus
|
||||||
from nw.gui.theme import GuiIcons, GuiTheme
|
from nw.gui.theme import GuiIcons, GuiTheme
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ __all__ = [
|
|||||||
"GuiProjectLoad",
|
"GuiProjectLoad",
|
||||||
"GuiProjectSettings",
|
"GuiProjectSettings",
|
||||||
"GuiProjectTree",
|
"GuiProjectTree",
|
||||||
"GuiSessionLog",
|
"GuiWritingStats",
|
||||||
"GuiMainStatus",
|
"GuiMainStatus",
|
||||||
"GuiIcons",
|
"GuiIcons",
|
||||||
"GuiTheme",
|
"GuiTheme",
|
||||||
|
|||||||
+7
-6
@@ -207,12 +207,6 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.aBuildProject.triggered.connect(self.theParent.buildProjectDialog)
|
self.aBuildProject.triggered.connect(self.theParent.buildProjectDialog)
|
||||||
self.projMenu.addAction(self.aBuildProject)
|
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
|
# Project > Separator
|
||||||
self.projMenu.addSeparator()
|
self.projMenu.addSeparator()
|
||||||
|
|
||||||
@@ -759,6 +753,13 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.aBackupProject.triggered.connect(self._doBackup)
|
self.aBackupProject.triggered.connect(self._doBackup)
|
||||||
self.toolsMenu.addAction(self.aBackupProject)
|
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
|
# Tools > Settings
|
||||||
self.aPreferences = QAction("Preferences", self)
|
self.aPreferences = QAction("Preferences", self)
|
||||||
self.aPreferences.setStatusTip("Preferences")
|
self.aPreferences.setStatusTip("Preferences")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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:
|
File History:
|
||||||
Created: 2019-10-20 [0.3]
|
Created: 2019-10-20 [0.3]
|
||||||
@@ -44,7 +44,7 @@ from nw.gui.custom import QSwitch
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GuiSessionLog(QDialog):
|
class GuiWritingStats(QDialog):
|
||||||
|
|
||||||
C_TIME = 0
|
C_TIME = 0
|
||||||
C_LENGTH = 1
|
C_LENGTH = 1
|
||||||
@@ -57,7 +57,7 @@ class GuiSessionLog(QDialog):
|
|||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent, theProject):
|
||||||
QDialog.__init__(self, theParent)
|
QDialog.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising GuiSessionLog ...")
|
logger.debug("Initialising GuiWritingStats ...")
|
||||||
|
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
@@ -70,23 +70,23 @@ class GuiSessionLog(QDialog):
|
|||||||
self.timeFilter = 0.0
|
self.timeFilter = 0.0
|
||||||
self.wordOffset = 0
|
self.wordOffset = 0
|
||||||
|
|
||||||
self.setWindowTitle("Session Log")
|
self.setWindowTitle("Writing Statistics")
|
||||||
self.setMinimumWidth(self.mainConf.pxInt(420))
|
self.setMinimumWidth(self.mainConf.pxInt(420))
|
||||||
self.setMinimumHeight(self.mainConf.pxInt(400))
|
self.setMinimumHeight(self.mainConf.pxInt(400))
|
||||||
self.resize(
|
self.resize(
|
||||||
self.mainConf.pxInt(self.optState.getInt("GuiSessionLog", "winWidth", 550)),
|
self.mainConf.pxInt(self.optState.getInt("GuiWritingStats", "winWidth", 550)),
|
||||||
self.mainConf.pxInt(self.optState.getInt("GuiSessionLog", "winHeight", 500))
|
self.mainConf.pxInt(self.optState.getInt("GuiWritingStats", "winHeight", 500))
|
||||||
)
|
)
|
||||||
|
|
||||||
# List Box
|
# List Box
|
||||||
wCol0 = self.mainConf.pxInt(
|
wCol0 = self.mainConf.pxInt(
|
||||||
self.optState.getInt("GuiSessionLog", "widthCol0", 180)
|
self.optState.getInt("GuiWritingStats", "widthCol0", 180)
|
||||||
)
|
)
|
||||||
wCol1 = self.mainConf.pxInt(
|
wCol1 = self.mainConf.pxInt(
|
||||||
self.optState.getInt("GuiSessionLog", "widthCol1", 80)
|
self.optState.getInt("GuiWritingStats", "widthCol1", 80)
|
||||||
)
|
)
|
||||||
wCol2 = self.mainConf.pxInt(
|
wCol2 = self.mainConf.pxInt(
|
||||||
self.optState.getInt("GuiSessionLog", "widthCol2", 80)
|
self.optState.getInt("GuiWritingStats", "widthCol2", 80)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.listBox = QTreeWidget()
|
self.listBox = QTreeWidget()
|
||||||
@@ -106,10 +106,10 @@ class GuiSessionLog(QDialog):
|
|||||||
|
|
||||||
sortValid = (Qt.AscendingOrder, Qt.DescendingOrder)
|
sortValid = (Qt.AscendingOrder, Qt.DescendingOrder)
|
||||||
sortCol = self.optState.validIntRange(
|
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(
|
sortOrder = self.optState.validIntTuple(
|
||||||
self.optState.getInt("GuiSessionLog", "sortOrder", Qt.DescendingOrder),
|
self.optState.getInt("GuiWritingStats", "sortOrder", Qt.DescendingOrder),
|
||||||
sortValid, Qt.DescendingOrder
|
sortValid, Qt.DescendingOrder
|
||||||
)
|
)
|
||||||
self.listBox.sortByColumn(sortCol, sortOrder)
|
self.listBox.sortByColumn(sortCol, sortOrder)
|
||||||
@@ -167,31 +167,31 @@ class GuiSessionLog(QDialog):
|
|||||||
|
|
||||||
self.incNovel = QSwitch(width=2*sPx, height=sPx)
|
self.incNovel = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.incNovel.setChecked(
|
self.incNovel.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "incNovel", True)
|
self.optState.getBool("GuiWritingStats", "incNovel", True)
|
||||||
)
|
)
|
||||||
self.incNovel.clicked.connect(self._updateListBox)
|
self.incNovel.clicked.connect(self._updateListBox)
|
||||||
|
|
||||||
self.incNotes = QSwitch(width=2*sPx, height=sPx)
|
self.incNotes = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.incNotes.setChecked(
|
self.incNotes.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "incNotes", True)
|
self.optState.getBool("GuiWritingStats", "incNotes", True)
|
||||||
)
|
)
|
||||||
self.incNotes.clicked.connect(self._updateListBox)
|
self.incNotes.clicked.connect(self._updateListBox)
|
||||||
|
|
||||||
self.hideZeros = QSwitch(width=2*sPx, height=sPx)
|
self.hideZeros = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.hideZeros.setChecked(
|
self.hideZeros.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "hideZeros", True)
|
self.optState.getBool("GuiWritingStats", "hideZeros", True)
|
||||||
)
|
)
|
||||||
self.hideZeros.clicked.connect(self._updateListBox)
|
self.hideZeros.clicked.connect(self._updateListBox)
|
||||||
|
|
||||||
self.hideNegative = QSwitch(width=2*sPx, height=sPx)
|
self.hideNegative = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.hideNegative.setChecked(
|
self.hideNegative.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "hideNegative", False)
|
self.optState.getBool("GuiWritingStats", "hideNegative", False)
|
||||||
)
|
)
|
||||||
self.hideNegative.clicked.connect(self._updateListBox)
|
self.hideNegative.clicked.connect(self._updateListBox)
|
||||||
|
|
||||||
self.groupByDay = QSwitch(width=2*sPx, height=sPx)
|
self.groupByDay = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.groupByDay.setChecked(
|
self.groupByDay.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "groupByDay", False)
|
self.optState.getBool("GuiWritingStats", "groupByDay", False)
|
||||||
)
|
)
|
||||||
self.groupByDay.clicked.connect(self._updateListBox)
|
self.groupByDay.clicked.connect(self._updateListBox)
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ class GuiSessionLog(QDialog):
|
|||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
logger.debug("GuiSessionLog initialisation complete")
|
logger.debug("GuiWritingStats initialisation complete")
|
||||||
|
|
||||||
qApp.processEvents()
|
qApp.processEvents()
|
||||||
self._loadLogFile()
|
self._loadLogFile()
|
||||||
@@ -263,18 +263,18 @@ class GuiSessionLog(QDialog):
|
|||||||
hideNegative = self.hideNegative.isChecked()
|
hideNegative = self.hideNegative.isChecked()
|
||||||
groupByDay = self.groupByDay.isChecked()
|
groupByDay = self.groupByDay.isChecked()
|
||||||
|
|
||||||
self.optState.setValue("GuiSessionLog", "winWidth", winWidth)
|
self.optState.setValue("GuiWritingStats", "winWidth", winWidth)
|
||||||
self.optState.setValue("GuiSessionLog", "winHeight", winHeight)
|
self.optState.setValue("GuiWritingStats", "winHeight", winHeight)
|
||||||
self.optState.setValue("GuiSessionLog", "widthCol0", widthCol0)
|
self.optState.setValue("GuiWritingStats", "widthCol0", widthCol0)
|
||||||
self.optState.setValue("GuiSessionLog", "widthCol1", widthCol1)
|
self.optState.setValue("GuiWritingStats", "widthCol1", widthCol1)
|
||||||
self.optState.setValue("GuiSessionLog", "widthCol2", widthCol2)
|
self.optState.setValue("GuiWritingStats", "widthCol2", widthCol2)
|
||||||
self.optState.setValue("GuiSessionLog", "sortCol", sortCol)
|
self.optState.setValue("GuiWritingStats", "sortCol", sortCol)
|
||||||
self.optState.setValue("GuiSessionLog", "sortOrder", sortOrder)
|
self.optState.setValue("GuiWritingStats", "sortOrder", sortOrder)
|
||||||
self.optState.setValue("GuiSessionLog", "incNovel", incNovel)
|
self.optState.setValue("GuiWritingStats", "incNovel", incNovel)
|
||||||
self.optState.setValue("GuiSessionLog", "incNotes", incNotes)
|
self.optState.setValue("GuiWritingStats", "incNotes", incNotes)
|
||||||
self.optState.setValue("GuiSessionLog", "hideZeros", hideZeros)
|
self.optState.setValue("GuiWritingStats", "hideZeros", hideZeros)
|
||||||
self.optState.setValue("GuiSessionLog", "hideNegative", hideNegative)
|
self.optState.setValue("GuiWritingStats", "hideNegative", hideNegative)
|
||||||
self.optState.setValue("GuiSessionLog", "groupByDay", groupByDay)
|
self.optState.setValue("GuiWritingStats", "groupByDay", groupByDay)
|
||||||
|
|
||||||
self.optState.saveSettings()
|
self.optState.saveSettings()
|
||||||
self.close()
|
self.close()
|
||||||
@@ -553,4 +553,4 @@ class GuiSessionLog(QDialog):
|
|||||||
tS = tS - tM*60 - tH*3600
|
tS = tS - tM*60 - tH*3600
|
||||||
return "%02d:%02d:%02d" % (tH,tM,tS)
|
return "%02d:%02d:%02d" % (tH,tM,tS)
|
||||||
|
|
||||||
# END Class GuiSessionLog
|
# END Class GuiWritingStats
|
||||||
+3
-3
@@ -43,7 +43,7 @@ from nw.gui import (
|
|||||||
GuiBuildNovel, GuiDocEditor, GuiDocMerge, GuiDocSplit, GuiDocViewDetails,
|
GuiBuildNovel, GuiDocEditor, GuiDocMerge, GuiDocSplit, GuiDocViewDetails,
|
||||||
GuiDocViewer, GuiItemDetails, GuiItemEditor, GuiMainMenu, GuiMainStatus,
|
GuiDocViewer, GuiItemDetails, GuiItemEditor, GuiMainMenu, GuiMainStatus,
|
||||||
GuiOutline, GuiOutlineDetails, GuiPreferences, GuiProjectLoad, GuiTheme,
|
GuiOutline, GuiOutlineDetails, GuiPreferences, GuiProjectLoad, GuiTheme,
|
||||||
GuiProjectSettings, GuiProjectTree, GuiSessionLog
|
GuiProjectSettings, GuiProjectTree, GuiWritingStats
|
||||||
)
|
)
|
||||||
from nw.core import NWProject, NWDoc, NWIndex
|
from nw.core import NWProject, NWDoc, NWIndex
|
||||||
from nw.constants import nwFiles, nwItemType, nwAlert
|
from nw.constants import nwFiles, nwItemType, nwAlert
|
||||||
@@ -806,11 +806,11 @@ class GuiMain(QMainWindow):
|
|||||||
dlgExport.exec_()
|
dlgExport.exec_()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def showSessionLogDialog(self):
|
def showWritingStatsDialog(self):
|
||||||
"""Open the session log dialog.
|
"""Open the session log dialog.
|
||||||
"""
|
"""
|
||||||
if self.hasProject:
|
if self.hasProject:
|
||||||
dlgTLine = GuiSessionLog(self, self.theProject)
|
dlgTLine = GuiWritingStats(self, self.theProject)
|
||||||
dlgTLine.exec_()
|
dlgTLine.exec_()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user