Replaced checkboxes with switches
This commit is contained in:
@@ -54,6 +54,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
QTreeWidget.__init__(self, theParent)
|
QTreeWidget.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising GuiProjectTree ...")
|
logger.debug("Initialising GuiProjectTree ...")
|
||||||
|
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theTheme = theParent.theTheme
|
self.theTheme = theParent.theTheme
|
||||||
|
|||||||
+23
-10
@@ -34,11 +34,12 @@ from datetime import datetime
|
|||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtGui import QFont
|
from PyQt5.QtGui import QFont
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
qApp, QDialog, QHBoxLayout, QTreeWidget, QTreeWidgetItem, QDialogButtonBox,
|
qApp, QDialog, QTreeWidget, QTreeWidgetItem, QDialogButtonBox, QGridLayout,
|
||||||
QGridLayout, QLabel, QGroupBox, QCheckBox
|
QLabel, QGroupBox
|
||||||
)
|
)
|
||||||
|
|
||||||
from nw.constants import nwConst, nwFiles, nwAlert
|
from nw.constants import nwConst, nwFiles, nwAlert
|
||||||
|
from nw.gui.custom import QSwitch
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -62,14 +63,19 @@ class GuiSessionLog(QDialog):
|
|||||||
self.logData = []
|
self.logData = []
|
||||||
self.timeFilter = 0.0
|
self.timeFilter = 0.0
|
||||||
self.timeTotal = 0.0
|
self.timeTotal = 0.0
|
||||||
|
self.maxWords = 0
|
||||||
|
|
||||||
self.setWindowTitle("Session Log")
|
self.setWindowTitle("Session Log")
|
||||||
self.setMinimumWidth(self.mainConf.pxInt(420))
|
self.setMinimumWidth(self.mainConf.pxInt(420))
|
||||||
self.setMinimumHeight(self.mainConf.pxInt(400))
|
self.setMinimumHeight(self.mainConf.pxInt(400))
|
||||||
|
|
||||||
# List Box
|
# List Box
|
||||||
wCol0 = self.mainConf.pxInt(self.optState.getInt("GuiSessionLog", "widthCol0", 180))
|
wCol0 = self.mainConf.pxInt(
|
||||||
wCol1 = self.mainConf.pxInt(self.optState.getInt("GuiSessionLog", "widthCol1", 80))
|
self.optState.getInt("GuiSessionLog", "widthCol0", 180)
|
||||||
|
)
|
||||||
|
wCol1 = self.mainConf.pxInt(
|
||||||
|
self.optState.getInt("GuiSessionLog", "widthCol1", 80)
|
||||||
|
)
|
||||||
|
|
||||||
self.listBox = QTreeWidget()
|
self.listBox = QTreeWidget()
|
||||||
self.listBox.setHeaderLabels(["Session Start","Length","Words"])
|
self.listBox.setHeaderLabels(["Session Start","Length","Words"])
|
||||||
@@ -117,24 +123,30 @@ class GuiSessionLog(QDialog):
|
|||||||
self.infoForm.addWidget(self.labelFilter, 1, 1)
|
self.infoForm.addWidget(self.labelFilter, 1, 1)
|
||||||
|
|
||||||
# Filter Options
|
# Filter Options
|
||||||
|
sPx = self.theTheme.baseIconSize
|
||||||
|
|
||||||
self.filterBox = QGroupBox("Filters", self)
|
self.filterBox = QGroupBox("Filters", self)
|
||||||
self.filterForm = QGridLayout(self)
|
self.filterForm = QGridLayout(self)
|
||||||
self.filterBox.setLayout(self.filterForm)
|
self.filterBox.setLayout(self.filterForm)
|
||||||
|
|
||||||
self.hideZeros = QCheckBox("Hide zero word count", self)
|
self.labelZeros = QLabel("Hide zero word count")
|
||||||
|
self.hideZeros = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.hideZeros.setChecked(
|
self.hideZeros.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "hideZeros", True)
|
self.optState.getBool("GuiSessionLog", "hideZeros", True)
|
||||||
)
|
)
|
||||||
self.hideZeros.stateChanged.connect(self._doHideZeros)
|
self.hideZeros.toggled.connect(self._doHideZeros)
|
||||||
|
|
||||||
self.hideNegative = QCheckBox("Hide negative word count", self)
|
self.labelNegative = QLabel("Hide negative word count")
|
||||||
|
self.hideNegative = QSwitch(width=2*sPx, height=sPx)
|
||||||
self.hideNegative.setChecked(
|
self.hideNegative.setChecked(
|
||||||
self.optState.getBool("GuiSessionLog", "hideNegative", False)
|
self.optState.getBool("GuiSessionLog", "hideNegative", False)
|
||||||
)
|
)
|
||||||
self.hideNegative.stateChanged.connect(self._doHideNegative)
|
self.hideNegative.toggled.connect(self._doHideNegative)
|
||||||
|
|
||||||
self.filterForm.addWidget(self.hideZeros, 0, 0)
|
self.filterForm.addWidget(self.labelZeros, 0, 0)
|
||||||
self.filterForm.addWidget(self.hideNegative, 1, 0)
|
self.filterForm.addWidget(self.hideZeros, 0, 1)
|
||||||
|
self.filterForm.addWidget(self.labelNegative, 1, 0)
|
||||||
|
self.filterForm.addWidget(self.hideNegative, 1, 1)
|
||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
|
||||||
@@ -229,6 +241,7 @@ class GuiSessionLog(QDialog):
|
|||||||
self.timeTotal += sDiff
|
self.timeTotal += sDiff
|
||||||
|
|
||||||
self.logData.append((dStart, sDiff, nWords))
|
self.logData.append((dStart, sDiff, nWords))
|
||||||
|
self.maxWords = max(self.maxWords, nWords)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.theParent.makeAlert(
|
self.theParent.makeAlert(
|
||||||
|
|||||||
Reference in New Issue
Block a user