Link switches and their labels
This commit is contained in:
@@ -73,8 +73,9 @@ class GuiDocMerge(NDialog):
|
|||||||
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
|
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
|
||||||
|
|
||||||
# Merge Options
|
# Merge Options
|
||||||
self.trashLabel = QLabel(self.tr("Move merged items to Trash"), self)
|
|
||||||
self.trashSwitch = NSwitch(self, height=iPx)
|
self.trashSwitch = NSwitch(self, height=iPx)
|
||||||
|
self.trashLabel = QLabel(self.tr("Move merged items to Trash"), self)
|
||||||
|
self.trashLabel.setBuddy(self.trashSwitch)
|
||||||
|
|
||||||
self.optBox = QGridLayout()
|
self.optBox = QGridLayout()
|
||||||
self.optBox.addWidget(self.trashLabel, 0, 0)
|
self.optBox.addWidget(self.trashLabel, 0, 0)
|
||||||
|
|||||||
@@ -90,16 +90,19 @@ class GuiDocSplit(NDialog):
|
|||||||
self.splitLevel.currentIndexChanged.connect(self._reloadList)
|
self.splitLevel.currentIndexChanged.connect(self._reloadList)
|
||||||
|
|
||||||
# Split Options
|
# Split Options
|
||||||
self.folderLabel = QLabel(self.tr("Split into a new folder"), self)
|
|
||||||
self.folderSwitch = NSwitch(self, height=iPx)
|
self.folderSwitch = NSwitch(self, height=iPx)
|
||||||
self.folderSwitch.setChecked(intoFolder)
|
self.folderSwitch.setChecked(intoFolder)
|
||||||
|
self.folderLabel = QLabel(self.tr("Split into a new folder"), self)
|
||||||
|
self.folderLabel.setBuddy(self.folderSwitch)
|
||||||
|
|
||||||
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"), self)
|
|
||||||
self.hierarchySwitch = NSwitch(self, height=iPx)
|
self.hierarchySwitch = NSwitch(self, height=iPx)
|
||||||
self.hierarchySwitch.setChecked(docHierarchy)
|
self.hierarchySwitch.setChecked(docHierarchy)
|
||||||
|
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"), self)
|
||||||
|
self.hierarchyLabel.setBuddy(self.hierarchySwitch)
|
||||||
|
|
||||||
self.trashLabel = QLabel(self.tr("Move split document to Trash"), self)
|
|
||||||
self.trashSwitch = NSwitch(self, height=iPx)
|
self.trashSwitch = NSwitch(self, height=iPx)
|
||||||
|
self.trashLabel = QLabel(self.tr("Move split document to Trash"), self)
|
||||||
|
self.trashLabel.setBuddy(self.trashSwitch)
|
||||||
|
|
||||||
self.optBox = QGridLayout()
|
self.optBox = QGridLayout()
|
||||||
self.optBox.addWidget(self.folderLabel, 0, 0)
|
self.optBox.addWidget(self.folderLabel, 0, 0)
|
||||||
|
|||||||
@@ -43,11 +43,14 @@ class GuiEditLabel(NDialog):
|
|||||||
self.setWindowTitle(self.tr("Item Label"))
|
self.setWindowTitle(self.tr("Item Label"))
|
||||||
|
|
||||||
# Item Label
|
# Item Label
|
||||||
self.labelValue = QLineEdit(self)
|
self.edtValue = QLineEdit(self)
|
||||||
self.labelValue.setMinimumWidth(220)
|
self.edtValue.setMinimumWidth(220)
|
||||||
self.labelValue.setMaxLength(200)
|
self.edtValue.setMaxLength(200)
|
||||||
self.labelValue.setText(text)
|
self.edtValue.setText(text)
|
||||||
self.labelValue.selectAll()
|
self.edtValue.selectAll()
|
||||||
|
|
||||||
|
self.lblValue = QLabel(self.tr("Label"), self)
|
||||||
|
self.lblValue.setBuddy(self.lblValue)
|
||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
||||||
@@ -56,8 +59,8 @@ class GuiEditLabel(NDialog):
|
|||||||
|
|
||||||
# Assemble
|
# Assemble
|
||||||
self.innerBox = QHBoxLayout()
|
self.innerBox = QHBoxLayout()
|
||||||
self.innerBox.addWidget(QLabel(self.tr("Label"), self), 0)
|
self.innerBox.addWidget(self.lblValue, 0)
|
||||||
self.innerBox.addWidget(self.labelValue, 1)
|
self.innerBox.addWidget(self.edtValue, 1)
|
||||||
self.innerBox.setSpacing(12)
|
self.innerBox.setSpacing(12)
|
||||||
|
|
||||||
self.outerBox = QVBoxLayout()
|
self.outerBox = QVBoxLayout()
|
||||||
@@ -77,7 +80,7 @@ class GuiEditLabel(NDialog):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def itemLabel(self) -> str:
|
def itemLabel(self) -> str:
|
||||||
return self.labelValue.text()
|
return self.edtValue.text()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getLabel(cls, parent: QWidget, text: str) -> tuple[str, bool]:
|
def getLabel(cls, parent: QWidget, text: str) -> tuple[str, bool]:
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ class NSwitchBox(QScrollArea):
|
|||||||
switch.toggled.connect(lambda state: self._emitSwitchSignal(identifier, state))
|
switch.toggled.connect(lambda state: self._emitSwitchSignal(identifier, state))
|
||||||
self._content.addWidget(switch, self._index, 2, QtAlignRight)
|
self._content.addWidget(switch, self._index, 2, QtAlignRight)
|
||||||
|
|
||||||
|
label.setBuddy(switch)
|
||||||
self._widgets.append(switch)
|
self._widgets.append(switch)
|
||||||
self._bumpIndex()
|
self._bumpIndex()
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ class GuiLipsum(NDialog):
|
|||||||
self.paraCount.setMaximum(100)
|
self.paraCount.setMaximum(100)
|
||||||
self.paraCount.setValue(5)
|
self.paraCount.setValue(5)
|
||||||
|
|
||||||
self.randLabel = QLabel(self.tr("Randomise order"), self)
|
|
||||||
self.randSwitch = NSwitch(self)
|
self.randSwitch = NSwitch(self)
|
||||||
|
self.randLabel = QLabel(self.tr("Randomise order"), self)
|
||||||
|
self.randLabel.setBuddy(self.randSwitch)
|
||||||
|
|
||||||
self.formBox = QGridLayout()
|
self.formBox = QGridLayout()
|
||||||
self.formBox.addWidget(self.headLabel, 0, 0, 1, 2, QtAlignLeft)
|
self.formBox.addWidget(self.headLabel, 0, 0, 1, 2, QtAlignLeft)
|
||||||
|
|||||||
@@ -564,9 +564,10 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
self.fmtPart.setReadOnly(True)
|
self.fmtPart.setReadOnly(True)
|
||||||
self.btnPart = NIconToolButton(self, iSz, "edit", "green")
|
self.btnPart = NIconToolButton(self, iSz, "edit", "green")
|
||||||
self.btnPart.clicked.connect(qtLambda(self._editHeading, self.EDIT_TITLE))
|
self.btnPart.clicked.connect(qtLambda(self._editHeading, self.EDIT_TITLE))
|
||||||
|
self.swtPart = NSwitch(self, height=iPx)
|
||||||
self.hdePart = QLabel(trHide, self)
|
self.hdePart = QLabel(trHide, self)
|
||||||
self.hdePart.setIndent(6)
|
self.hdePart.setIndent(6)
|
||||||
self.swtPart = NSwitch(self, height=iPx)
|
self.hdePart.setBuddy(self.swtPart)
|
||||||
|
|
||||||
self.formatBox.addWidget(self.lblPart, 0, 0)
|
self.formatBox.addWidget(self.lblPart, 0, 0)
|
||||||
self.formatBox.addWidget(self.fmtPart, 0, 1)
|
self.formatBox.addWidget(self.fmtPart, 0, 1)
|
||||||
@@ -580,9 +581,10 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
self.fmtChapter.setReadOnly(True)
|
self.fmtChapter.setReadOnly(True)
|
||||||
self.btnChapter = NIconToolButton(self, iSz, "edit", "green")
|
self.btnChapter = NIconToolButton(self, iSz, "edit", "green")
|
||||||
self.btnChapter.clicked.connect(qtLambda(self._editHeading, self.EDIT_CHAPTER))
|
self.btnChapter.clicked.connect(qtLambda(self._editHeading, self.EDIT_CHAPTER))
|
||||||
|
self.swtChapter = NSwitch(self, height=iPx)
|
||||||
self.hdeChapter = QLabel(trHide, self)
|
self.hdeChapter = QLabel(trHide, self)
|
||||||
self.hdeChapter.setIndent(6)
|
self.hdeChapter.setIndent(6)
|
||||||
self.swtChapter = NSwitch(self, height=iPx)
|
self.hdeChapter.setBuddy(self.swtChapter)
|
||||||
|
|
||||||
self.formatBox.addWidget(self.lblChapter, 1, 0)
|
self.formatBox.addWidget(self.lblChapter, 1, 0)
|
||||||
self.formatBox.addWidget(self.fmtChapter, 1, 1)
|
self.formatBox.addWidget(self.fmtChapter, 1, 1)
|
||||||
@@ -596,9 +598,10 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
self.fmtUnnumbered.setReadOnly(True)
|
self.fmtUnnumbered.setReadOnly(True)
|
||||||
self.btnUnnumbered = NIconToolButton(self, iSz, "edit", "green")
|
self.btnUnnumbered = NIconToolButton(self, iSz, "edit", "green")
|
||||||
self.btnUnnumbered.clicked.connect(qtLambda(self._editHeading, self.EDIT_UNNUM))
|
self.btnUnnumbered.clicked.connect(qtLambda(self._editHeading, self.EDIT_UNNUM))
|
||||||
|
self.swtUnnumbered = NSwitch(self, height=iPx)
|
||||||
self.hdeUnnumbered = QLabel(trHide, self)
|
self.hdeUnnumbered = QLabel(trHide, self)
|
||||||
self.hdeUnnumbered.setIndent(6)
|
self.hdeUnnumbered.setIndent(6)
|
||||||
self.swtUnnumbered = NSwitch(self, height=iPx)
|
self.hdeUnnumbered.setBuddy(self.swtUnnumbered)
|
||||||
|
|
||||||
self.formatBox.addWidget(self.lblUnnumbered, 2, 0)
|
self.formatBox.addWidget(self.lblUnnumbered, 2, 0)
|
||||||
self.formatBox.addWidget(self.fmtUnnumbered, 2, 1)
|
self.formatBox.addWidget(self.fmtUnnumbered, 2, 1)
|
||||||
@@ -612,9 +615,10 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
self.fmtScene.setReadOnly(True)
|
self.fmtScene.setReadOnly(True)
|
||||||
self.btnScene = NIconToolButton(self, iSz, "edit", "green")
|
self.btnScene = NIconToolButton(self, iSz, "edit", "green")
|
||||||
self.btnScene.clicked.connect(qtLambda(self._editHeading, self.EDIT_SCENE))
|
self.btnScene.clicked.connect(qtLambda(self._editHeading, self.EDIT_SCENE))
|
||||||
|
self.swtScene = NSwitch(self, height=iPx)
|
||||||
self.hdeScene = QLabel(trHide, self)
|
self.hdeScene = QLabel(trHide, self)
|
||||||
self.hdeScene.setIndent(6)
|
self.hdeScene.setIndent(6)
|
||||||
self.swtScene = NSwitch(self, height=iPx)
|
self.hdeScene.setBuddy(self.swtScene)
|
||||||
|
|
||||||
self.formatBox.addWidget(self.lblScene, 3, 0)
|
self.formatBox.addWidget(self.lblScene, 3, 0)
|
||||||
self.formatBox.addWidget(self.fmtScene, 3, 1)
|
self.formatBox.addWidget(self.fmtScene, 3, 1)
|
||||||
@@ -628,9 +632,10 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
self.fmtAScene.setReadOnly(True)
|
self.fmtAScene.setReadOnly(True)
|
||||||
self.btnAScene = NIconToolButton(self, iSz, "edit", "green")
|
self.btnAScene = NIconToolButton(self, iSz, "edit", "green")
|
||||||
self.btnAScene.clicked.connect(qtLambda(self._editHeading, self.EDIT_HSCENE))
|
self.btnAScene.clicked.connect(qtLambda(self._editHeading, self.EDIT_HSCENE))
|
||||||
|
self.swtAScene = NSwitch(self, height=iPx)
|
||||||
self.hdeAScene = QLabel(trHide, self)
|
self.hdeAScene = QLabel(trHide, self)
|
||||||
self.hdeAScene.setIndent(6)
|
self.hdeAScene.setIndent(6)
|
||||||
self.swtAScene = NSwitch(self, height=iPx)
|
self.hdeAScene.setBuddy(self.swtAScene)
|
||||||
|
|
||||||
self.formatBox.addWidget(self.lblAScene, 4, 0)
|
self.formatBox.addWidget(self.lblAScene, 4, 0)
|
||||||
self.formatBox.addWidget(self.fmtAScene, 4, 1)
|
self.formatBox.addWidget(self.fmtAScene, 4, 1)
|
||||||
@@ -644,9 +649,10 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
self.fmtSection.setReadOnly(True)
|
self.fmtSection.setReadOnly(True)
|
||||||
self.btnSection = NIconToolButton(self, iSz, "edit", "green")
|
self.btnSection = NIconToolButton(self, iSz, "edit", "green")
|
||||||
self.btnSection.clicked.connect(qtLambda(self._editHeading, self.EDIT_SECTION))
|
self.btnSection.clicked.connect(qtLambda(self._editHeading, self.EDIT_SECTION))
|
||||||
|
self.swtSection = NSwitch(self, height=iPx)
|
||||||
self.hdeSection = QLabel(trHide, self)
|
self.hdeSection = QLabel(trHide, self)
|
||||||
self.hdeSection.setIndent(6)
|
self.hdeSection.setIndent(6)
|
||||||
self.swtSection = NSwitch(self, height=iPx)
|
self.hdeSection.setBuddy(self.swtSection)
|
||||||
|
|
||||||
self.formatBox.addWidget(self.lblSection, 5, 0)
|
self.formatBox.addWidget(self.lblSection, 5, 0)
|
||||||
self.formatBox.addWidget(self.fmtSection, 5, 1)
|
self.formatBox.addWidget(self.fmtSection, 5, 1)
|
||||||
@@ -704,44 +710,59 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
|
|
||||||
# Layout Matrix
|
# Layout Matrix
|
||||||
# =============
|
# =============
|
||||||
|
trCentre = self.tr("Centre")
|
||||||
|
trBreak = self.tr("Page Break")
|
||||||
|
|
||||||
self.layoutMatrix = QGridLayout()
|
self.layoutMatrix = QGridLayout()
|
||||||
self.layoutMatrix.setVerticalSpacing(12)
|
self.layoutMatrix.setVerticalSpacing(12)
|
||||||
self.layoutMatrix.setHorizontalSpacing(12)
|
self.layoutMatrix.setHorizontalSpacing(12)
|
||||||
|
|
||||||
self.layoutMatrix.addWidget(QLabel(self.tr("Centre"), self), 0, 1)
|
self.layoutMatrix.addWidget(QLabel(trCentre, self), 0, 1)
|
||||||
self.layoutMatrix.addWidget(QLabel(self.tr("Page Break"), self), 0, 2)
|
self.layoutMatrix.addWidget(QLabel(trBreak, self), 0, 2)
|
||||||
|
|
||||||
# Title Layout
|
# Title Layout
|
||||||
self.lblTitle = QLabel(self._build.getLabel("headings.styleTitle"), self)
|
trLabel = self._build.getLabel("headings.styleTitle")
|
||||||
|
self.lblTitle = QLabel(trLabel, self)
|
||||||
self.centerTitle = NSwitch(self, height=iPx)
|
self.centerTitle = NSwitch(self, height=iPx)
|
||||||
|
self.centerTitle.setAccessibleName(f"{trLabel}: {trCentre}")
|
||||||
self.breakTitle = NSwitch(self, height=iPx)
|
self.breakTitle = NSwitch(self, height=iPx)
|
||||||
|
self.breakTitle.setAccessibleName(f"{trLabel}: {trBreak}")
|
||||||
|
|
||||||
self.layoutMatrix.addWidget(self.lblTitle, 1, 0)
|
self.layoutMatrix.addWidget(self.lblTitle, 1, 0)
|
||||||
self.layoutMatrix.addWidget(self.centerTitle, 1, 1, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.centerTitle, 1, 1, QtAlignCenter)
|
||||||
self.layoutMatrix.addWidget(self.breakTitle, 1, 2, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.breakTitle, 1, 2, QtAlignCenter)
|
||||||
|
|
||||||
# Partition Layout
|
# Partition Layout
|
||||||
self.lblPart = QLabel(self._build.getLabel("headings.stylePart"), self)
|
trLabel = self._build.getLabel("headings.stylePart")
|
||||||
|
self.lblPart = QLabel(trLabel, self)
|
||||||
self.centerPart = NSwitch(self, height=iPx)
|
self.centerPart = NSwitch(self, height=iPx)
|
||||||
|
self.centerPart.setAccessibleName(f"{trLabel}: {trCentre}")
|
||||||
self.breakPart = NSwitch(self, height=iPx)
|
self.breakPart = NSwitch(self, height=iPx)
|
||||||
|
self.breakPart.setAccessibleName(f"{trLabel}: {trBreak}")
|
||||||
|
|
||||||
self.layoutMatrix.addWidget(self.lblPart, 2, 0)
|
self.layoutMatrix.addWidget(self.lblPart, 2, 0)
|
||||||
self.layoutMatrix.addWidget(self.centerPart, 2, 1, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.centerPart, 2, 1, QtAlignCenter)
|
||||||
self.layoutMatrix.addWidget(self.breakPart, 2, 2, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.breakPart, 2, 2, QtAlignCenter)
|
||||||
|
|
||||||
# Chapter Layout
|
# Chapter Layout
|
||||||
self.lblChapter = QLabel(self._build.getLabel("headings.styleChapter"), self)
|
trLabel = self._build.getLabel("headings.styleChapter")
|
||||||
|
self.lblChapter = QLabel(trLabel, self)
|
||||||
self.centerChapter = NSwitch(self, height=iPx)
|
self.centerChapter = NSwitch(self, height=iPx)
|
||||||
|
self.centerChapter.setAccessibleName(f"{trLabel}: {trCentre}")
|
||||||
self.breakChapter = NSwitch(self, height=iPx)
|
self.breakChapter = NSwitch(self, height=iPx)
|
||||||
|
self.breakChapter.setAccessibleName(f"{trLabel}: {trBreak}")
|
||||||
|
|
||||||
self.layoutMatrix.addWidget(self.lblChapter, 3, 0)
|
self.layoutMatrix.addWidget(self.lblChapter, 3, 0)
|
||||||
self.layoutMatrix.addWidget(self.centerChapter, 3, 1, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.centerChapter, 3, 1, QtAlignCenter)
|
||||||
self.layoutMatrix.addWidget(self.breakChapter, 3, 2, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.breakChapter, 3, 2, QtAlignCenter)
|
||||||
|
|
||||||
# Scene Layout
|
# Scene Layout
|
||||||
self.lblScene = QLabel(self._build.getLabel("headings.styleScene"), self)
|
trLabel = self._build.getLabel("headings.styleScene")
|
||||||
|
self.lblScene = QLabel(trLabel, self)
|
||||||
self.centerScene = NSwitch(self, height=iPx)
|
self.centerScene = NSwitch(self, height=iPx)
|
||||||
|
self.centerScene.setAccessibleName(f"{trLabel}: {trCentre}")
|
||||||
self.breakScene = NSwitch(self, height=iPx)
|
self.breakScene = NSwitch(self, height=iPx)
|
||||||
|
self.breakScene.setAccessibleName(f"{trLabel}: {trBreak}")
|
||||||
|
|
||||||
self.layoutMatrix.addWidget(self.lblScene, 4, 0)
|
self.layoutMatrix.addWidget(self.lblScene, 4, 0)
|
||||||
self.layoutMatrix.addWidget(self.centerScene, 4, 1, QtAlignCenter)
|
self.layoutMatrix.addWidget(self.centerScene, 4, 1, QtAlignCenter)
|
||||||
@@ -979,7 +1000,6 @@ class _FormattingTab(NScrollableForm):
|
|||||||
|
|
||||||
# Note Headings
|
# Note Headings
|
||||||
self.addNoteHead = NSwitch(self, height=iPx)
|
self.addNoteHead = NSwitch(self, height=iPx)
|
||||||
|
|
||||||
self.addRow(self._build.getLabel("text.addNoteHeadings"), self.addNoteHead)
|
self.addRow(self._build.getLabel("text.addNoteHeadings"), self.addNoteHead)
|
||||||
|
|
||||||
# Text Format
|
# Text Format
|
||||||
|
|||||||
@@ -356,16 +356,14 @@ class _ContentsPage(NFixedPage):
|
|||||||
countFrom = options.getInt("GuiNovelDetails", "countFrom", 1)
|
countFrom = options.getInt("GuiNovelDetails", "countFrom", 1)
|
||||||
clearDouble = options.getBool("GuiNovelDetails", "clearDouble", True)
|
clearDouble = options.getBool("GuiNovelDetails", "clearDouble", True)
|
||||||
|
|
||||||
self.wpLabel = QLabel(self.tr("Words per page"), self)
|
|
||||||
|
|
||||||
self.wpValue = QSpinBox(self)
|
self.wpValue = QSpinBox(self)
|
||||||
self.wpValue.setMinimum(10)
|
self.wpValue.setMinimum(10)
|
||||||
self.wpValue.setMaximum(1000)
|
self.wpValue.setMaximum(1000)
|
||||||
self.wpValue.setSingleStep(10)
|
self.wpValue.setSingleStep(10)
|
||||||
self.wpValue.setValue(wordsPerPage)
|
self.wpValue.setValue(wordsPerPage)
|
||||||
self.wpValue.valueChanged.connect(self._populateTree)
|
self.wpValue.valueChanged.connect(self._populateTree)
|
||||||
|
self.wpLabel = QLabel(self.tr("Words per page"), self)
|
||||||
self.poLabel = QLabel(self.tr("First page offset"), self)
|
self.wpLabel.setBuddy(self.wpValue)
|
||||||
|
|
||||||
self.poValue = QSpinBox(self)
|
self.poValue = QSpinBox(self)
|
||||||
self.poValue.setMinimum(1)
|
self.poValue.setMinimum(1)
|
||||||
@@ -373,12 +371,14 @@ class _ContentsPage(NFixedPage):
|
|||||||
self.poValue.setSingleStep(1)
|
self.poValue.setSingleStep(1)
|
||||||
self.poValue.setValue(countFrom)
|
self.poValue.setValue(countFrom)
|
||||||
self.poValue.valueChanged.connect(self._populateTree)
|
self.poValue.valueChanged.connect(self._populateTree)
|
||||||
|
self.poLabel = QLabel(self.tr("First page offset"), self)
|
||||||
self.dblLabel = QLabel(self.tr("Chapters on odd pages"), self)
|
self.poLabel.setBuddy(self.poValue)
|
||||||
|
|
||||||
self.dblValue = NSwitch(self, height=iPx)
|
self.dblValue = NSwitch(self, height=iPx)
|
||||||
self.dblValue.setChecked(clearDouble)
|
self.dblValue.setChecked(clearDouble)
|
||||||
self.dblValue.clicked.connect(self._populateTree)
|
self.dblValue.clicked.connect(self._populateTree)
|
||||||
|
self.dblLabel = QLabel(self.tr("Chapters on odd pages"), self)
|
||||||
|
self.dblLabel.setBuddy(self.dblValue)
|
||||||
|
|
||||||
self.optionsBox = QGridLayout()
|
self.optionsBox = QGridLayout()
|
||||||
self.optionsBox.addWidget(self.wpLabel, 0, 0)
|
self.optionsBox.addWidget(self.wpLabel, 0, 0)
|
||||||
|
|||||||
@@ -183,59 +183,82 @@ class GuiWritingStats(NToolDialog):
|
|||||||
# Filter Options
|
# Filter Options
|
||||||
iPx = SHARED.theme.baseIconHeight
|
iPx = SHARED.theme.baseIconHeight
|
||||||
|
|
||||||
self.filterBox = QGroupBox(self.tr("Filters"), self)
|
|
||||||
self.filterForm = QGridLayout(self)
|
self.filterForm = QGridLayout(self)
|
||||||
|
self.filterForm.setRowStretch(6, 1)
|
||||||
|
self.filterBox = QGroupBox(self.tr("Filters"), self)
|
||||||
self.filterBox.setLayout(self.filterForm)
|
self.filterBox.setLayout(self.filterForm)
|
||||||
|
|
||||||
self.incNovel = NSwitch(self, height=iPx)
|
# Include Novel Files
|
||||||
self.incNovel.setChecked(
|
self.swtIncNovel = NSwitch(self, height=iPx)
|
||||||
|
self.swtIncNovel.setChecked(
|
||||||
pOptions.getBool("GuiWritingStats", "incNovel", True)
|
pOptions.getBool("GuiWritingStats", "incNovel", True)
|
||||||
)
|
)
|
||||||
self.incNovel.clicked.connect(self._updateListBox)
|
self.swtIncNovel.clicked.connect(self._updateListBox)
|
||||||
|
self.lblIncNovel = QLabel(self.tr("Count novel files"), self)
|
||||||
|
self.lblIncNovel.setBuddy(self.swtIncNovel)
|
||||||
|
|
||||||
self.incNotes = NSwitch(self, height=iPx)
|
self.filterForm.addWidget(self.lblIncNovel, 0, 0)
|
||||||
self.incNotes.setChecked(
|
self.filterForm.addWidget(self.swtIncNovel, 0, 1)
|
||||||
|
|
||||||
|
# Include Note Files
|
||||||
|
self.swtIncNotes = NSwitch(self, height=iPx)
|
||||||
|
self.swtIncNotes.setChecked(
|
||||||
pOptions.getBool("GuiWritingStats", "incNotes", True)
|
pOptions.getBool("GuiWritingStats", "incNotes", True)
|
||||||
)
|
)
|
||||||
self.incNotes.clicked.connect(self._updateListBox)
|
self.swtIncNotes.clicked.connect(self._updateListBox)
|
||||||
|
self.lblIncNotes = QLabel(self.tr("Count note files"), self)
|
||||||
|
self.lblIncNotes.setBuddy(self.swtIncNotes)
|
||||||
|
|
||||||
self.hideZeros = NSwitch(self, height=iPx)
|
self.filterForm.addWidget(self.lblIncNotes, 1, 0)
|
||||||
self.hideZeros.setChecked(
|
self.filterForm.addWidget(self.swtIncNotes, 1, 1)
|
||||||
|
|
||||||
|
# Hide Zero Counts
|
||||||
|
self.swtHideZeros = NSwitch(self, height=iPx)
|
||||||
|
self.swtHideZeros.setChecked(
|
||||||
pOptions.getBool("GuiWritingStats", "hideZeros", True)
|
pOptions.getBool("GuiWritingStats", "hideZeros", True)
|
||||||
)
|
)
|
||||||
self.hideZeros.clicked.connect(self._updateListBox)
|
self.swtHideZeros.clicked.connect(self._updateListBox)
|
||||||
|
self.lblHideZeros = QLabel(self.tr("Hide zero word count"), self)
|
||||||
|
self.lblHideZeros.setBuddy(self.swtHideZeros)
|
||||||
|
|
||||||
self.hideNegative = NSwitch(self, height=iPx)
|
self.filterForm.addWidget(self.lblHideZeros, 2, 0)
|
||||||
self.hideNegative.setChecked(
|
self.filterForm.addWidget(self.swtHideZeros, 2, 1)
|
||||||
|
|
||||||
|
# Hide Negative Counts
|
||||||
|
self.swtHideNegative = NSwitch(self, height=iPx)
|
||||||
|
self.swtHideNegative.setChecked(
|
||||||
pOptions.getBool("GuiWritingStats", "hideNegative", False)
|
pOptions.getBool("GuiWritingStats", "hideNegative", False)
|
||||||
)
|
)
|
||||||
self.hideNegative.clicked.connect(self._updateListBox)
|
self.swtHideNegative.clicked.connect(self._updateListBox)
|
||||||
|
self.lblHideNegative = QLabel(self.tr("Hide negative word count"), self)
|
||||||
|
self.lblHideNegative.setBuddy(self.swtHideNegative)
|
||||||
|
|
||||||
self.groupByDay = NSwitch(self, height=iPx)
|
self.filterForm.addWidget(self.lblHideNegative, 3, 0)
|
||||||
self.groupByDay.setChecked(
|
self.filterForm.addWidget(self.swtHideNegative, 3, 1)
|
||||||
|
|
||||||
|
# Group Entries
|
||||||
|
self.swtGroupByDay = NSwitch(self, height=iPx)
|
||||||
|
self.swtGroupByDay.setChecked(
|
||||||
pOptions.getBool("GuiWritingStats", "groupByDay", False)
|
pOptions.getBool("GuiWritingStats", "groupByDay", False)
|
||||||
)
|
)
|
||||||
self.groupByDay.clicked.connect(self._updateListBox)
|
self.swtGroupByDay.clicked.connect(self._updateListBox)
|
||||||
|
self.lblGroupByDay = QLabel(self.tr("Group entries by day"), self)
|
||||||
|
self.lblGroupByDay.setBuddy(self.swtGroupByDay)
|
||||||
|
|
||||||
self.showIdleTime = NSwitch(self, height=iPx)
|
self.filterForm.addWidget(self.lblGroupByDay, 4, 0)
|
||||||
self.showIdleTime.setChecked(
|
self.filterForm.addWidget(self.swtGroupByDay, 4, 1)
|
||||||
|
|
||||||
|
# Show Idle
|
||||||
|
self.swtShowIdleTime = NSwitch(self, height=iPx)
|
||||||
|
self.swtShowIdleTime.setChecked(
|
||||||
pOptions.getBool("GuiWritingStats", "showIdleTime", False)
|
pOptions.getBool("GuiWritingStats", "showIdleTime", False)
|
||||||
)
|
)
|
||||||
self.showIdleTime.clicked.connect(self._updateListBox)
|
self.swtShowIdleTime.clicked.connect(self._updateListBox)
|
||||||
|
self.lblShowIdleTime = QLabel(self.tr("Show idle time"), self)
|
||||||
|
self.lblShowIdleTime.setBuddy(self.swtShowIdleTime)
|
||||||
|
|
||||||
self.filterForm.addWidget(QLabel(self.tr("Count novel files"), self), 0, 0)
|
self.filterForm.addWidget(self.lblShowIdleTime, 5, 0)
|
||||||
self.filterForm.addWidget(QLabel(self.tr("Count note files"), self), 1, 0)
|
self.filterForm.addWidget(self.swtShowIdleTime, 5, 1)
|
||||||
self.filterForm.addWidget(QLabel(self.tr("Hide zero word count"), self), 2, 0)
|
|
||||||
self.filterForm.addWidget(QLabel(self.tr("Hide negative word count"), self), 3, 0)
|
|
||||||
self.filterForm.addWidget(QLabel(self.tr("Group entries by day"), self), 4, 0)
|
|
||||||
self.filterForm.addWidget(QLabel(self.tr("Show idle time"), self), 5, 0)
|
|
||||||
self.filterForm.addWidget(self.incNovel, 0, 1)
|
|
||||||
self.filterForm.addWidget(self.incNotes, 1, 1)
|
|
||||||
self.filterForm.addWidget(self.hideZeros, 2, 1)
|
|
||||||
self.filterForm.addWidget(self.hideNegative, 3, 1)
|
|
||||||
self.filterForm.addWidget(self.groupByDay, 4, 1)
|
|
||||||
self.filterForm.addWidget(self.showIdleTime, 5, 1)
|
|
||||||
self.filterForm.setRowStretch(6, 1)
|
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
self.histMax = QSpinBox(self)
|
self.histMax = QSpinBox(self)
|
||||||
@@ -325,12 +348,12 @@ class GuiWritingStats(NToolDialog):
|
|||||||
|
|
||||||
sortCol = self.listBox.sortColumn()
|
sortCol = self.listBox.sortColumn()
|
||||||
sortOrder = header.sortIndicatorOrder() if header else 0
|
sortOrder = header.sortIndicatorOrder() if header else 0
|
||||||
incNovel = self.incNovel.isChecked()
|
incNovel = self.swtIncNovel.isChecked()
|
||||||
incNotes = self.incNotes.isChecked()
|
incNotes = self.swtIncNotes.isChecked()
|
||||||
hideZeros = self.hideZeros.isChecked()
|
hideZeros = self.swtHideZeros.isChecked()
|
||||||
hideNegative = self.hideNegative.isChecked()
|
hideNegative = self.swtHideNegative.isChecked()
|
||||||
groupByDay = self.groupByDay.isChecked()
|
groupByDay = self.swtGroupByDay.isChecked()
|
||||||
showIdleTime = self.showIdleTime.isChecked()
|
showIdleTime = self.swtShowIdleTime.isChecked()
|
||||||
histMax = self.histMax.value()
|
histMax = self.histMax.value()
|
||||||
|
|
||||||
logger.debug("Saving State: GuiWritingStats")
|
logger.debug("Saving State: GuiWritingStats")
|
||||||
@@ -487,11 +510,11 @@ class GuiWritingStats(NToolDialog):
|
|||||||
self.listBox.clear()
|
self.listBox.clear()
|
||||||
self.timeFilter = 0.0
|
self.timeFilter = 0.0
|
||||||
|
|
||||||
incNovel = self.incNovel.isChecked()
|
incNovel = self.swtIncNovel.isChecked()
|
||||||
incNotes = self.incNotes.isChecked()
|
incNotes = self.swtIncNotes.isChecked()
|
||||||
hideZeros = self.hideZeros.isChecked()
|
hideZeros = self.swtHideZeros.isChecked()
|
||||||
hideNegative = self.hideNegative.isChecked()
|
hideNegative = self.swtHideNegative.isChecked()
|
||||||
groupByDay = self.groupByDay.isChecked()
|
groupByDay = self.swtGroupByDay.isChecked()
|
||||||
histMax = self.histMax.value()
|
histMax = self.histMax.value()
|
||||||
|
|
||||||
# Group the data
|
# Group the data
|
||||||
@@ -563,7 +586,7 @@ class GuiWritingStats(NToolDialog):
|
|||||||
# Populate the list
|
# Populate the list
|
||||||
mTrans = Qt.TransformationMode.FastTransformation
|
mTrans = Qt.TransformationMode.FastTransformation
|
||||||
mAspect = Qt.AspectRatioMode.IgnoreAspectRatio
|
mAspect = Qt.AspectRatioMode.IgnoreAspectRatio
|
||||||
showIdleTime = self.showIdleTime.isChecked()
|
showIdleTime = self.swtShowIdleTime.isChecked()
|
||||||
for _, sStart, sDiff, nWords, _, _, sIdle in self.filterData:
|
for _, sStart, sDiff, nWords, _, _, sIdle in self.filterData:
|
||||||
|
|
||||||
if showIdleTime:
|
if showIdleTime:
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
assert item.text(sessLog.C_COUNT) == f"{200:n}"
|
assert item.text(sessLog.C_COUNT) == f"{200:n}"
|
||||||
|
|
||||||
# No Novel Files
|
# No Novel Files
|
||||||
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtIncNovel, QtMouseLeft)
|
||||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||||
|
|
||||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||||
@@ -329,8 +329,8 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# No Note Files
|
# No Note Files
|
||||||
qtbot.mouseClick(sessLog.incNovel, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtIncNovel, QtMouseLeft)
|
||||||
qtbot.mouseClick(sessLog.incNotes, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtIncNotes, QtMouseLeft)
|
||||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||||
|
|
||||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||||
@@ -398,8 +398,8 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# No Negative Entries
|
# No Negative Entries
|
||||||
qtbot.mouseClick(sessLog.incNotes, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtIncNotes, QtMouseLeft)
|
||||||
qtbot.mouseClick(sessLog.hideNegative, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtHideNegative, QtMouseLeft)
|
||||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||||
|
|
||||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||||
@@ -439,8 +439,8 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Un-hide Zero Entries
|
# Un-hide Zero Entries
|
||||||
qtbot.mouseClick(sessLog.hideNegative, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtHideNegative, QtMouseLeft)
|
||||||
qtbot.mouseClick(sessLog.hideZeros, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtHideZeros, QtMouseLeft)
|
||||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||||
|
|
||||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||||
@@ -526,14 +526,14 @@ def testToolWritingStats_Filters(qtbot, monkeypatch, nwGUI, projPath, tstPaths):
|
|||||||
assert item is not None
|
assert item is not None
|
||||||
assert item.text(sessLog.C_IDLE) == "4 %"
|
assert item.text(sessLog.C_IDLE) == "4 %"
|
||||||
|
|
||||||
qtbot.mouseClick(sessLog.showIdleTime, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtShowIdleTime, QtMouseLeft)
|
||||||
|
|
||||||
item = sessLog.listBox.topLevelItem(7)
|
item = sessLog.listBox.topLevelItem(7)
|
||||||
assert item is not None
|
assert item is not None
|
||||||
assert item.text(sessLog.C_IDLE) == "00:01:10"
|
assert item.text(sessLog.C_IDLE) == "00:01:10"
|
||||||
|
|
||||||
# Group by Day
|
# Group by Day
|
||||||
qtbot.mouseClick(sessLog.groupByDay, QtMouseLeft)
|
qtbot.mouseClick(sessLog.swtGroupByDay, QtMouseLeft)
|
||||||
assert sessLog._saveData(sessLog.FMT_JSON)
|
assert sessLog._saveData(sessLog.FMT_JSON)
|
||||||
|
|
||||||
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
jsonStats = tstPaths.tmpDir / "sessionStats.json"
|
||||||
|
|||||||
Reference in New Issue
Block a user