novelWriter 2.4b1__py3-none-any.whl → 2.4rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {novelWriter-2.4b1.dist-info → novelWriter-2.4rc1.dist-info}/METADATA +5 -6
- {novelWriter-2.4b1.dist-info → novelWriter-2.4rc1.dist-info}/RECORD +62 -66
- novelwriter/__init__.py +5 -5
- novelwriter/assets/icons/none.svg +4 -0
- novelwriter/assets/icons/typicons_dark/icons.conf +2 -2
- novelwriter/assets/icons/typicons_dark/typ_unfold-hidden.svg +4 -0
- novelwriter/assets/icons/typicons_dark/typ_unfold-visible.svg +4 -0
- novelwriter/assets/icons/typicons_light/icons.conf +2 -2
- novelwriter/assets/icons/typicons_light/typ_unfold-hidden.svg +4 -0
- novelwriter/assets/icons/typicons_light/typ_unfold-visible.svg +4 -0
- novelwriter/assets/manual.pdf +0 -0
- novelwriter/assets/sample.zip +0 -0
- novelwriter/common.py +6 -1
- novelwriter/config.py +8 -4
- novelwriter/core/coretools.py +21 -22
- novelwriter/core/status.py +3 -2
- novelwriter/core/toodt.py +332 -355
- novelwriter/dialogs/about.py +9 -11
- novelwriter/dialogs/docmerge.py +17 -14
- novelwriter/dialogs/docsplit.py +14 -12
- novelwriter/dialogs/editlabel.py +5 -4
- novelwriter/dialogs/preferences.py +28 -33
- novelwriter/dialogs/projectsettings.py +29 -26
- novelwriter/dialogs/quotes.py +10 -9
- novelwriter/dialogs/wordlist.py +15 -12
- novelwriter/error.py +13 -11
- novelwriter/extensions/circularprogress.py +12 -8
- novelwriter/extensions/configlayout.py +1 -3
- novelwriter/extensions/modified.py +33 -2
- novelwriter/extensions/pagedsidebar.py +16 -14
- novelwriter/extensions/simpleprogress.py +3 -1
- novelwriter/extensions/statusled.py +3 -1
- novelwriter/extensions/switch.py +10 -9
- novelwriter/extensions/switchbox.py +14 -13
- novelwriter/gui/doceditor.py +182 -225
- novelwriter/gui/dochighlight.py +4 -4
- novelwriter/gui/docviewer.py +53 -57
- novelwriter/gui/docviewerpanel.py +16 -13
- novelwriter/gui/editordocument.py +4 -4
- novelwriter/gui/itemdetails.py +45 -48
- novelwriter/gui/noveltree.py +22 -20
- novelwriter/gui/outline.py +87 -88
- novelwriter/gui/projtree.py +31 -29
- novelwriter/gui/search.py +75 -29
- novelwriter/gui/sidebar.py +24 -28
- novelwriter/gui/statusbar.py +14 -14
- novelwriter/gui/theme.py +47 -35
- novelwriter/guimain.py +35 -31
- novelwriter/shared.py +5 -5
- novelwriter/tools/dictionaries.py +13 -12
- novelwriter/tools/lipsum.py +20 -17
- novelwriter/tools/manusbuild.py +35 -27
- novelwriter/tools/manuscript.py +68 -73
- novelwriter/tools/manussettings.py +68 -73
- novelwriter/tools/noveldetails.py +20 -18
- novelwriter/tools/welcome.py +47 -43
- novelwriter/tools/writingstats.py +61 -55
- novelwriter/types.py +90 -0
- novelwriter/assets/icons/typicons_dark/typ_arrow-down.svg +0 -4
- novelwriter/assets/icons/typicons_dark/typ_arrow-right.svg +0 -4
- novelwriter/assets/icons/typicons_light/typ_arrow-down.svg +0 -4
- novelwriter/assets/icons/typicons_light/typ_arrow-right.svg +0 -4
- novelwriter/core/__init__.py +0 -3
- novelwriter/dialogs/__init__.py +0 -3
- novelwriter/extensions/__init__.py +0 -3
- novelwriter/gui/__init__.py +0 -3
- novelwriter/text/__init__.py +0 -3
- novelwriter/tools/__init__.py +0 -3
- {novelWriter-2.4b1.dist-info → novelWriter-2.4rc1.dist-info}/LICENSE.md +0 -0
- {novelWriter-2.4b1.dist-info → novelWriter-2.4rc1.dist-info}/WHEEL +0 -0
- {novelWriter-2.4b1.dist-info → novelWriter-2.4rc1.dist-info}/entry_points.txt +0 -0
- {novelWriter-2.4b1.dist-info → novelWriter-2.4rc1.dist-info}/top_level.txt +0 -0
@@ -28,24 +28,28 @@ import logging
|
|
28
28
|
from typing import TYPE_CHECKING
|
29
29
|
|
30
30
|
from PyQt5.QtGui import QFont, QIcon, QSyntaxHighlighter, QTextCharFormat, QTextDocument
|
31
|
-
from PyQt5.QtCore import QEvent,
|
31
|
+
from PyQt5.QtCore import QEvent, Qt, pyqtSignal, pyqtSlot
|
32
32
|
from PyQt5.QtWidgets import (
|
33
33
|
QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox,
|
34
34
|
QFontDialog, QFrame, QGridLayout, QHBoxLayout, QHeaderView, QLabel,
|
35
35
|
QLineEdit, QMenu, QPlainTextEdit, QPushButton, QSplitter, QStackedWidget,
|
36
|
-
|
36
|
+
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
37
37
|
)
|
38
38
|
|
39
39
|
from novelwriter import CONFIG, SHARED
|
40
40
|
from novelwriter.constants import nwHeadFmt, nwKeyWords, nwLabels, trConst
|
41
41
|
from novelwriter.core.buildsettings import BuildSettings, FilterMode
|
42
|
-
from novelwriter.extensions.switch import NSwitch
|
43
|
-
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
|
44
|
-
from novelwriter.extensions.switchbox import NSwitchBox
|
45
42
|
from novelwriter.extensions.configlayout import (
|
46
43
|
NColourLabel, NFixedPage, NScrollableForm, NScrollablePage
|
47
44
|
)
|
45
|
+
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NIconToolButton, NSpinBox
|
48
46
|
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
47
|
+
from novelwriter.extensions.switch import NSwitch
|
48
|
+
from novelwriter.extensions.switchbox import NSwitchBox
|
49
|
+
from novelwriter.types import (
|
50
|
+
QtAlignLeft, QtDialogApply, QtDialogClose, QtDialogSave, QtRoleAccept,
|
51
|
+
QtRoleApply, QtRoleReject, QtUserRole
|
52
|
+
)
|
49
53
|
|
50
54
|
if TYPE_CHECKING: # pragma: no cover
|
51
55
|
from novelwriter.guimain import GuiMain
|
@@ -98,7 +102,7 @@ class GuiBuildSettings(QDialog):
|
|
98
102
|
)
|
99
103
|
|
100
104
|
# Settings Name
|
101
|
-
self.lblBuildName = QLabel(self.tr("Name"))
|
105
|
+
self.lblBuildName = QLabel(self.tr("Name"), self)
|
102
106
|
self.editBuildName = QLineEdit(self)
|
103
107
|
|
104
108
|
# SideBar
|
@@ -130,11 +134,7 @@ class GuiBuildSettings(QDialog):
|
|
130
134
|
self.toolStack.addWidget(self.optTabOutput)
|
131
135
|
|
132
136
|
# Buttons
|
133
|
-
self.buttonBox = QDialogButtonBox(
|
134
|
-
QDialogButtonBox.StandardButton.Apply
|
135
|
-
| QDialogButtonBox.StandardButton.Save
|
136
|
-
| QDialogButtonBox.StandardButton.Close
|
137
|
-
)
|
137
|
+
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose, self)
|
138
138
|
self.buttonBox.clicked.connect(self._dialogButtonClicked)
|
139
139
|
|
140
140
|
# Assemble
|
@@ -225,12 +225,12 @@ class GuiBuildSettings(QDialog):
|
|
225
225
|
def _dialogButtonClicked(self, button: QAbstractButton) -> None:
|
226
226
|
"""Handle button clicks from the dialog button box."""
|
227
227
|
role = self.buttonBox.buttonRole(button)
|
228
|
-
if role ==
|
228
|
+
if role == QtRoleApply:
|
229
229
|
self._emitBuildData()
|
230
|
-
elif role ==
|
230
|
+
elif role == QtRoleAccept:
|
231
231
|
self._emitBuildData()
|
232
232
|
self.close()
|
233
|
-
elif role ==
|
233
|
+
elif role == QtRoleReject:
|
234
234
|
self.close()
|
235
235
|
return
|
236
236
|
|
@@ -288,8 +288,8 @@ class _FilterTab(NFixedPage):
|
|
288
288
|
C_ACTIVE = 1
|
289
289
|
C_STATUS = 2
|
290
290
|
|
291
|
-
D_HANDLE =
|
292
|
-
D_FILE =
|
291
|
+
D_HANDLE = QtUserRole
|
292
|
+
D_FILE = QtUserRole + 1
|
293
293
|
|
294
294
|
F_NONE = 0
|
295
295
|
F_FILTERED = 1
|
@@ -315,13 +315,13 @@ class _FilterTab(NFixedPage):
|
|
315
315
|
# Project Tree
|
316
316
|
# ============
|
317
317
|
|
318
|
-
|
319
|
-
iPx = SHARED.theme.
|
318
|
+
iSz = SHARED.theme.baseIconSize
|
319
|
+
iPx = SHARED.theme.baseIconHeight
|
320
320
|
cMg = CONFIG.pxInt(6)
|
321
321
|
|
322
322
|
# Tree Widget
|
323
323
|
self.optTree = QTreeWidget(self)
|
324
|
-
self.optTree.setIconSize(
|
324
|
+
self.optTree.setIconSize(iSz)
|
325
325
|
self.optTree.setUniformRowHeights(True)
|
326
326
|
self.optTree.setAllColumnsShowFocus(True)
|
327
327
|
self.optTree.setHeaderHidden(True)
|
@@ -331,36 +331,35 @@ class _FilterTab(NFixedPage):
|
|
331
331
|
treeHeader = self.optTree.header()
|
332
332
|
treeHeader.setStretchLastSection(False)
|
333
333
|
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1551
|
334
|
-
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.Stretch)
|
335
|
-
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.Fixed)
|
336
|
-
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.Fixed)
|
334
|
+
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.ResizeMode.Stretch)
|
335
|
+
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.ResizeMode.Fixed)
|
336
|
+
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.ResizeMode.Fixed)
|
337
337
|
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
|
338
338
|
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
|
339
339
|
|
340
|
-
self.optTree.setDragDropMode(QAbstractItemView.NoDragDrop)
|
341
|
-
self.optTree.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
342
|
-
self.optTree.setSelectionBehavior(QAbstractItemView.SelectRows)
|
340
|
+
self.optTree.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
|
341
|
+
self.optTree.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
342
|
+
self.optTree.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
343
343
|
|
344
344
|
# Filters
|
345
345
|
# =======
|
346
346
|
|
347
|
-
self.includedButton =
|
347
|
+
self.includedButton = NIconToolButton(self, iSz)
|
348
348
|
self.includedButton.setToolTip(self.tr("Always included"))
|
349
349
|
self.includedButton.setIcon(self._statusFlags[self.F_INCLUDED])
|
350
350
|
self.includedButton.clicked.connect(lambda: self._setSelectedMode(self.F_INCLUDED))
|
351
351
|
|
352
|
-
self.excludedButton =
|
352
|
+
self.excludedButton = NIconToolButton(self, iSz)
|
353
353
|
self.excludedButton.setToolTip(self.tr("Always excluded"))
|
354
354
|
self.excludedButton.setIcon(self._statusFlags[self.F_EXCLUDED])
|
355
355
|
self.excludedButton.clicked.connect(lambda: self._setSelectedMode(self.F_EXCLUDED))
|
356
356
|
|
357
|
-
self.resetButton =
|
357
|
+
self.resetButton = NIconToolButton(self, iSz, "revert")
|
358
358
|
self.resetButton.setToolTip(self.tr("Reset to default"))
|
359
|
-
self.resetButton.setIcon(SHARED.theme.getIcon("revert"))
|
360
359
|
self.resetButton.clicked.connect(lambda: self._setSelectedMode(self.F_FILTERED))
|
361
360
|
|
362
361
|
self.modeBox = QHBoxLayout()
|
363
|
-
self.modeBox.addWidget(QLabel(self.tr("Mark selection as")))
|
362
|
+
self.modeBox.addWidget(QLabel(self.tr("Mark selection as"), self))
|
364
363
|
self.modeBox.addStretch(1)
|
365
364
|
self.modeBox.addWidget(self.includedButton)
|
366
365
|
self.modeBox.addWidget(self.excludedButton)
|
@@ -370,7 +369,7 @@ class _FilterTab(NFixedPage):
|
|
370
369
|
# Filer Options
|
371
370
|
self.filterOpt = NSwitchBox(self, iPx)
|
372
371
|
self.filterOpt.switchToggled.connect(self._applyFilterSwitch)
|
373
|
-
self.filterOpt.setFrameStyle(QFrame.NoFrame)
|
372
|
+
self.filterOpt.setFrameStyle(QFrame.Shape.NoFrame)
|
374
373
|
|
375
374
|
# Assemble GUI
|
376
375
|
# ============
|
@@ -382,10 +381,10 @@ class _FilterTab(NFixedPage):
|
|
382
381
|
self.selectionBox.addLayout(self.modeBox)
|
383
382
|
self.selectionBox.setContentsMargins(0, 0, 0, 0)
|
384
383
|
|
385
|
-
self.selectionWidget = QWidget()
|
384
|
+
self.selectionWidget = QWidget(self)
|
386
385
|
self.selectionWidget.setLayout(self.selectionBox)
|
387
386
|
|
388
|
-
self.mainSplit = QSplitter()
|
387
|
+
self.mainSplit = QSplitter(self)
|
389
388
|
self.mainSplit.addWidget(self.selectionWidget)
|
390
389
|
self.mainSplit.addWidget(self.filterOpt)
|
391
390
|
self.mainSplit.setCollapsible(0, False)
|
@@ -469,7 +468,7 @@ class _FilterTab(NFixedPage):
|
|
469
468
|
trItem.setData(self.C_DATA, self.D_FILE, isFile)
|
470
469
|
trItem.setIcon(self.C_ACTIVE, SHARED.theme.getIcon(iconName))
|
471
470
|
|
472
|
-
trItem.setTextAlignment(self.C_NAME,
|
471
|
+
trItem.setTextAlignment(self.C_NAME, QtAlignLeft)
|
473
472
|
|
474
473
|
if pHandle is None and nwItem.isRootType():
|
475
474
|
self.optTree.addTopLevelItem(trItem)
|
@@ -593,10 +592,12 @@ class _HeadingsTab(NScrollablePage):
|
|
593
592
|
self._build = build
|
594
593
|
self._editing = 0
|
595
594
|
|
596
|
-
iPx = SHARED.theme.
|
595
|
+
iPx = SHARED.theme.baseIconHeight
|
596
|
+
iSz = SHARED.theme.baseIconSize
|
597
597
|
sSp = CONFIG.pxInt(16)
|
598
598
|
vSp = CONFIG.pxInt(12)
|
599
599
|
bSp = CONFIG.pxInt(6)
|
600
|
+
trHide = self.tr("Hide")
|
600
601
|
|
601
602
|
# Format Boxes
|
602
603
|
# ============
|
@@ -607,10 +608,9 @@ class _HeadingsTab(NScrollablePage):
|
|
607
608
|
self.lblTitle = QLabel(self._build.getLabel("headings.fmtTitle"), self)
|
608
609
|
self.fmtTitle = QLineEdit("", self)
|
609
610
|
self.fmtTitle.setReadOnly(True)
|
610
|
-
self.btnTitle =
|
611
|
-
self.btnTitle.setIcon(SHARED.theme.getIcon("edit"))
|
611
|
+
self.btnTitle = NIconToolButton(self, iSz, "edit")
|
612
612
|
self.btnTitle.clicked.connect(lambda: self._editHeading(self.EDIT_TITLE))
|
613
|
-
self.hdeTitle = QLabel(
|
613
|
+
self.hdeTitle = QLabel(trHide, self)
|
614
614
|
self.hdeTitle.setIndent(bSp)
|
615
615
|
self.swtTitle = NSwitch(self, height=iPx)
|
616
616
|
|
@@ -624,10 +624,9 @@ class _HeadingsTab(NScrollablePage):
|
|
624
624
|
self.lblChapter = QLabel(self._build.getLabel("headings.fmtChapter"), self)
|
625
625
|
self.fmtChapter = QLineEdit("", self)
|
626
626
|
self.fmtChapter.setReadOnly(True)
|
627
|
-
self.btnChapter =
|
628
|
-
self.btnChapter.setIcon(SHARED.theme.getIcon("edit"))
|
627
|
+
self.btnChapter = NIconToolButton(self, iSz, "edit")
|
629
628
|
self.btnChapter.clicked.connect(lambda: self._editHeading(self.EDIT_CHAPTER))
|
630
|
-
self.hdeChapter = QLabel(
|
629
|
+
self.hdeChapter = QLabel(trHide, self)
|
631
630
|
self.hdeChapter.setIndent(bSp)
|
632
631
|
self.swtChapter = NSwitch(self, height=iPx)
|
633
632
|
|
@@ -641,10 +640,9 @@ class _HeadingsTab(NScrollablePage):
|
|
641
640
|
self.lblUnnumbered = QLabel(self._build.getLabel("headings.fmtUnnumbered"), self)
|
642
641
|
self.fmtUnnumbered = QLineEdit("", self)
|
643
642
|
self.fmtUnnumbered.setReadOnly(True)
|
644
|
-
self.btnUnnumbered =
|
645
|
-
self.btnUnnumbered.setIcon(SHARED.theme.getIcon("edit"))
|
643
|
+
self.btnUnnumbered = NIconToolButton(self, iSz, "edit")
|
646
644
|
self.btnUnnumbered.clicked.connect(lambda: self._editHeading(self.EDIT_UNNUM))
|
647
|
-
self.hdeUnnumbered = QLabel(
|
645
|
+
self.hdeUnnumbered = QLabel(trHide, self)
|
648
646
|
self.hdeUnnumbered.setIndent(bSp)
|
649
647
|
self.swtUnnumbered = NSwitch(self, height=iPx)
|
650
648
|
|
@@ -658,10 +656,9 @@ class _HeadingsTab(NScrollablePage):
|
|
658
656
|
self.lblScene = QLabel(self._build.getLabel("headings.fmtScene"), self)
|
659
657
|
self.fmtScene = QLineEdit("", self)
|
660
658
|
self.fmtScene.setReadOnly(True)
|
661
|
-
self.btnScene =
|
662
|
-
self.btnScene.setIcon(SHARED.theme.getIcon("edit"))
|
659
|
+
self.btnScene = NIconToolButton(self, iSz, "edit")
|
663
660
|
self.btnScene.clicked.connect(lambda: self._editHeading(self.EDIT_SCENE))
|
664
|
-
self.hdeScene = QLabel(
|
661
|
+
self.hdeScene = QLabel(trHide, self)
|
665
662
|
self.hdeScene.setIndent(bSp)
|
666
663
|
self.swtScene = NSwitch(self, height=iPx)
|
667
664
|
|
@@ -675,10 +672,9 @@ class _HeadingsTab(NScrollablePage):
|
|
675
672
|
self.lblHScene = QLabel(self._build.getLabel("headings.fmtHardScene"), self)
|
676
673
|
self.fmtHScene = QLineEdit("", self)
|
677
674
|
self.fmtHScene.setReadOnly(True)
|
678
|
-
self.btnHScene =
|
679
|
-
self.btnHScene.setIcon(SHARED.theme.getIcon("edit"))
|
675
|
+
self.btnHScene = NIconToolButton(self, iSz, "edit")
|
680
676
|
self.btnHScene.clicked.connect(lambda: self._editHeading(self.EDIT_HSCENE))
|
681
|
-
self.hdeHScene = QLabel(
|
677
|
+
self.hdeHScene = QLabel(trHide, self)
|
682
678
|
self.hdeHScene.setIndent(bSp)
|
683
679
|
self.swtHScene = NSwitch(self, height=iPx)
|
684
680
|
|
@@ -692,10 +688,9 @@ class _HeadingsTab(NScrollablePage):
|
|
692
688
|
self.lblSection = QLabel(self._build.getLabel("headings.fmtSection"), self)
|
693
689
|
self.fmtSection = QLineEdit("", self)
|
694
690
|
self.fmtSection.setReadOnly(True)
|
695
|
-
self.btnSection =
|
696
|
-
self.btnSection.setIcon(SHARED.theme.getIcon("edit"))
|
691
|
+
self.btnSection = NIconToolButton(self, iSz, "edit")
|
697
692
|
self.btnSection.clicked.connect(lambda: self._editHeading(self.EDIT_SECTION))
|
698
|
-
self.hdeSection = QLabel(
|
693
|
+
self.hdeSection = QLabel(trHide, self)
|
699
694
|
self.hdeSection.setIndent(bSp)
|
700
695
|
self.swtSection = NSwitch(self, height=iPx)
|
701
696
|
|
@@ -708,7 +703,7 @@ class _HeadingsTab(NScrollablePage):
|
|
708
703
|
# Edit Form
|
709
704
|
# =========
|
710
705
|
|
711
|
-
self.lblEditForm = QLabel(self.tr("Editing: {0}").format(self.tr("None")))
|
706
|
+
self.lblEditForm = QLabel(self.tr("Editing: {0}").format(self.tr("None")), self)
|
712
707
|
|
713
708
|
self.editTextBox = QPlainTextEdit(self)
|
714
709
|
self.editTextBox.setFixedHeight(5*iPx)
|
@@ -764,12 +759,12 @@ class _HeadingsTab(NScrollablePage):
|
|
764
759
|
self.layoutMatrix.addWidget(self.layoutHeading, 0, 0, 1, 5)
|
765
760
|
|
766
761
|
# Title Layout
|
767
|
-
self.mtxTitle = QLabel(self._build.getLabel("headings.fmtTitle"))
|
762
|
+
self.mtxTitle = QLabel(self._build.getLabel("headings.fmtTitle"), self)
|
768
763
|
self.centerTitle = NSwitch(self, height=iPx)
|
769
764
|
self.breakTitle = NSwitch(self, height=iPx)
|
770
|
-
lblCenterT = QLabel(self.tr("Centre"))
|
765
|
+
lblCenterT = QLabel(self.tr("Centre"), self)
|
771
766
|
lblCenterT.setIndent(sSp)
|
772
|
-
lblBreakT = QLabel(self.tr("Page Break"))
|
767
|
+
lblBreakT = QLabel(self.tr("Page Break"), self)
|
773
768
|
lblBreakT.setIndent(sSp)
|
774
769
|
|
775
770
|
self.layoutMatrix.addWidget(self.mtxTitle, 1, 0)
|
@@ -779,12 +774,12 @@ class _HeadingsTab(NScrollablePage):
|
|
779
774
|
self.layoutMatrix.addWidget(self.breakTitle, 1, 4)
|
780
775
|
|
781
776
|
# Chapter Layout
|
782
|
-
self.mtxChapter = QLabel(self._build.getLabel("headings.fmtChapter"))
|
777
|
+
self.mtxChapter = QLabel(self._build.getLabel("headings.fmtChapter"), self)
|
783
778
|
self.centerChapter = NSwitch(self, height=iPx)
|
784
779
|
self.breakChapter = NSwitch(self, height=iPx)
|
785
|
-
lblCenterC = QLabel(self.tr("Centre"))
|
780
|
+
lblCenterC = QLabel(self.tr("Centre"), self)
|
786
781
|
lblCenterC.setIndent(sSp)
|
787
|
-
lblBreakC = QLabel(self.tr("Page Break"))
|
782
|
+
lblBreakC = QLabel(self.tr("Page Break"), self)
|
788
783
|
lblBreakC.setIndent(sSp)
|
789
784
|
|
790
785
|
self.layoutMatrix.addWidget(self.mtxChapter, 2, 0)
|
@@ -794,12 +789,12 @@ class _HeadingsTab(NScrollablePage):
|
|
794
789
|
self.layoutMatrix.addWidget(self.breakChapter, 2, 4)
|
795
790
|
|
796
791
|
# Scene Layout
|
797
|
-
self.mtxScene = QLabel(self._build.getLabel("headings.fmtScene"))
|
792
|
+
self.mtxScene = QLabel(self._build.getLabel("headings.fmtScene"), self)
|
798
793
|
self.centerScene = NSwitch(self, height=iPx)
|
799
794
|
self.breakScene = NSwitch(self, height=iPx)
|
800
|
-
lblCenterS = QLabel(self.tr("Centre"))
|
795
|
+
lblCenterS = QLabel(self.tr("Centre"), self)
|
801
796
|
lblCenterS.setIndent(sSp)
|
802
|
-
lblBreakS = QLabel(self.tr("Page Break"))
|
797
|
+
lblBreakS = QLabel(self.tr("Page Break"), self)
|
803
798
|
lblBreakS.setIndent(sSp)
|
804
799
|
|
805
800
|
self.layoutMatrix.addWidget(self.mtxScene, 3, 0)
|
@@ -982,7 +977,8 @@ class _ContentTab(NScrollableForm):
|
|
982
977
|
|
983
978
|
self._build = build
|
984
979
|
|
985
|
-
iPx = SHARED.theme.
|
980
|
+
iPx = SHARED.theme.baseIconHeight
|
981
|
+
iSz = SHARED.theme.baseIconSize
|
986
982
|
|
987
983
|
# Text Content
|
988
984
|
self.incBodyText = NSwitch(self, height=iPx)
|
@@ -999,10 +995,8 @@ class _ContentTab(NScrollableForm):
|
|
999
995
|
lambda keyword=keyword: self._updateIgnoredKeywords(keyword)
|
1000
996
|
)
|
1001
997
|
|
1002
|
-
self.ignoredKeywordsButton =
|
1003
|
-
self.ignoredKeywordsButton.setIcon(SHARED.theme.getIcon("add"))
|
998
|
+
self.ignoredKeywordsButton = NIconToolButton(self, iSz, "add")
|
1004
999
|
self.ignoredKeywordsButton.setMenu(self.mnKeywords)
|
1005
|
-
self.ignoredKeywordsButton.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
1006
1000
|
|
1007
1001
|
self.addGroupLabel(self._build.getLabel("text.grpContent"))
|
1008
1002
|
self.addRow(self._build.getLabel("text.includeBodyText"), self.incBodyText)
|
@@ -1071,7 +1065,8 @@ class _FormatTab(NScrollableForm):
|
|
1071
1065
|
self._build = build
|
1072
1066
|
self._unitScale = 1.0
|
1073
1067
|
|
1074
|
-
iPx = SHARED.theme.
|
1068
|
+
iPx = SHARED.theme.baseIconHeight
|
1069
|
+
iSz = SHARED.theme.baseIconSize
|
1075
1070
|
spW = 6*SHARED.theme.textNWidth
|
1076
1071
|
dbW = 8*SHARED.theme.textNWidth
|
1077
1072
|
|
@@ -1083,8 +1078,7 @@ class _FormatTab(NScrollableForm):
|
|
1083
1078
|
# Font Family
|
1084
1079
|
self.textFont = QLineEdit(self)
|
1085
1080
|
self.textFont.setReadOnly(True)
|
1086
|
-
self.btnTextFont =
|
1087
|
-
self.btnTextFont.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("...")))
|
1081
|
+
self.btnTextFont = NIconToolButton(self, iSz, "more")
|
1088
1082
|
self.btnTextFont.clicked.connect(self._selectFont)
|
1089
1083
|
self.addRow(
|
1090
1084
|
self._build.getLabel("format.textFont"), self.textFont,
|
@@ -1337,7 +1331,8 @@ class _OutputTab(NScrollableForm):
|
|
1337
1331
|
|
1338
1332
|
self._build = build
|
1339
1333
|
|
1340
|
-
iPx = SHARED.theme.
|
1334
|
+
iPx = SHARED.theme.baseIconHeight
|
1335
|
+
iSz = SHARED.theme.baseIconSize
|
1341
1336
|
spW = 6*SHARED.theme.textNWidth
|
1342
1337
|
|
1343
1338
|
# Open Document
|
@@ -1348,8 +1343,7 @@ class _OutputTab(NScrollableForm):
|
|
1348
1343
|
|
1349
1344
|
self.odtPageHeader = QLineEdit(self)
|
1350
1345
|
self.odtPageHeader.setMinimumWidth(CONFIG.pxInt(200))
|
1351
|
-
self.btnPageHeader =
|
1352
|
-
self.btnPageHeader.setIcon(SHARED.theme.getIcon("revert"))
|
1346
|
+
self.btnPageHeader = NIconToolButton(self, iSz, "revert")
|
1353
1347
|
self.btnPageHeader.clicked.connect(self._resetPageHeader)
|
1354
1348
|
self.addRow(
|
1355
1349
|
self._build.getLabel("odt.pageHeader"), self.odtPageHeader,
|
@@ -1395,6 +1389,7 @@ class _OutputTab(NScrollableForm):
|
|
1395
1389
|
self.htmlAddStyles.setChecked(self._build.getBool("html.addStyles"))
|
1396
1390
|
self.htmlPreserveTabs.setChecked(self._build.getBool("html.preserveTabs"))
|
1397
1391
|
self.mdPreserveBreaks.setChecked(self._build.getBool("md.preserveBreaks"))
|
1392
|
+
self.odtPageHeader.setCursorPosition(0)
|
1398
1393
|
return
|
1399
1394
|
|
1400
1395
|
def saveContent(self) -> None:
|
@@ -26,8 +26,8 @@ from __future__ import annotations
|
|
26
26
|
import math
|
27
27
|
import logging
|
28
28
|
|
29
|
+
from PyQt5.QtCore import pyqtSlot
|
29
30
|
from PyQt5.QtGui import QCloseEvent
|
30
|
-
from PyQt5.QtCore import QSize, Qt, pyqtSlot
|
31
31
|
from PyQt5.QtWidgets import (
|
32
32
|
QAbstractItemView, QDialog, QDialogButtonBox, QFormLayout, QGridLayout,
|
33
33
|
QHBoxLayout, QLabel, QSpinBox, QStackedWidget, QTreeWidget,
|
@@ -37,10 +37,11 @@ from PyQt5.QtWidgets import (
|
|
37
37
|
from novelwriter import CONFIG, SHARED
|
38
38
|
from novelwriter.common import formatTime, numberToRoman
|
39
39
|
from novelwriter.constants import nwUnicode
|
40
|
-
from novelwriter.extensions.switch import NSwitch
|
41
40
|
from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrollablePage
|
42
|
-
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
43
41
|
from novelwriter.extensions.novelselector import NovelSelector
|
42
|
+
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
43
|
+
from novelwriter.extensions.switch import NSwitch
|
44
|
+
from novelwriter.types import QtAlignRight, QtDecoration, QtDialogClose
|
44
45
|
|
45
46
|
logger = logging.getLogger(__name__)
|
46
47
|
|
@@ -94,7 +95,7 @@ class GuiNovelDetails(QDialog):
|
|
94
95
|
self.mainStack.addWidget(self.contentsPage)
|
95
96
|
|
96
97
|
# Buttons
|
97
|
-
self.buttonBox = QDialogButtonBox(
|
98
|
+
self.buttonBox = QDialogButtonBox(QtDialogClose, self)
|
98
99
|
self.buttonBox.rejected.connect(self.close)
|
99
100
|
|
100
101
|
# Assemble
|
@@ -309,7 +310,8 @@ class _ContentsPage(NFixedPage):
|
|
309
310
|
self._data = []
|
310
311
|
self._currentRoot = None
|
311
312
|
|
312
|
-
iPx = SHARED.theme.
|
313
|
+
iPx = SHARED.theme.baseIconHeight
|
314
|
+
iSz = SHARED.theme.baseIconSize
|
313
315
|
hPx = CONFIG.pxInt(12)
|
314
316
|
vPx = CONFIG.pxInt(4)
|
315
317
|
options = SHARED.project.options
|
@@ -322,7 +324,7 @@ class _ContentsPage(NFixedPage):
|
|
322
324
|
|
323
325
|
# Contents Tree
|
324
326
|
self.tocTree = QTreeWidget(self)
|
325
|
-
self.tocTree.setIconSize(
|
327
|
+
self.tocTree.setIconSize(iSz)
|
326
328
|
self.tocTree.setIndentation(0)
|
327
329
|
self.tocTree.setColumnCount(6)
|
328
330
|
self.tocTree.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
@@ -337,10 +339,10 @@ class _ContentsPage(NFixedPage):
|
|
337
339
|
|
338
340
|
treeHeadItem = self.tocTree.headerItem()
|
339
341
|
if treeHeadItem:
|
340
|
-
treeHeadItem.setTextAlignment(self.C_WORDS,
|
341
|
-
treeHeadItem.setTextAlignment(self.C_PAGES,
|
342
|
-
treeHeadItem.setTextAlignment(self.C_PAGE,
|
343
|
-
treeHeadItem.setTextAlignment(self.C_PROG,
|
342
|
+
treeHeadItem.setTextAlignment(self.C_WORDS, QtAlignRight)
|
343
|
+
treeHeadItem.setTextAlignment(self.C_PAGES, QtAlignRight)
|
344
|
+
treeHeadItem.setTextAlignment(self.C_PAGE, QtAlignRight)
|
345
|
+
treeHeadItem.setTextAlignment(self.C_PROG, QtAlignRight)
|
344
346
|
|
345
347
|
treeHeader = self.tocTree.header()
|
346
348
|
treeHeader.setStretchLastSection(True)
|
@@ -364,7 +366,7 @@ class _ContentsPage(NFixedPage):
|
|
364
366
|
countFrom = options.getInt("GuiNovelDetails", "countFrom", 1)
|
365
367
|
clearDouble = options.getBool("GuiNovelDetails", "clearDouble", True)
|
366
368
|
|
367
|
-
self.wpLabel = QLabel(self.tr("Words per page"))
|
369
|
+
self.wpLabel = QLabel(self.tr("Words per page"), self)
|
368
370
|
|
369
371
|
self.wpValue = QSpinBox(self)
|
370
372
|
self.wpValue.setMinimum(10)
|
@@ -373,7 +375,7 @@ class _ContentsPage(NFixedPage):
|
|
373
375
|
self.wpValue.setValue(wordsPerPage)
|
374
376
|
self.wpValue.valueChanged.connect(self._populateTree)
|
375
377
|
|
376
|
-
self.poLabel = QLabel(self.tr("First page offset"))
|
378
|
+
self.poLabel = QLabel(self.tr("First page offset"), self)
|
377
379
|
|
378
380
|
self.poValue = QSpinBox(self)
|
379
381
|
self.poValue.setMinimum(1)
|
@@ -382,7 +384,7 @@ class _ContentsPage(NFixedPage):
|
|
382
384
|
self.poValue.setValue(countFrom)
|
383
385
|
self.poValue.valueChanged.connect(self._populateTree)
|
384
386
|
|
385
|
-
self.dblLabel = QLabel(self.tr("Chapters on odd pages"))
|
387
|
+
self.dblLabel = QLabel(self.tr("Chapters on odd pages"), self)
|
386
388
|
|
387
389
|
self.dblValue = NSwitch(self, height=iPx)
|
388
390
|
self.dblValue.setChecked(clearDouble)
|
@@ -483,17 +485,17 @@ class _ContentsPage(NFixedPage):
|
|
483
485
|
if tTitle.strip() == "":
|
484
486
|
tTitle = self.tr("Untitled")
|
485
487
|
|
486
|
-
newItem.setData(self.C_TITLE,
|
488
|
+
newItem.setData(self.C_TITLE, QtDecoration, hDec)
|
487
489
|
newItem.setText(self.C_TITLE, tTitle)
|
488
490
|
newItem.setText(self.C_WORDS, f"{wCount:n}")
|
489
491
|
newItem.setText(self.C_PAGES, f"{pCount:n}")
|
490
492
|
newItem.setText(self.C_PAGE, progPage)
|
491
493
|
newItem.setText(self.C_PROG, progText)
|
492
494
|
|
493
|
-
newItem.setTextAlignment(self.C_WORDS,
|
494
|
-
newItem.setTextAlignment(self.C_PAGES,
|
495
|
-
newItem.setTextAlignment(self.C_PAGE,
|
496
|
-
newItem.setTextAlignment(self.C_PROG,
|
495
|
+
newItem.setTextAlignment(self.C_WORDS, QtAlignRight)
|
496
|
+
newItem.setTextAlignment(self.C_PAGES, QtAlignRight)
|
497
|
+
newItem.setTextAlignment(self.C_PAGE, QtAlignRight)
|
498
|
+
newItem.setTextAlignment(self.C_PROG, QtAlignRight)
|
497
499
|
|
498
500
|
# Make pages and titles/partitions stand out
|
499
501
|
if tLevel < 2:
|