novelWriter 2.5.2__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.
Files changed (129) hide show
  1. {novelWriter-2.5.2.dist-info → novelWriter-2.6.dist-info}/METADATA +5 -4
  2. {novelWriter-2.5.2.dist-info → novelWriter-2.6.dist-info}/RECORD +126 -105
  3. {novelWriter-2.5.2.dist-info → novelWriter-2.6.dist-info}/WHEEL +1 -1
  4. novelwriter/__init__.py +50 -11
  5. novelwriter/assets/i18n/nw_de_DE.qm +0 -0
  6. novelwriter/assets/i18n/nw_en_US.qm +0 -0
  7. novelwriter/assets/i18n/nw_es_419.qm +0 -0
  8. novelwriter/assets/i18n/nw_fr_FR.qm +0 -0
  9. novelwriter/assets/i18n/nw_it_IT.qm +0 -0
  10. novelwriter/assets/i18n/nw_ja_JP.qm +0 -0
  11. novelwriter/assets/i18n/nw_nb_NO.qm +0 -0
  12. novelwriter/assets/i18n/nw_nl_NL.qm +0 -0
  13. novelwriter/assets/i18n/nw_pl_PL.qm +0 -0
  14. novelwriter/assets/i18n/nw_pt_BR.qm +0 -0
  15. novelwriter/assets/i18n/nw_ru_RU.qm +0 -0
  16. novelwriter/assets/i18n/nw_zh_CN.qm +0 -0
  17. novelwriter/assets/i18n/project_de_DE.json +4 -2
  18. novelwriter/assets/i18n/project_en_GB.json +1 -0
  19. novelwriter/assets/i18n/project_en_US.json +2 -0
  20. novelwriter/assets/i18n/project_it_IT.json +2 -0
  21. novelwriter/assets/i18n/project_ja_JP.json +2 -0
  22. novelwriter/assets/i18n/project_nb_NO.json +2 -0
  23. novelwriter/assets/i18n/project_nl_NL.json +2 -0
  24. novelwriter/assets/i18n/project_pl_PL.json +2 -0
  25. novelwriter/assets/i18n/project_pt_BR.json +2 -0
  26. novelwriter/assets/i18n/project_ru_RU.json +11 -0
  27. novelwriter/assets/i18n/project_zh_CN.json +2 -0
  28. novelwriter/assets/icons/typicons_dark/icons.conf +8 -0
  29. novelwriter/assets/icons/typicons_dark/mixed_copy.svg +4 -0
  30. novelwriter/assets/icons/typicons_dark/mixed_margin-bottom.svg +6 -0
  31. novelwriter/assets/icons/typicons_dark/mixed_margin-left.svg +6 -0
  32. novelwriter/assets/icons/typicons_dark/mixed_margin-right.svg +6 -0
  33. novelwriter/assets/icons/typicons_dark/mixed_margin-top.svg +6 -0
  34. novelwriter/assets/icons/typicons_dark/mixed_size-height.svg +6 -0
  35. novelwriter/assets/icons/typicons_dark/mixed_size-width.svg +6 -0
  36. novelwriter/assets/icons/typicons_dark/nw_toolbar.svg +5 -0
  37. novelwriter/assets/icons/typicons_light/icons.conf +8 -0
  38. novelwriter/assets/icons/typicons_light/mixed_copy.svg +4 -0
  39. novelwriter/assets/icons/typicons_light/mixed_margin-bottom.svg +6 -0
  40. novelwriter/assets/icons/typicons_light/mixed_margin-left.svg +6 -0
  41. novelwriter/assets/icons/typicons_light/mixed_margin-right.svg +6 -0
  42. novelwriter/assets/icons/typicons_light/mixed_margin-top.svg +6 -0
  43. novelwriter/assets/icons/typicons_light/mixed_size-height.svg +6 -0
  44. novelwriter/assets/icons/typicons_light/mixed_size-width.svg +6 -0
  45. novelwriter/assets/icons/typicons_light/nw_toolbar.svg +5 -0
  46. novelwriter/assets/manual.pdf +0 -0
  47. novelwriter/assets/sample.zip +0 -0
  48. novelwriter/assets/text/credits_en.htm +1 -0
  49. novelwriter/assets/themes/default_light.conf +2 -2
  50. novelwriter/common.py +101 -3
  51. novelwriter/config.py +30 -17
  52. novelwriter/constants.py +189 -81
  53. novelwriter/core/buildsettings.py +74 -40
  54. novelwriter/core/coretools.py +146 -148
  55. novelwriter/core/docbuild.py +133 -171
  56. novelwriter/core/document.py +1 -1
  57. novelwriter/core/index.py +39 -38
  58. novelwriter/core/item.py +42 -9
  59. novelwriter/core/itemmodel.py +518 -0
  60. novelwriter/core/options.py +5 -2
  61. novelwriter/core/project.py +68 -90
  62. novelwriter/core/projectdata.py +8 -2
  63. novelwriter/core/projectxml.py +1 -1
  64. novelwriter/core/sessions.py +1 -1
  65. novelwriter/core/spellcheck.py +10 -15
  66. novelwriter/core/status.py +24 -8
  67. novelwriter/core/storage.py +1 -1
  68. novelwriter/core/tree.py +269 -288
  69. novelwriter/dialogs/about.py +1 -1
  70. novelwriter/dialogs/docmerge.py +8 -18
  71. novelwriter/dialogs/docsplit.py +1 -1
  72. novelwriter/dialogs/editlabel.py +1 -1
  73. novelwriter/dialogs/preferences.py +47 -34
  74. novelwriter/dialogs/projectsettings.py +149 -99
  75. novelwriter/dialogs/quotes.py +1 -1
  76. novelwriter/dialogs/wordlist.py +11 -10
  77. novelwriter/enum.py +37 -24
  78. novelwriter/error.py +2 -2
  79. novelwriter/extensions/configlayout.py +28 -13
  80. novelwriter/extensions/eventfilters.py +1 -1
  81. novelwriter/extensions/modified.py +30 -6
  82. novelwriter/extensions/novelselector.py +4 -3
  83. novelwriter/extensions/pagedsidebar.py +9 -9
  84. novelwriter/extensions/progressbars.py +4 -4
  85. novelwriter/extensions/statusled.py +3 -3
  86. novelwriter/extensions/switch.py +3 -3
  87. novelwriter/extensions/switchbox.py +1 -1
  88. novelwriter/extensions/versioninfo.py +1 -1
  89. novelwriter/formats/shared.py +156 -0
  90. novelwriter/formats/todocx.py +1191 -0
  91. novelwriter/formats/tohtml.py +454 -0
  92. novelwriter/{core → formats}/tokenizer.py +497 -495
  93. novelwriter/formats/tomarkdown.py +218 -0
  94. novelwriter/{core → formats}/toodt.py +312 -433
  95. novelwriter/formats/toqdoc.py +486 -0
  96. novelwriter/formats/toraw.py +91 -0
  97. novelwriter/gui/doceditor.py +347 -287
  98. novelwriter/gui/dochighlight.py +97 -85
  99. novelwriter/gui/docviewer.py +90 -33
  100. novelwriter/gui/docviewerpanel.py +18 -26
  101. novelwriter/gui/editordocument.py +18 -3
  102. novelwriter/gui/itemdetails.py +27 -29
  103. novelwriter/gui/mainmenu.py +130 -64
  104. novelwriter/gui/noveltree.py +46 -48
  105. novelwriter/gui/outline.py +202 -256
  106. novelwriter/gui/projtree.py +590 -1238
  107. novelwriter/gui/search.py +11 -19
  108. novelwriter/gui/sidebar.py +8 -7
  109. novelwriter/gui/statusbar.py +20 -3
  110. novelwriter/gui/theme.py +11 -6
  111. novelwriter/guimain.py +101 -201
  112. novelwriter/shared.py +67 -28
  113. novelwriter/text/counting.py +3 -1
  114. novelwriter/text/patterns.py +169 -61
  115. novelwriter/tools/dictionaries.py +3 -3
  116. novelwriter/tools/lipsum.py +1 -1
  117. novelwriter/tools/manusbuild.py +15 -13
  118. novelwriter/tools/manuscript.py +121 -79
  119. novelwriter/tools/manussettings.py +424 -291
  120. novelwriter/tools/noveldetails.py +1 -1
  121. novelwriter/tools/welcome.py +6 -6
  122. novelwriter/tools/writingstats.py +4 -4
  123. novelwriter/types.py +25 -9
  124. novelwriter/core/tohtml.py +0 -530
  125. novelwriter/core/tomarkdown.py +0 -252
  126. novelwriter/core/toqdoc.py +0 -419
  127. {novelWriter-2.5.2.dist-info → novelWriter-2.6.dist-info}/LICENSE.md +0 -0
  128. {novelWriter-2.5.2.dist-info → novelWriter-2.6.dist-info}/entry_points.txt +0 -0
  129. {novelWriter-2.5.2.dist-info → novelWriter-2.6.dist-info}/top_level.txt +0 -0
@@ -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 2018–2024, Veronica Berglyd Olsen
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
@@ -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 2018–2024, Veronica Berglyd Olsen
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
- ffilter = formatFileFilter(["*.txt", "*"])
188
- path, _ = QFileDialog.getOpenFileName(
189
- self, self.tr("Import File"), str(CONFIG.homePath()), filter=ffilter
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
- path, _ = QFileDialog.getSaveFileName(
206
- self, self.tr("Export File"), str(CONFIG.homePath())
207
- )
208
- if path:
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–2024, Veronica Berglyd Olsen
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 = 0
161
- LEVEL = 1
162
- LABEL = 2
163
- LINE = 3
164
- CCOUNT = 4
165
- WCOUNT = 5
166
- PCOUNT = 6
167
- POV = 7
168
- FOCUS = 8
169
- CHAR = 9
170
- PLOT = 10
171
- TIME = 11
172
- WORLD = 12
173
- OBJECT = 13
174
- ENTITY = 14
175
- CUSTOM = 15
176
- SYNOP = 16
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
- HTML = 2
184
- NWD = 3
185
- STD_MD = 4
186
- EXT_MD = 5
187
- J_HTML = 6
188
- J_NWD = 7
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 2018–2024, Veronica Berglyd Olsen
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 2018–2024, Veronica Berglyd Olsen
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.QtCore import Qt
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(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
80
- self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
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(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
117
- self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
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(self, label: str, widget: QWidget | list[QWidget], helpText: str = "",
184
- unit: str | None = None, button: QWidget | None = None, editable: str | None = None,
185
- stretch: tuple[int, int] = (1, 0)) -> None:
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
- wBox.addWidget(item)
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
- self._index[label.strip()] = qWidget
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 2018–2024, Veronica Berglyd Olsen
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 2018–2024, Veronica Berglyd Olsen
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, QSpinBox, QToolButton,
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__(self, parent: QWidget | None = None) -> None:
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 2018–2024, Veronica Berglyd Olsen
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(handle)
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 2018–2024, Veronica Berglyd Olsen
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, QtPaintAnitAlias,
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, _NPagedToolButton] = {}
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) -> _NPagedToolButton:
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 = _NPagedToolButton(self)
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 _NPagedToolButton(QToolButton):
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(QtPaintAnitAlias, True)
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(QtPaintAnitAlias, True)
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 2018–2024, Veronica Berglyd Olsen
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, QtPaintAnitAlias, QtRoundCap, QtSizeFixed, QtSolidLine,
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(QtPaintAnitAlias, True)
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(QtPaintAnitAlias, True)
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 2018–2024, Veronica Berglyd Olsen
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, QtPaintAnitAlias
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(QtPaintAnitAlias, True)
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)
@@ -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 2018–2024, Veronica Berglyd Olsen
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, QtPaintAnitAlias, QtSizeFixed
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(QtPaintAnitAlias, True)
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 2018–2024, Veronica Berglyd Olsen
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 2018–2024, Veronica Berglyd Olsen
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