novelWriter 2.5.3__py3-none-any.whl → 2.6__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.5.3.dist-info → novelWriter-2.6.dist-info}/METADATA +2 -2
- {novelWriter-2.5.3.dist-info → novelWriter-2.6.dist-info}/RECORD +123 -103
- {novelWriter-2.5.3.dist-info → novelWriter-2.6.dist-info}/WHEEL +1 -1
- novelwriter/__init__.py +50 -11
- novelwriter/assets/i18n/nw_de_DE.qm +0 -0
- novelwriter/assets/i18n/nw_en_US.qm +0 -0
- novelwriter/assets/i18n/nw_es_419.qm +0 -0
- novelwriter/assets/i18n/nw_fr_FR.qm +0 -0
- novelwriter/assets/i18n/nw_it_IT.qm +0 -0
- novelwriter/assets/i18n/nw_ja_JP.qm +0 -0
- novelwriter/assets/i18n/nw_nb_NO.qm +0 -0
- novelwriter/assets/i18n/nw_nl_NL.qm +0 -0
- novelwriter/assets/i18n/nw_pl_PL.qm +0 -0
- novelwriter/assets/i18n/nw_pt_BR.qm +0 -0
- novelwriter/assets/i18n/nw_ru_RU.qm +0 -0
- novelwriter/assets/i18n/nw_zh_CN.qm +0 -0
- novelwriter/assets/i18n/project_de_DE.json +2 -0
- novelwriter/assets/i18n/project_en_GB.json +1 -0
- novelwriter/assets/i18n/project_en_US.json +2 -0
- novelwriter/assets/i18n/project_it_IT.json +2 -0
- novelwriter/assets/i18n/project_ja_JP.json +2 -0
- novelwriter/assets/i18n/project_nb_NO.json +2 -0
- novelwriter/assets/i18n/project_nl_NL.json +2 -0
- novelwriter/assets/i18n/project_pl_PL.json +2 -0
- novelwriter/assets/i18n/project_pt_BR.json +2 -0
- novelwriter/assets/i18n/project_zh_CN.json +2 -0
- novelwriter/assets/icons/typicons_dark/icons.conf +8 -0
- novelwriter/assets/icons/typicons_dark/mixed_copy.svg +4 -0
- novelwriter/assets/icons/typicons_dark/mixed_margin-bottom.svg +6 -0
- novelwriter/assets/icons/typicons_dark/mixed_margin-left.svg +6 -0
- novelwriter/assets/icons/typicons_dark/mixed_margin-right.svg +6 -0
- novelwriter/assets/icons/typicons_dark/mixed_margin-top.svg +6 -0
- novelwriter/assets/icons/typicons_dark/mixed_size-height.svg +6 -0
- novelwriter/assets/icons/typicons_dark/mixed_size-width.svg +6 -0
- novelwriter/assets/icons/typicons_dark/nw_toolbar.svg +5 -0
- novelwriter/assets/icons/typicons_light/icons.conf +8 -0
- novelwriter/assets/icons/typicons_light/mixed_copy.svg +4 -0
- novelwriter/assets/icons/typicons_light/mixed_margin-bottom.svg +6 -0
- novelwriter/assets/icons/typicons_light/mixed_margin-left.svg +6 -0
- novelwriter/assets/icons/typicons_light/mixed_margin-right.svg +6 -0
- novelwriter/assets/icons/typicons_light/mixed_margin-top.svg +6 -0
- novelwriter/assets/icons/typicons_light/mixed_size-height.svg +6 -0
- novelwriter/assets/icons/typicons_light/mixed_size-width.svg +6 -0
- novelwriter/assets/icons/typicons_light/nw_toolbar.svg +5 -0
- novelwriter/assets/manual.pdf +0 -0
- novelwriter/assets/sample.zip +0 -0
- novelwriter/common.py +101 -3
- novelwriter/config.py +30 -17
- novelwriter/constants.py +189 -81
- novelwriter/core/buildsettings.py +74 -40
- novelwriter/core/coretools.py +146 -148
- novelwriter/core/docbuild.py +133 -171
- novelwriter/core/document.py +1 -1
- novelwriter/core/index.py +39 -38
- novelwriter/core/item.py +42 -9
- novelwriter/core/itemmodel.py +518 -0
- novelwriter/core/options.py +5 -2
- novelwriter/core/project.py +68 -90
- novelwriter/core/projectdata.py +8 -2
- novelwriter/core/projectxml.py +1 -1
- novelwriter/core/sessions.py +1 -1
- novelwriter/core/spellcheck.py +10 -15
- novelwriter/core/status.py +24 -8
- novelwriter/core/storage.py +1 -1
- novelwriter/core/tree.py +269 -288
- novelwriter/dialogs/about.py +1 -1
- novelwriter/dialogs/docmerge.py +8 -18
- novelwriter/dialogs/docsplit.py +1 -1
- novelwriter/dialogs/editlabel.py +1 -1
- novelwriter/dialogs/preferences.py +47 -34
- novelwriter/dialogs/projectsettings.py +149 -99
- novelwriter/dialogs/quotes.py +1 -1
- novelwriter/dialogs/wordlist.py +11 -10
- novelwriter/enum.py +37 -24
- novelwriter/error.py +2 -2
- novelwriter/extensions/configlayout.py +28 -13
- novelwriter/extensions/eventfilters.py +1 -1
- novelwriter/extensions/modified.py +30 -6
- novelwriter/extensions/novelselector.py +4 -3
- novelwriter/extensions/pagedsidebar.py +9 -9
- novelwriter/extensions/progressbars.py +4 -4
- novelwriter/extensions/statusled.py +3 -3
- novelwriter/extensions/switch.py +3 -3
- novelwriter/extensions/switchbox.py +1 -1
- novelwriter/extensions/versioninfo.py +1 -1
- novelwriter/formats/shared.py +156 -0
- novelwriter/formats/todocx.py +1191 -0
- novelwriter/formats/tohtml.py +454 -0
- novelwriter/{core → formats}/tokenizer.py +497 -495
- novelwriter/formats/tomarkdown.py +218 -0
- novelwriter/{core → formats}/toodt.py +312 -433
- novelwriter/formats/toqdoc.py +486 -0
- novelwriter/formats/toraw.py +91 -0
- novelwriter/gui/doceditor.py +347 -287
- novelwriter/gui/dochighlight.py +97 -85
- novelwriter/gui/docviewer.py +90 -33
- novelwriter/gui/docviewerpanel.py +18 -26
- novelwriter/gui/editordocument.py +18 -3
- novelwriter/gui/itemdetails.py +27 -29
- novelwriter/gui/mainmenu.py +130 -64
- novelwriter/gui/noveltree.py +46 -48
- novelwriter/gui/outline.py +202 -256
- novelwriter/gui/projtree.py +590 -1242
- novelwriter/gui/search.py +11 -19
- novelwriter/gui/sidebar.py +8 -7
- novelwriter/gui/statusbar.py +20 -3
- novelwriter/gui/theme.py +11 -6
- novelwriter/guimain.py +101 -201
- novelwriter/shared.py +67 -28
- novelwriter/text/counting.py +3 -1
- novelwriter/text/patterns.py +169 -61
- novelwriter/tools/dictionaries.py +3 -3
- novelwriter/tools/lipsum.py +1 -1
- novelwriter/tools/manusbuild.py +15 -13
- novelwriter/tools/manuscript.py +121 -79
- novelwriter/tools/manussettings.py +424 -291
- novelwriter/tools/noveldetails.py +1 -1
- novelwriter/tools/welcome.py +6 -6
- novelwriter/tools/writingstats.py +4 -4
- novelwriter/types.py +25 -9
- novelwriter/core/tohtml.py +0 -530
- novelwriter/core/tomarkdown.py +0 -252
- novelwriter/core/toqdoc.py +0 -419
- {novelWriter-2.5.3.dist-info → novelWriter-2.6.dist-info}/LICENSE.md +0 -0
- {novelWriter-2.5.3.dist-info → novelWriter-2.6.dist-info}/entry_points.txt +0 -0
- {novelWriter-2.5.3.dist-info → novelWriter-2.6.dist-info}/top_level.txt +0 -0
novelwriter/dialogs/quotes.py
CHANGED
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2020-06-18 [0.9.0] GuiQuoteSelect
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2021 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
novelwriter/dialogs/wordlist.py
CHANGED
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2021-02-12 [1.2rc1] GuiWordList
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2021 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -96,9 +96,11 @@ class GuiWordList(NDialog):
|
|
96
96
|
self.newEntry = QLineEdit(self)
|
97
97
|
|
98
98
|
self.addButton = NIconToolButton(self, iSz, "add")
|
99
|
+
self.addButton.setToolTip(self.tr("Add Word"))
|
99
100
|
self.addButton.clicked.connect(self._doAdd)
|
100
101
|
|
101
102
|
self.delButton = NIconToolButton(self, iSz, "remove")
|
103
|
+
self.delButton.setToolTip(self.tr("Remove Word"))
|
102
104
|
self.delButton.clicked.connect(self._doDelete)
|
103
105
|
|
104
106
|
self.editBox = QHBoxLayout()
|
@@ -184,11 +186,10 @@ class GuiWordList(NDialog):
|
|
184
186
|
SHARED.info(self.tr(
|
185
187
|
"Note: The import file must be a plain text file with UTF-8 or ASCII encoding."
|
186
188
|
))
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
)
|
191
|
-
if path:
|
189
|
+
if path := QFileDialog.getOpenFileName(
|
190
|
+
self, self.tr("Import File"), str(CONFIG.homePath()),
|
191
|
+
filter=formatFileFilter(["*.txt", "*"]),
|
192
|
+
)[0]:
|
192
193
|
try:
|
193
194
|
with open(path, mode="r", encoding="utf-8") as fo:
|
194
195
|
words = set(w.strip() for w in fo.read().split())
|
@@ -202,10 +203,10 @@ class GuiWordList(NDialog):
|
|
202
203
|
@pyqtSlot()
|
203
204
|
def _exportWords(self) -> None:
|
204
205
|
"""Export words to file."""
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
206
|
+
name = f"{SHARED.project.data.fileSafeName} - {self.windowTitle()}.txt"
|
207
|
+
if path := QFileDialog.getSaveFileName(
|
208
|
+
self, self.tr("Export File"), str(CONFIG.homePath() / name),
|
209
|
+
)[0]:
|
209
210
|
try:
|
210
211
|
path = Path(path).with_suffix(".txt")
|
211
212
|
with open(path, mode="w", encoding="utf-8") as fo:
|
novelwriter/enum.py
CHANGED
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2018-11-02 [0.0.1]
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright 2018
|
9
|
+
Copyright (C) 2018 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -75,6 +75,13 @@ class nwTrinary(Enum):
|
|
75
75
|
POSITIVE = 1
|
76
76
|
|
77
77
|
|
78
|
+
class nwChange(Enum):
|
79
|
+
|
80
|
+
CREATE = 0
|
81
|
+
UPDATE = 1
|
82
|
+
DELETE = 2
|
83
|
+
|
84
|
+
|
78
85
|
class nwDocMode(Enum):
|
79
86
|
|
80
87
|
VIEW = 0
|
@@ -137,6 +144,7 @@ class nwDocInsert(Enum):
|
|
137
144
|
VSPACE_M = 9
|
138
145
|
LIPSUM = 10
|
139
146
|
FOOTNOTE = 11
|
147
|
+
LINE_BRK = 12
|
140
148
|
|
141
149
|
|
142
150
|
class nwView(Enum):
|
@@ -157,35 +165,40 @@ class nwFocus(Enum):
|
|
157
165
|
|
158
166
|
class nwOutline(Enum):
|
159
167
|
|
160
|
-
TITLE
|
161
|
-
LEVEL
|
162
|
-
LABEL
|
163
|
-
LINE
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
168
|
+
TITLE = 0
|
169
|
+
LEVEL = 1
|
170
|
+
LABEL = 2
|
171
|
+
LINE = 3
|
172
|
+
STATUS = 4
|
173
|
+
CCOUNT = 5
|
174
|
+
WCOUNT = 6
|
175
|
+
PCOUNT = 7
|
176
|
+
POV = 8
|
177
|
+
FOCUS = 9
|
178
|
+
CHAR = 10
|
179
|
+
PLOT = 11
|
180
|
+
TIME = 12
|
181
|
+
WORLD = 13
|
182
|
+
OBJECT = 14
|
183
|
+
ENTITY = 15
|
184
|
+
CUSTOM = 16
|
185
|
+
STORY = 17
|
186
|
+
MENTION = 18
|
187
|
+
SYNOP = 19
|
177
188
|
|
178
189
|
|
179
190
|
class nwBuildFmt(Enum):
|
180
191
|
|
181
192
|
ODT = 0
|
182
193
|
FODT = 1
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
194
|
+
DOCX = 2
|
195
|
+
PDF = 3
|
196
|
+
HTML = 4
|
197
|
+
STD_MD = 5
|
198
|
+
EXT_MD = 6
|
199
|
+
NWD = 7
|
200
|
+
J_HTML = 8
|
201
|
+
J_NWD = 9
|
189
202
|
|
190
203
|
|
191
204
|
class nwStatusShape(Enum):
|
novelwriter/error.py
CHANGED
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2020-08-02 [0.10.2]
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2020 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -76,7 +76,7 @@ class NWErrorMessage(QDialog):
|
|
76
76
|
|
77
77
|
font = QFont()
|
78
78
|
font.setPointSize(round(0.9*self.font().pointSize()))
|
79
|
-
font.setFamily(QFontDatabase.systemFont(QFontDatabase.FixedFont).family())
|
79
|
+
font.setFamily(QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont).family())
|
80
80
|
|
81
81
|
self.msgBody = QPlainTextEdit()
|
82
82
|
self.msgBody.setFont(font)
|
@@ -10,7 +10,7 @@ Created: 2024-01-26 [2.3b1] NFixedPage
|
|
10
10
|
Created: 2024-03-12 [2.4b1] NWrappedWidgetBox
|
11
11
|
|
12
12
|
This file is a part of novelWriter
|
13
|
-
Copyright
|
13
|
+
Copyright (C) 2023 Veronica Berglyd Olsen and novelWriter contributors
|
14
14
|
|
15
15
|
This program is free software: you can redistribute it and/or modify
|
16
16
|
it under the terms of the GNU General Public License as published by
|
@@ -27,14 +27,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
27
|
"""
|
28
28
|
from __future__ import annotations
|
29
29
|
|
30
|
-
from PyQt5.
|
31
|
-
from PyQt5.QtGui import QColor, QFont, QPalette
|
30
|
+
from PyQt5.QtGui import QColor, QFont, QPalette, QPixmap
|
32
31
|
from PyQt5.QtWidgets import (
|
33
32
|
QAbstractButton, QFrame, QHBoxLayout, QLabel, QLayout, QScrollArea,
|
34
33
|
QVBoxLayout, QWidget
|
35
34
|
)
|
36
35
|
|
37
36
|
from novelwriter import CONFIG
|
37
|
+
from novelwriter.types import QtScrollAsNeeded
|
38
38
|
|
39
39
|
DEFAULT_SCALE = 0.9
|
40
40
|
|
@@ -76,8 +76,8 @@ class NScrollablePage(QScrollArea):
|
|
76
76
|
self._widget = QWidget(self)
|
77
77
|
self.setWidget(self._widget)
|
78
78
|
self.setWidgetResizable(True)
|
79
|
-
self.setHorizontalScrollBarPolicy(
|
80
|
-
self.setVerticalScrollBarPolicy(
|
79
|
+
self.setHorizontalScrollBarPolicy(QtScrollAsNeeded)
|
80
|
+
self.setVerticalScrollBarPolicy(QtScrollAsNeeded)
|
81
81
|
self.setFrameShadow(QFrame.Shadow.Sunken)
|
82
82
|
self.setFrameShape(QFrame.Shape.StyledPanel)
|
83
83
|
return
|
@@ -113,8 +113,8 @@ class NScrollableForm(QScrollArea):
|
|
113
113
|
|
114
114
|
self.setWidget(self._widget)
|
115
115
|
self.setWidgetResizable(True)
|
116
|
-
self.setHorizontalScrollBarPolicy(
|
117
|
-
self.setVerticalScrollBarPolicy(
|
116
|
+
self.setHorizontalScrollBarPolicy(QtScrollAsNeeded)
|
117
|
+
self.setVerticalScrollBarPolicy(QtScrollAsNeeded)
|
118
118
|
self.setFrameShadow(QFrame.Shadow.Sunken)
|
119
119
|
self.setFrameShape(QFrame.Shape.StyledPanel)
|
120
120
|
|
@@ -180,9 +180,16 @@ class NScrollableForm(QScrollArea):
|
|
180
180
|
self._sections[identifier] = qLabel
|
181
181
|
return
|
182
182
|
|
183
|
-
def addRow(
|
184
|
-
|
185
|
-
|
183
|
+
def addRow(
|
184
|
+
self,
|
185
|
+
label: str | None,
|
186
|
+
widget: QWidget | list[QWidget | QPixmap | int],
|
187
|
+
helpText: str = "",
|
188
|
+
unit: str | None = None,
|
189
|
+
button: QWidget | None = None,
|
190
|
+
editable: str | None = None,
|
191
|
+
stretch: tuple[int, int] = (1, 0),
|
192
|
+
) -> None:
|
186
193
|
"""Add a label and a widget as a new row of the form."""
|
187
194
|
row = QHBoxLayout()
|
188
195
|
row.setSpacing(CONFIG.pxInt(12))
|
@@ -191,13 +198,20 @@ class NScrollableForm(QScrollArea):
|
|
191
198
|
wBox = QHBoxLayout()
|
192
199
|
wBox.setContentsMargins(0, 0, 0, 0)
|
193
200
|
for item in widget:
|
194
|
-
|
201
|
+
if isinstance(item, QWidget):
|
202
|
+
wBox.addWidget(item)
|
203
|
+
elif isinstance(item, QPixmap):
|
204
|
+
icon = QLabel(self)
|
205
|
+
icon.setPixmap(item)
|
206
|
+
wBox.addWidget(icon)
|
207
|
+
elif isinstance(item, int):
|
208
|
+
wBox.addSpacing(CONFIG.pxInt(item))
|
195
209
|
qWidget = QWidget(self)
|
196
210
|
qWidget.setLayout(wBox)
|
197
211
|
else:
|
198
212
|
qWidget = widget
|
199
213
|
|
200
|
-
qLabel = QLabel(label, self)
|
214
|
+
qLabel = QLabel(label or "", self)
|
201
215
|
qLabel.setIndent(self._indent)
|
202
216
|
qLabel.setBuddy(qWidget)
|
203
217
|
|
@@ -230,7 +244,8 @@ class NScrollableForm(QScrollArea):
|
|
230
244
|
row.addWidget(qWidget, stretch[1])
|
231
245
|
|
232
246
|
self._layout.addLayout(row)
|
233
|
-
|
247
|
+
if label:
|
248
|
+
self._index[label.strip()] = qWidget
|
234
249
|
self._first = False
|
235
250
|
|
236
251
|
return
|
@@ -7,7 +7,7 @@ Created: 2023-08-31 [2.1rc1] WheelEventFilter
|
|
7
7
|
Created: 2023-11-28 [2.2] StatusTipFilter
|
8
8
|
|
9
9
|
This file is a part of novelWriter
|
10
|
-
Copyright
|
10
|
+
Copyright (C) 2023 Veronica Berglyd Olsen and novelWriter contributors
|
11
11
|
|
12
12
|
This program is free software: you can redistribute it and/or modify
|
13
13
|
it under the terms of the GNU General Public License as published by
|
@@ -10,7 +10,7 @@ Created: 2024-05-01 [2.5b1] NToolDialog
|
|
10
10
|
Created: 2024-05-01 [2.5b1] NNonBlockingDialog
|
11
11
|
|
12
12
|
This file is a part of novelWriter
|
13
|
-
Copyright
|
13
|
+
Copyright (C) 2024 Veronica Berglyd Olsen and novelWriter contributors
|
14
14
|
|
15
15
|
This program is free software: you can redistribute it and/or modify
|
16
16
|
it under the terms of the GNU General Public License as published by
|
@@ -30,14 +30,15 @@ from __future__ import annotations
|
|
30
30
|
from enum import Enum
|
31
31
|
from typing import TYPE_CHECKING
|
32
32
|
|
33
|
-
from PyQt5.QtCore import QSize, Qt, pyqtSlot
|
34
|
-
from PyQt5.QtGui import QWheelEvent
|
33
|
+
from PyQt5.QtCore import QSize, Qt, pyqtSignal, pyqtSlot
|
34
|
+
from PyQt5.QtGui import QMouseEvent, QWheelEvent
|
35
35
|
from PyQt5.QtWidgets import (
|
36
|
-
QApplication, QComboBox, QDialog, QDoubleSpinBox,
|
37
|
-
QWidget
|
36
|
+
QApplication, QComboBox, QDialog, QDoubleSpinBox, QLabel, QSpinBox,
|
37
|
+
QToolButton, QWidget
|
38
38
|
)
|
39
39
|
|
40
40
|
from novelwriter import CONFIG, SHARED
|
41
|
+
from novelwriter.types import QtMouseLeft
|
41
42
|
|
42
43
|
if TYPE_CHECKING: # pragma: no cover
|
43
44
|
from novelwriter.guimain import GuiMain
|
@@ -136,9 +137,21 @@ class NSpinBox(QSpinBox):
|
|
136
137
|
|
137
138
|
class NDoubleSpinBox(QDoubleSpinBox):
|
138
139
|
|
139
|
-
def __init__(
|
140
|
+
def __init__(
|
141
|
+
self,
|
142
|
+
parent: QWidget | None = None,
|
143
|
+
*,
|
144
|
+
min: float = 0.0,
|
145
|
+
max: float = 15.0,
|
146
|
+
step: float = 0.1,
|
147
|
+
prec: int = 2,
|
148
|
+
) -> None:
|
140
149
|
super().__init__(parent=parent)
|
141
150
|
self.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
151
|
+
self.setMinimum(min)
|
152
|
+
self.setMaximum(max)
|
153
|
+
self.setSingleStep(step)
|
154
|
+
self.setDecimals(prec)
|
142
155
|
return
|
143
156
|
|
144
157
|
def wheelEvent(self, event: QWheelEvent) -> None:
|
@@ -184,3 +197,14 @@ class NIconToggleButton(QToolButton):
|
|
184
197
|
iconSize = self.iconSize()
|
185
198
|
self.setIcon(SHARED.theme.getToggleIcon(iconKey, (iconSize.width(), iconSize.height())))
|
186
199
|
return
|
200
|
+
|
201
|
+
|
202
|
+
class NClickableLabel(QLabel):
|
203
|
+
|
204
|
+
mouseClicked = pyqtSignal()
|
205
|
+
|
206
|
+
def mousePressEvent(self, event: QMouseEvent) -> None:
|
207
|
+
"""Capture a left mouse click and emit its signal."""
|
208
|
+
if event.button() == QtMouseLeft:
|
209
|
+
self.mouseClicked.emit()
|
210
|
+
return super().mousePressEvent(event)
|
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2022-11-17 [2.0] NovelSelector
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2022 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -90,12 +90,13 @@ class NovelSelector(QComboBox):
|
|
90
90
|
@pyqtSlot()
|
91
91
|
def refreshNovelList(self) -> None:
|
92
92
|
"""Rebuild the list of novel items."""
|
93
|
+
cHandle = self.currentData()
|
94
|
+
|
93
95
|
self._blockSignal = True
|
94
96
|
self._firstHandle = None
|
95
97
|
self.clear()
|
96
98
|
|
97
99
|
icon = SHARED.theme.getIcon(nwLabels.CLASS_ICON[nwItemClass.NOVEL])
|
98
|
-
handle = self.currentData()
|
99
100
|
for tHandle, nwItem in SHARED.project.tree.iterRoots(nwItemClass.NOVEL):
|
100
101
|
if self._listFormat:
|
101
102
|
name = self._listFormat.format(nwItem.itemName)
|
@@ -110,7 +111,7 @@ class NovelSelector(QComboBox):
|
|
110
111
|
self.insertSeparator(self.count())
|
111
112
|
self.addItem(icon, self.tr("All Novel Folders"), "")
|
112
113
|
|
113
|
-
self.setHandle(
|
114
|
+
self.setHandle(cHandle)
|
114
115
|
self.setEnabled(self.count() > 1)
|
115
116
|
self._blockSignal = False
|
116
117
|
|
@@ -8,7 +8,7 @@ Created: 2023-02-21 [2.1b1] NPagedToolButton
|
|
8
8
|
Created: 2023-02-21 [2.1b1] NPagedToolLabel
|
9
9
|
|
10
10
|
This file is a part of novelWriter
|
11
|
-
Copyright
|
11
|
+
Copyright (C) 2023 Veronica Berglyd Olsen and novelWriter contributors
|
12
12
|
|
13
13
|
This program is free software: you can redistribute it and/or modify
|
14
14
|
it under the terms of the GNU General Public License as published by
|
@@ -33,7 +33,7 @@ from PyQt5.QtWidgets import (
|
|
33
33
|
)
|
34
34
|
|
35
35
|
from novelwriter.types import (
|
36
|
-
QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen,
|
36
|
+
QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen, QtPaintAntiAlias,
|
37
37
|
QtSizeExpanding, QtSizeFixed
|
38
38
|
)
|
39
39
|
|
@@ -52,7 +52,7 @@ class NPagedSideBar(QToolBar):
|
|
52
52
|
|
53
53
|
self._labelCol = None
|
54
54
|
self._spacerHeight = self.fontMetrics().height() // 2
|
55
|
-
self._buttons: dict[int,
|
55
|
+
self._buttons: dict[int, _PagedToolButton] = {}
|
56
56
|
|
57
57
|
self._group = QButtonGroup(self)
|
58
58
|
self._group.setExclusive(True)
|
@@ -67,7 +67,7 @@ class NPagedSideBar(QToolBar):
|
|
67
67
|
|
68
68
|
return
|
69
69
|
|
70
|
-
def button(self, buttonId: int) ->
|
70
|
+
def button(self, buttonId: int) -> _PagedToolButton:
|
71
71
|
"""Return a specific button."""
|
72
72
|
return self._buttons[buttonId]
|
73
73
|
|
@@ -85,7 +85,7 @@ class NPagedSideBar(QToolBar):
|
|
85
85
|
|
86
86
|
def addButton(self, text: str, buttonId: int = -1) -> QAction:
|
87
87
|
"""Add a new button to the toolbar."""
|
88
|
-
button =
|
88
|
+
button = _PagedToolButton(self)
|
89
89
|
button.setText(text)
|
90
90
|
|
91
91
|
action = self.insertWidget(self._stretchAction, button)
|
@@ -113,7 +113,7 @@ class NPagedSideBar(QToolBar):
|
|
113
113
|
return
|
114
114
|
|
115
115
|
|
116
|
-
class
|
116
|
+
class _PagedToolButton(QToolButton):
|
117
117
|
|
118
118
|
__slots__ = ("_bH", "_tM", "_lM", "_cR", "_aH")
|
119
119
|
|
@@ -146,7 +146,7 @@ class _NPagedToolButton(QToolButton):
|
|
146
146
|
opt.initFrom(self)
|
147
147
|
|
148
148
|
paint = QPainter(self)
|
149
|
-
paint.setRenderHint(
|
149
|
+
paint.setRenderHint(QtPaintAntiAlias, True)
|
150
150
|
paint.setPen(QtNoPen)
|
151
151
|
paint.setBrush(QtNoBrush)
|
152
152
|
|
@@ -154,7 +154,7 @@ class _NPagedToolButton(QToolButton):
|
|
154
154
|
height = self.height()
|
155
155
|
palette = self.palette()
|
156
156
|
|
157
|
-
if opt.state & QtMouseOver == QtMouseOver:
|
157
|
+
if opt.state & QtMouseOver == QtMouseOver: # pragma: no cover
|
158
158
|
backCol = palette.base()
|
159
159
|
paint.setBrush(backCol)
|
160
160
|
paint.setOpacity(0.75)
|
@@ -213,7 +213,7 @@ class _NPagedToolLabel(QLabel):
|
|
213
213
|
label that matches the button style.
|
214
214
|
"""
|
215
215
|
paint = QPainter(self)
|
216
|
-
paint.setRenderHint(
|
216
|
+
paint.setRenderHint(QtPaintAntiAlias, True)
|
217
217
|
paint.setPen(QtNoPen)
|
218
218
|
|
219
219
|
width = self.width()
|
@@ -7,7 +7,7 @@ Created: 2023-06-07 [2.1b1] NProgressCircle
|
|
7
7
|
Created: 2023-06-09 [2.1b1] NProgressSimple
|
8
8
|
|
9
9
|
This file is a part of novelWriter
|
10
|
-
Copyright
|
10
|
+
Copyright (C) 2023 Veronica Berglyd Olsen and novelWriter contributors
|
11
11
|
|
12
12
|
This program is free software: you can redistribute it and/or modify
|
13
13
|
it under the terms of the GNU General Public License as published by
|
@@ -31,7 +31,7 @@ from PyQt5.QtGui import QBrush, QColor, QPainter, QPaintEvent, QPen
|
|
31
31
|
from PyQt5.QtWidgets import QProgressBar, QWidget
|
32
32
|
|
33
33
|
from novelwriter.types import (
|
34
|
-
QtAlignCenter,
|
34
|
+
QtAlignCenter, QtPaintAntiAlias, QtRoundCap, QtSizeFixed, QtSolidLine,
|
35
35
|
QtTransparent
|
36
36
|
)
|
37
37
|
|
@@ -91,7 +91,7 @@ class NProgressCircle(QProgressBar):
|
|
91
91
|
progress = 100.0*self.value()/self.maximum()
|
92
92
|
angle = ceil(16*3.6*progress)
|
93
93
|
painter = QPainter(self)
|
94
|
-
painter.setRenderHint(
|
94
|
+
painter.setRenderHint(QtPaintAntiAlias, True)
|
95
95
|
painter.setPen(self._dPen)
|
96
96
|
painter.setBrush(self._dBrush)
|
97
97
|
painter.drawEllipse(self._dRect)
|
@@ -119,7 +119,7 @@ class NProgressSimple(QProgressBar):
|
|
119
119
|
if (value := self.value()) > 0:
|
120
120
|
progress = ceil(self.width()*float(value)/self.maximum())
|
121
121
|
painter = QPainter(self)
|
122
|
-
painter.setRenderHint(
|
122
|
+
painter.setRenderHint(QtPaintAntiAlias, True)
|
123
123
|
painter.setPen(self.palette().highlight().color())
|
124
124
|
painter.setBrush(self.palette().highlight())
|
125
125
|
painter.drawRect(0, 0, progress, self.height())
|
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2020-05-17 [0.5.1]
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2020 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -30,7 +30,7 @@ from PyQt5.QtWidgets import QAbstractButton, QWidget
|
|
30
30
|
|
31
31
|
from novelwriter import CONFIG
|
32
32
|
from novelwriter.enum import nwTrinary
|
33
|
-
from novelwriter.types import QtBlack,
|
33
|
+
from novelwriter.types import QtBlack, QtPaintAntiAlias
|
34
34
|
|
35
35
|
logger = logging.getLogger(__name__)
|
36
36
|
|
@@ -81,7 +81,7 @@ class StatusLED(QAbstractButton):
|
|
81
81
|
def paintEvent(self, event: QPaintEvent) -> None:
|
82
82
|
"""Draw the LED."""
|
83
83
|
painter = QPainter(self)
|
84
|
-
painter.setRenderHint(
|
84
|
+
painter.setRenderHint(QtPaintAntiAlias, True)
|
85
85
|
painter.setPen(self.palette().windowText().color())
|
86
86
|
painter.setBrush(self._color)
|
87
87
|
painter.setOpacity(1.0)
|
novelwriter/extensions/switch.py
CHANGED
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2020-05-03 [0.4.5]
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2020 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -28,7 +28,7 @@ from PyQt5.QtGui import QMouseEvent, QPainter, QPaintEvent, QResizeEvent
|
|
28
28
|
from PyQt5.QtWidgets import QAbstractButton, QWidget
|
29
29
|
|
30
30
|
from novelwriter import CONFIG, SHARED
|
31
|
-
from novelwriter.types import QtMouseLeft, QtNoPen,
|
31
|
+
from novelwriter.types import QtMouseLeft, QtNoPen, QtPaintAntiAlias, QtSizeFixed
|
32
32
|
|
33
33
|
|
34
34
|
class NSwitch(QAbstractButton):
|
@@ -90,7 +90,7 @@ class NSwitch(QAbstractButton):
|
|
90
90
|
def paintEvent(self, event: QPaintEvent) -> None:
|
91
91
|
"""Drawing the switch itself."""
|
92
92
|
painter = QPainter(self)
|
93
|
-
painter.setRenderHint(
|
93
|
+
painter.setRenderHint(QtPaintAntiAlias, True)
|
94
94
|
painter.setPen(QtNoPen)
|
95
95
|
|
96
96
|
palette = self.palette()
|
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2023-04-16 [2.1b1]
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2023 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|
@@ -6,7 +6,7 @@ File History:
|
|
6
6
|
Created: 2024-02-14 [2.3b1] VersionInfoWidget
|
7
7
|
|
8
8
|
This file is a part of novelWriter
|
9
|
-
Copyright
|
9
|
+
Copyright (C) 2024 Veronica Berglyd Olsen and novelWriter contributors
|
10
10
|
|
11
11
|
This program is free software: you can redistribute it and/or modify
|
12
12
|
it under the terms of the GNU General Public License as published by
|