novelWriter 2.7.4__py3-none-any.whl → 2.8b1__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 (196) hide show
  1. novelwriter/__init__.py +8 -7
  2. novelwriter/assets/icons/font_awesome.icons +22 -4
  3. novelwriter/assets/icons/material_filled_normal.icons +20 -2
  4. novelwriter/assets/icons/material_filled_thin.icons +20 -2
  5. novelwriter/assets/icons/material_rounded_normal.icons +20 -2
  6. novelwriter/assets/icons/material_rounded_thin.icons +20 -2
  7. novelwriter/assets/icons/material_sharp_normal.icons +20 -2
  8. novelwriter/assets/icons/material_sharp_thin.icons +20 -2
  9. novelwriter/assets/icons/remix_filled.icons +20 -2
  10. novelwriter/assets/icons/remix_outline.icons +20 -2
  11. novelwriter/assets/images/welcome.webp +0 -0
  12. novelwriter/assets/manual.pdf +0 -0
  13. novelwriter/assets/manual_fr.pdf +0 -0
  14. novelwriter/assets/sample.zip +0 -0
  15. novelwriter/assets/text/credits_en.htm +61 -11
  16. novelwriter/assets/themes/aura.conf +97 -0
  17. novelwriter/assets/themes/aura_bright.conf +95 -0
  18. novelwriter/assets/themes/aura_soft.conf +97 -0
  19. novelwriter/assets/themes/b2t_garden_dark.conf +97 -0
  20. novelwriter/assets/themes/b2t_garden_light.conf +97 -0
  21. novelwriter/assets/themes/b2t_suburb_dark.conf +97 -0
  22. novelwriter/assets/themes/b2t_suburb_light.conf +97 -0
  23. novelwriter/assets/themes/b4t_classic_o_dark.conf +97 -0
  24. novelwriter/assets/themes/b4t_classic_o_light.conf +97 -0
  25. novelwriter/assets/themes/b4t_modern_c_dark.conf +97 -0
  26. novelwriter/assets/themes/b4t_modern_c_light.conf +97 -0
  27. novelwriter/assets/themes/blue_streak_dark.conf +97 -0
  28. novelwriter/assets/themes/blue_streak_light.conf +97 -0
  29. novelwriter/assets/themes/castle_day.conf +95 -0
  30. novelwriter/assets/themes/castle_night.conf +95 -0
  31. novelwriter/assets/themes/catppuccin_latte.conf +97 -0
  32. novelwriter/assets/themes/catppuccin_mocha.conf +97 -0
  33. novelwriter/assets/themes/chalky_soil.conf +95 -0
  34. novelwriter/assets/themes/chernozem.conf +95 -0
  35. novelwriter/assets/themes/cyberpunk_night.conf +88 -40
  36. novelwriter/assets/themes/default_dark.conf +89 -41
  37. novelwriter/assets/themes/default_light.conf +89 -41
  38. novelwriter/assets/themes/dracula.conf +91 -42
  39. novelwriter/assets/themes/espresso.conf +97 -0
  40. novelwriter/assets/themes/everforest_dark.conf +97 -0
  41. novelwriter/assets/themes/everforest_light.conf +97 -0
  42. novelwriter/assets/themes/floral_daydream.conf +95 -0
  43. novelwriter/assets/themes/floral_midnight.conf +95 -0
  44. novelwriter/assets/themes/full_moon.conf +95 -0
  45. novelwriter/assets/themes/grey_dark.conf +97 -0
  46. novelwriter/assets/themes/grey_light.conf +97 -0
  47. novelwriter/assets/themes/horizon_dark.conf +97 -0
  48. novelwriter/assets/themes/horizon_light.conf +97 -0
  49. novelwriter/assets/themes/jewel_case_dark.conf +95 -0
  50. novelwriter/assets/themes/jewel_case_light.conf +95 -0
  51. novelwriter/assets/themes/lcars.conf +97 -0
  52. novelwriter/assets/themes/light_owl.conf +117 -0
  53. novelwriter/assets/themes/new_moon.conf +97 -0
  54. novelwriter/assets/themes/night_owl.conf +117 -0
  55. novelwriter/assets/themes/noctis.conf +129 -0
  56. novelwriter/assets/themes/noctis_lux.conf +129 -0
  57. novelwriter/assets/themes/nord.conf +97 -0
  58. novelwriter/assets/themes/nordlicht.conf +95 -0
  59. novelwriter/assets/themes/otium_dark.conf +95 -0
  60. novelwriter/assets/themes/otium_light.conf +95 -0
  61. novelwriter/assets/themes/paragon.conf +96 -0
  62. novelwriter/assets/themes/primer_light.conf +97 -0
  63. novelwriter/assets/themes/primer_night.conf +97 -0
  64. novelwriter/assets/themes/rose_pine.conf +97 -0
  65. novelwriter/assets/themes/rose_pine_dawn.conf +97 -0
  66. novelwriter/assets/themes/ruby_day.conf +95 -0
  67. novelwriter/assets/themes/ruby_night.conf +95 -0
  68. novelwriter/assets/themes/selenium_dark.conf +95 -0
  69. novelwriter/assets/themes/selenium_light.conf +95 -0
  70. novelwriter/assets/themes/sepia_dark.conf +95 -0
  71. novelwriter/assets/themes/sepia_light.conf +95 -0
  72. novelwriter/assets/themes/snazzy.conf +102 -40
  73. novelwriter/assets/themes/solarized_dark.conf +108 -40
  74. novelwriter/assets/themes/solarized_light.conf +108 -40
  75. novelwriter/assets/themes/sultana_light.conf +95 -0
  76. novelwriter/assets/themes/sultana_night.conf +95 -0
  77. novelwriter/assets/themes/tango_dark.conf +111 -0
  78. novelwriter/assets/themes/tango_light.conf +111 -0
  79. novelwriter/assets/themes/tomorrow.conf +117 -0
  80. novelwriter/assets/themes/tomorrow_night.conf +117 -0
  81. novelwriter/assets/themes/tomorrow_night_blue.conf +117 -0
  82. novelwriter/assets/themes/tomorrow_night_bright.conf +117 -0
  83. novelwriter/assets/themes/tomorrow_night_eighties.conf +117 -0
  84. novelwriter/assets/themes/vivid_black_green.conf +97 -0
  85. novelwriter/assets/themes/vivid_black_red.conf +97 -0
  86. novelwriter/assets/themes/vivid_white_green.conf +97 -0
  87. novelwriter/assets/themes/vivid_white_red.conf +97 -0
  88. novelwriter/assets/themes/warpgate.conf +96 -0
  89. novelwriter/assets/themes/waterlily_dark.conf +95 -0
  90. novelwriter/assets/themes/waterlily_light.conf +95 -0
  91. novelwriter/common.py +47 -17
  92. novelwriter/config.py +57 -62
  93. novelwriter/constants.py +32 -6
  94. novelwriter/core/buildsettings.py +3 -23
  95. novelwriter/core/coretools.py +21 -25
  96. novelwriter/core/docbuild.py +4 -9
  97. novelwriter/core/document.py +2 -6
  98. novelwriter/core/index.py +33 -53
  99. novelwriter/core/indexdata.py +17 -22
  100. novelwriter/core/item.py +11 -35
  101. novelwriter/core/itemmodel.py +5 -21
  102. novelwriter/core/novelmodel.py +3 -7
  103. novelwriter/core/options.py +3 -4
  104. novelwriter/core/project.py +31 -21
  105. novelwriter/core/projectdata.py +2 -21
  106. novelwriter/core/projectxml.py +13 -21
  107. novelwriter/core/sessions.py +2 -4
  108. novelwriter/core/spellcheck.py +12 -13
  109. novelwriter/core/status.py +27 -20
  110. novelwriter/core/storage.py +5 -10
  111. novelwriter/core/tree.py +6 -15
  112. novelwriter/dialogs/about.py +9 -10
  113. novelwriter/dialogs/docmerge.py +17 -14
  114. novelwriter/dialogs/docsplit.py +18 -14
  115. novelwriter/dialogs/editlabel.py +15 -9
  116. novelwriter/dialogs/preferences.py +69 -68
  117. novelwriter/dialogs/projectsettings.py +88 -67
  118. novelwriter/dialogs/quotes.py +15 -10
  119. novelwriter/dialogs/wordlist.py +18 -21
  120. novelwriter/enum.py +75 -30
  121. novelwriter/error.py +6 -11
  122. novelwriter/extensions/configlayout.py +8 -34
  123. novelwriter/extensions/eventfilters.py +3 -3
  124. novelwriter/extensions/modified.py +87 -32
  125. novelwriter/extensions/novelselector.py +13 -12
  126. novelwriter/extensions/pagedsidebar.py +10 -18
  127. novelwriter/extensions/progressbars.py +5 -11
  128. novelwriter/extensions/statusled.py +3 -6
  129. novelwriter/extensions/switch.py +8 -11
  130. novelwriter/extensions/switchbox.py +2 -11
  131. novelwriter/extensions/versioninfo.py +6 -7
  132. novelwriter/formats/shared.py +10 -2
  133. novelwriter/formats/todocx.py +15 -37
  134. novelwriter/formats/tohtml.py +52 -61
  135. novelwriter/formats/tokenizer.py +33 -64
  136. novelwriter/formats/tomarkdown.py +4 -11
  137. novelwriter/formats/toodt.py +12 -71
  138. novelwriter/formats/toqdoc.py +11 -21
  139. novelwriter/formats/toraw.py +2 -6
  140. novelwriter/gui/doceditor.py +207 -245
  141. novelwriter/gui/dochighlight.py +142 -101
  142. novelwriter/gui/docviewer.py +53 -84
  143. novelwriter/gui/docviewerpanel.py +18 -41
  144. novelwriter/gui/editordocument.py +12 -17
  145. novelwriter/gui/itemdetails.py +5 -14
  146. novelwriter/gui/mainmenu.py +24 -32
  147. novelwriter/gui/noveltree.py +13 -51
  148. novelwriter/gui/outline.py +20 -61
  149. novelwriter/gui/projtree.py +40 -96
  150. novelwriter/gui/search.py +9 -24
  151. novelwriter/gui/sidebar.py +54 -22
  152. novelwriter/gui/statusbar.py +7 -22
  153. novelwriter/gui/theme.py +482 -368
  154. novelwriter/guimain.py +87 -101
  155. novelwriter/shared.py +79 -48
  156. novelwriter/splash.py +9 -5
  157. novelwriter/text/comments.py +1 -1
  158. novelwriter/text/counting.py +9 -5
  159. novelwriter/text/patterns.py +20 -15
  160. novelwriter/tools/dictionaries.py +18 -16
  161. novelwriter/tools/lipsum.py +15 -17
  162. novelwriter/tools/manusbuild.py +25 -45
  163. novelwriter/tools/manuscript.py +94 -95
  164. novelwriter/tools/manussettings.py +149 -104
  165. novelwriter/tools/noveldetails.py +10 -24
  166. novelwriter/tools/welcome.py +24 -72
  167. novelwriter/tools/writingstats.py +17 -26
  168. novelwriter/types.py +25 -13
  169. {novelwriter-2.7.4.dist-info → novelwriter-2.8b1.dist-info}/METADATA +7 -7
  170. novelwriter-2.8b1.dist-info/RECORD +212 -0
  171. novelwriter/assets/images/welcome-dark.jpg +0 -0
  172. novelwriter/assets/images/welcome-light.jpg +0 -0
  173. novelwriter/assets/syntax/cyberpunk_night.conf +0 -28
  174. novelwriter/assets/syntax/default_dark.conf +0 -42
  175. novelwriter/assets/syntax/default_light.conf +0 -42
  176. novelwriter/assets/syntax/dracula.conf +0 -44
  177. novelwriter/assets/syntax/grey_dark.conf +0 -29
  178. novelwriter/assets/syntax/grey_light.conf +0 -29
  179. novelwriter/assets/syntax/light_owl.conf +0 -49
  180. novelwriter/assets/syntax/night_owl.conf +0 -49
  181. novelwriter/assets/syntax/snazzy.conf +0 -42
  182. novelwriter/assets/syntax/solarized_dark.conf +0 -29
  183. novelwriter/assets/syntax/solarized_light.conf +0 -29
  184. novelwriter/assets/syntax/tango.conf +0 -39
  185. novelwriter/assets/syntax/tomorrow.conf +0 -49
  186. novelwriter/assets/syntax/tomorrow_night.conf +0 -49
  187. novelwriter/assets/syntax/tomorrow_night_blue.conf +0 -49
  188. novelwriter/assets/syntax/tomorrow_night_bright.conf +0 -49
  189. novelwriter/assets/syntax/tomorrow_night_eighties.conf +0 -49
  190. novelwriter/assets/themes/default.conf +0 -3
  191. novelwriter-2.7.4.dist-info/RECORD +0 -163
  192. {novelwriter-2.7.4.dist-info → novelwriter-2.8b1.dist-info}/WHEEL +0 -0
  193. {novelwriter-2.7.4.dist-info → novelwriter-2.8b1.dist-info}/entry_points.txt +0 -0
  194. {novelwriter-2.7.4.dist-info → novelwriter-2.8b1.dist-info}/licenses/LICENSE.md +0 -0
  195. {novelwriter-2.7.4.dist-info → novelwriter-2.8b1.dist-info}/licenses/setup/LICENSE-Apache-2.0.txt +0 -0
  196. {novelwriter-2.7.4.dist-info → novelwriter-2.8b1.dist-info}/top_level.txt +0 -0
novelwriter/enum.py CHANGED
@@ -20,12 +20,13 @@ General Public License for more details.
20
20
 
21
21
  You should have received a copy of the GNU General Public License
22
22
  along with this program. If not, see <https://www.gnu.org/licenses/>.
23
- """
23
+ """ # noqa
24
24
 
25
25
  from enum import Enum
26
26
 
27
27
 
28
28
  class nwItemType(Enum):
29
+ """Enum: Project Item Types."""
29
30
 
30
31
  NO_TYPE = 0
31
32
  ROOT = 1
@@ -34,6 +35,7 @@ class nwItemType(Enum):
34
35
 
35
36
 
36
37
  class nwItemClass(Enum):
38
+ """Enum: Project Item Classes."""
37
39
 
38
40
  NO_CLASS = 0
39
41
  NOVEL = 1
@@ -50,6 +52,7 @@ class nwItemClass(Enum):
50
52
 
51
53
 
52
54
  class nwItemLayout(Enum):
55
+ """A project item's layout."""
53
56
 
54
57
  NO_LAYOUT = 0
55
58
  DOCUMENT = 1
@@ -57,6 +60,7 @@ class nwItemLayout(Enum):
57
60
 
58
61
 
59
62
  class nwComment(Enum):
63
+ """Types of text comments."""
60
64
 
61
65
  PLAIN = 0
62
66
  IGNORE = 1
@@ -69,6 +73,7 @@ class nwComment(Enum):
69
73
 
70
74
 
71
75
  class nwChange(Enum):
76
+ """Change request modes."""
72
77
 
73
78
  CREATE = 0
74
79
  UPDATE = 1
@@ -76,12 +81,14 @@ class nwChange(Enum):
76
81
 
77
82
 
78
83
  class nwDocMode(Enum):
84
+ """Document open modes."""
79
85
 
80
86
  VIEW = 0
81
87
  EDIT = 1
82
88
 
83
89
 
84
90
  class nwDocAction(Enum):
91
+ """Document actions."""
85
92
 
86
93
  NO_ACTION = 0
87
94
  UNDO = 1
@@ -92,38 +99,40 @@ class nwDocAction(Enum):
92
99
  MD_ITALIC = 6
93
100
  MD_BOLD = 7
94
101
  MD_STRIKE = 8
95
- S_QUOTE = 9
96
- D_QUOTE = 10
97
- SEL_ALL = 11
98
- SEL_PARA = 12
99
- BLOCK_H1 = 13
100
- BLOCK_H2 = 14
101
- BLOCK_H3 = 15
102
- BLOCK_H4 = 16
103
- BLOCK_COM = 17
104
- BLOCK_IGN = 18
105
- BLOCK_TXT = 19
106
- BLOCK_TTL = 20
107
- BLOCK_UNN = 21
108
- BLOCK_HSC = 22
109
- REPL_SNG = 23
110
- REPL_DBL = 24
111
- RM_BREAKS = 25
112
- ALIGN_L = 26
113
- ALIGN_C = 27
114
- ALIGN_R = 28
115
- INDENT_L = 29
116
- INDENT_R = 30
117
- SC_ITALIC = 31
118
- SC_BOLD = 32
119
- SC_STRIKE = 33
120
- SC_ULINE = 34
121
- SC_MARK = 35
122
- SC_SUP = 36
123
- SC_SUB = 37
102
+ MD_MARK = 9
103
+ S_QUOTE = 10
104
+ D_QUOTE = 11
105
+ SEL_ALL = 12
106
+ SEL_PARA = 13
107
+ BLOCK_H1 = 14
108
+ BLOCK_H2 = 15
109
+ BLOCK_H3 = 16
110
+ BLOCK_H4 = 17
111
+ BLOCK_COM = 18
112
+ BLOCK_IGN = 19
113
+ BLOCK_TXT = 20
114
+ BLOCK_TTL = 21
115
+ BLOCK_UNN = 22
116
+ BLOCK_HSC = 23
117
+ REPL_SNG = 24
118
+ REPL_DBL = 25
119
+ RM_BREAKS = 26
120
+ ALIGN_L = 27
121
+ ALIGN_C = 28
122
+ ALIGN_R = 29
123
+ INDENT_L = 30
124
+ INDENT_R = 31
125
+ SC_ITALIC = 32
126
+ SC_BOLD = 33
127
+ SC_STRIKE = 34
128
+ SC_ULINE = 35
129
+ SC_MARK = 36
130
+ SC_SUP = 37
131
+ SC_SUB = 38
124
132
 
125
133
 
126
134
  class nwDocInsert(Enum):
135
+ """Document insert actions."""
127
136
 
128
137
  NO_INSERT = 0
129
138
  QUOTE_LS = 1
@@ -141,6 +150,7 @@ class nwDocInsert(Enum):
141
150
 
142
151
 
143
152
  class nwView(Enum):
153
+ """Main GUI view modes."""
144
154
 
145
155
  EDITOR = 0
146
156
  PROJECT = 1
@@ -150,13 +160,23 @@ class nwView(Enum):
150
160
 
151
161
 
152
162
  class nwFocus(Enum):
163
+ """Main GUI panel focus."""
153
164
 
154
165
  TREE = 1
155
166
  DOCUMENT = 2
156
167
  OUTLINE = 3
157
168
 
158
169
 
170
+ class nwTheme(Enum):
171
+ """GUI theme colour modes."""
172
+
173
+ AUTO = 0
174
+ LIGHT = 1
175
+ DARK = 2
176
+
177
+
159
178
  class nwOutline(Enum):
179
+ """Enum: Project Outline Columns."""
160
180
 
161
181
  TITLE = 0
162
182
  LEVEL = 1
@@ -181,6 +201,7 @@ class nwOutline(Enum):
181
201
 
182
202
 
183
203
  class nwNovelExtra(Enum):
204
+ """Enum: Novel View Extra Columns."""
184
205
 
185
206
  HIDDEN = 0
186
207
  POV = 1
@@ -189,6 +210,7 @@ class nwNovelExtra(Enum):
189
210
 
190
211
 
191
212
  class nwBuildFmt(Enum):
213
+ """Enum: Manuscript Document Formats."""
192
214
 
193
215
  ODT = 0
194
216
  FODT = 1
@@ -203,6 +225,7 @@ class nwBuildFmt(Enum):
203
225
 
204
226
 
205
227
  class nwStatusShape(Enum):
228
+ """Enum: Status/Importance Icon Shapes."""
206
229
 
207
230
  SQUARE = 0
208
231
  TRIANGLE = 1
@@ -224,3 +247,25 @@ class nwStatusShape(Enum):
224
247
  BLOCK_2 = 17
225
248
  BLOCK_3 = 18
226
249
  BLOCK_4 = 19
250
+
251
+
252
+ class nwStandardButton(Enum):
253
+ """Enum: Standard Dialog Buttons."""
254
+
255
+ OK = 0
256
+ CANCEL = 1
257
+ YES = 2
258
+ NO = 3
259
+ OPEN = 4
260
+ CLOSE = 5
261
+ SAVE = 6
262
+ BROWSE = 7
263
+ LIST = 8
264
+ NEW = 9
265
+ CREATE = 10
266
+ RESET = 11
267
+ INSERT = 12
268
+ APPLY = 13
269
+ BUILD = 14
270
+ PRINT = 15
271
+ PREVIEW = 16
novelwriter/error.py CHANGED
@@ -20,7 +20,7 @@ General Public License for more details.
20
20
 
21
21
  You should have received a copy of the GNU General Public License
22
22
  along with this program. If not, see <https://www.gnu.org/licenses/>.
23
- """
23
+ """ # noqa
24
24
  from __future__ import annotations
25
25
 
26
26
  import logging
@@ -47,7 +47,6 @@ def logException() -> None:
47
47
  exType, exValue, _ = sys.exc_info()
48
48
  if exType is not None:
49
49
  logger.error(f"{exType.__name__}: {exValue!s}", stacklevel=2)
50
- return
51
50
 
52
51
 
53
52
  def formatException(exc: BaseException) -> str:
@@ -58,6 +57,7 @@ def formatException(exc: BaseException) -> str:
58
57
 
59
58
 
60
59
  class NWErrorMessage(QDialog):
60
+ """GUI: Error Dialog."""
61
61
 
62
62
  def __init__(self, parent: QWidget) -> None:
63
63
  super().__init__(parent=parent)
@@ -110,8 +110,6 @@ class NWErrorMessage(QDialog):
110
110
  self.setSizeGripEnabled(True)
111
111
  self.resize(800, 400)
112
112
 
113
- return
114
-
115
113
  def setMessage(self, exType: type, exValue: BaseException, exTrace: TracebackType) -> None:
116
114
  """Generate a message and append session data, error info and
117
115
  error traceback.
@@ -143,7 +141,7 @@ class NWErrorMessage(QDialog):
143
141
  enchantVersion = "Unknown"
144
142
 
145
143
  try:
146
- txtTrace = "\n".join(format_tb(exTrace))
144
+ trace = "\n".join(format_tb(exTrace))
147
145
  self.msgBody.setPlainText(
148
146
  "Environment:\n"
149
147
  f"novelWriter Version: {__version__}\n"
@@ -152,13 +150,11 @@ class NWErrorMessage(QDialog):
152
150
  f"Qt: {QT_VERSION_STR}, PyQt: {PYQT_VERSION_STR}\n"
153
151
  f"enchant: {enchantVersion}\n\n"
154
152
  f"{exType.__name__}:\n{exValue!s}\n\n"
155
- f"Traceback:\n{txtTrace}\n"
153
+ f"Traceback:\n{trace}\n"
156
154
  )
157
155
  except Exception:
158
156
  self.msgBody.setPlainText("Failed to generate error report ...")
159
157
 
160
- return
161
-
162
158
  ##
163
159
  # Slots
164
160
  ##
@@ -167,16 +163,15 @@ class NWErrorMessage(QDialog):
167
163
  def _doClose(self) -> None:
168
164
  """Close the dialog."""
169
165
  self.close()
170
- return
171
166
 
172
167
 
173
168
  def exceptionHandler(exType: type, exValue: BaseException, exTrace: TracebackType) -> None:
174
- """Function to catch unhandled global exceptions."""
169
+ """Catch unhandled global exceptions."""
175
170
  from traceback import print_tb
176
171
 
177
172
  from PyQt6.QtWidgets import QApplication
178
173
 
179
- logger.critical("%s: %s", exType.__name__, str(exValue))
174
+ logger.critical("%s: %s", exType.__name__, exValue)
180
175
  print_tb(exTrace)
181
176
 
182
177
  try:
@@ -24,10 +24,10 @@ General Public License for more details.
24
24
 
25
25
  You should have received a copy of the GNU General Public License
26
26
  along with this program. If not, see <https://www.gnu.org/licenses/>.
27
- """
27
+ """ # noqa
28
28
  from __future__ import annotations
29
29
 
30
- from PyQt6.QtGui import QColor, QFont, QPalette, QPixmap
30
+ from PyQt6.QtGui import QColor, QFont, QPalette
31
31
  from PyQt6.QtWidgets import (
32
32
  QAbstractButton, QFrame, QHBoxLayout, QLabel, QLayout, QScrollArea,
33
33
  QVBoxLayout, QWidget
@@ -39,7 +39,7 @@ DEFAULT_SCALE = 0.9
39
39
 
40
40
 
41
41
  class NFixedPage(QFrame):
42
- """Extension: Fixed Page Widget
42
+ """Extension: Fixed Page Widget.
43
43
 
44
44
  A custom widget that holds a layout. This is just a wrapper around a
45
45
  QFrame that sets the same frame style as the other Page widgets.
@@ -49,23 +49,20 @@ class NFixedPage(QFrame):
49
49
  super().__init__(parent=parent)
50
50
  self.setFrameShadow(QFrame.Shadow.Sunken)
51
51
  self.setFrameShape(QFrame.Shape.StyledPanel)
52
- return
53
52
 
54
53
  def setCentralLayout(self, layout: QLayout) -> None:
55
54
  """Set a layout as the central object."""
56
55
  self.setLayout(layout)
57
- return
58
56
 
59
57
  def setCentralWidget(self, widget: QWidget) -> None:
60
58
  """Set a layout as the central object."""
61
59
  layout = QHBoxLayout()
62
60
  layout.addWidget(widget)
63
61
  self.setLayout(layout)
64
- return
65
62
 
66
63
 
67
64
  class NScrollablePage(QScrollArea):
68
- """Extension: Scrollable Page Widget
65
+ """Extension: Scrollable Page Widget.
69
66
 
70
67
  A custom widget that holds a layout within a scrollable area.
71
68
  """
@@ -79,16 +76,14 @@ class NScrollablePage(QScrollArea):
79
76
  self.setVerticalScrollBarPolicy(QtScrollAsNeeded)
80
77
  self.setFrameShadow(QFrame.Shadow.Sunken)
81
78
  self.setFrameShape(QFrame.Shape.StyledPanel)
82
- return
83
79
 
84
80
  def setCentralLayout(self, layout: QLayout) -> None:
85
81
  """Set the central layout of the scroll page."""
86
82
  self._widget.setLayout(layout)
87
- return
88
83
 
89
84
 
90
85
  class NScrollableForm(QScrollArea):
91
- """Extension: Scrollable Form Widget
86
+ """Extension: Scrollable Form Widget.
92
87
 
93
88
  A custom widget that creates a form within a scrollable area.
94
89
  """
@@ -117,8 +112,6 @@ class NScrollableForm(QScrollArea):
117
112
  self.setFrameShadow(QFrame.Shadow.Sunken)
118
113
  self.setFrameShape(QFrame.Shape.StyledPanel)
119
114
 
120
- return
121
-
122
115
  ##
123
116
  # Properties
124
117
  ##
@@ -135,18 +128,15 @@ class NScrollableForm(QScrollArea):
135
128
  """Set the text color for the help text."""
136
129
  self._helpCol = color
137
130
  self._fontScale = scale
138
- return
139
131
 
140
132
  def setHelpText(self, key: str, text: str) -> None:
141
133
  """Set the text for the help label."""
142
134
  if qHelp := self._editable.get(key):
143
135
  qHelp.setText(text)
144
- return
145
136
 
146
137
  def setRowIndent(self, indent: int) -> None:
147
138
  """Set the indentation of each row."""
148
139
  self._indent = max(indent, 0)
149
- return
150
140
 
151
141
  ##
152
142
  # Methods
@@ -158,7 +148,6 @@ class NScrollableForm(QScrollArea):
158
148
  yPos = self._sections[identifier].pos().y() - 8
159
149
  if vBar := self.verticalScrollBar():
160
150
  vBar.setValue(yPos)
161
- return
162
151
 
163
152
  def scrollToLabel(self, label: str) -> None:
164
153
  """Scroll to the requested label."""
@@ -166,7 +155,6 @@ class NScrollableForm(QScrollArea):
166
155
  yPos = self._index[label].pos().y() - 8
167
156
  if vBar := self.verticalScrollBar():
168
157
  vBar.setValue(yPos)
169
- return
170
158
 
171
159
  def addGroupLabel(self, label: str, identifier: int | None = None) -> None:
172
160
  """Add a text label to separate groups of settings."""
@@ -178,12 +166,11 @@ class NScrollableForm(QScrollArea):
178
166
  self._first = False
179
167
  if identifier is not None:
180
168
  self._sections[identifier] = qLabel
181
- return
182
169
 
183
170
  def addRow(
184
171
  self,
185
172
  label: str | None,
186
- widget: QWidget | list[QWidget | QPixmap | int],
173
+ widget: QWidget | list[QWidget | int],
187
174
  helpText: str = "",
188
175
  unit: str | None = None,
189
176
  button: QWidget | None = None,
@@ -200,10 +187,6 @@ class NScrollableForm(QScrollArea):
200
187
  for item in widget:
201
188
  if isinstance(item, QWidget):
202
189
  wBox.addWidget(item)
203
- elif isinstance(item, QPixmap):
204
- icon = QLabel(self)
205
- icon.setPixmap(item)
206
- wBox.addWidget(icon)
207
190
  elif isinstance(item, int):
208
191
  wBox.addSpacing(item)
209
192
  qWidget = QWidget(self)
@@ -252,17 +235,14 @@ class NScrollableForm(QScrollArea):
252
235
  self._index[label.strip()] = qWidget
253
236
  qLabel.setAccessibleName(text)
254
237
 
255
- return
256
-
257
238
  def finalise(self) -> None:
258
239
  """Finalise the layout when the form is built."""
259
240
  self._layout.addSpacing(20)
260
241
  self._layout.addStretch(1)
261
- return
262
242
 
263
243
 
264
244
  class NColorLabel(QLabel):
265
- """Extension: A Coloured Label
245
+ """Extension: A Coloured Label.
266
246
 
267
247
  A custom widget that draws a label in a specific colour, and
268
248
  optionally at a specific size, and word wrapped.
@@ -298,21 +278,17 @@ class NColorLabel(QLabel):
298
278
  self.setWordWrap(wrap)
299
279
  self.setColorState(True)
300
280
 
301
- return
302
-
303
281
  def setTextColors(self, *, color: QColor | None = None, faded: QColor | None = None) -> None:
304
282
  """Set or update the text colours."""
305
283
  self._color = color or self._color
306
284
  self._faded = faded or self._faded
307
285
  self._refeshTextColor()
308
- return
309
286
 
310
287
  def setColorState(self, state: bool) -> None:
311
288
  """Change the colour state."""
312
289
  if self._state is not state:
313
290
  self._state = state
314
291
  self._refeshTextColor()
315
- return
316
292
 
317
293
  def _refeshTextColor(self) -> None:
318
294
  """Refresh the colour of the text on the label."""
@@ -322,11 +298,10 @@ class NColorLabel(QLabel):
322
298
  self._color if self._state else self._faded,
323
299
  )
324
300
  self.setPalette(palette)
325
- return
326
301
 
327
302
 
328
303
  class NWrappedWidgetBox(QHBoxLayout):
329
- """Extension: A Text-Wrapped Widget Box
304
+ """Extension: A Text-Wrapped Widget Box.
330
305
 
331
306
  A custom layout box where a widget is wrapped in text labels on
332
307
  either side within a layout box. The widget is inserted at the {0}
@@ -341,4 +316,3 @@ class NWrappedWidgetBox(QHBoxLayout):
341
316
  self.addWidget(widget)
342
317
  if after:
343
318
  self.addWidget(QLabel(after.lstrip()))
344
- return
@@ -21,7 +21,7 @@ General Public License for more details.
21
21
 
22
22
  You should have received a copy of the GNU General Public License
23
23
  along with this program. If not, see <https://www.gnu.org/licenses/>.
24
- """
24
+ """ # noqa
25
25
  from __future__ import annotations
26
26
 
27
27
  from typing import TYPE_CHECKING
@@ -34,7 +34,7 @@ if TYPE_CHECKING:
34
34
 
35
35
 
36
36
  class WheelEventFilter(QObject):
37
- """Extensions: Wheel Event Filter
37
+ """Extensions: Wheel Event Filter.
38
38
 
39
39
  An event filter that filters mouse wheel events for a widget and
40
40
  forward them to the root widget. This solves the lack of mouse wheel
@@ -50,7 +50,6 @@ class WheelEventFilter(QObject):
50
50
  super().__init__(parent=parent)
51
51
  self._parent = parent
52
52
  self._locked = False
53
- return
54
53
 
55
54
  def eventFilter(self, obj: QObject, event: QEvent) -> bool:
56
55
  """Filter events of type QWheelEvent and forward them to the
@@ -69,6 +68,7 @@ class WheelEventFilter(QObject):
69
68
 
70
69
 
71
70
  class StatusTipFilter(QObject):
71
+ """Filter: Remove StatusBar ToolTips."""
72
72
 
73
73
  def eventFilter(self, obj: QObject, event: QEvent) -> bool:
74
74
  """Filter out status tip events on menus."""