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/core/tree.py CHANGED
@@ -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
  import logging
@@ -50,7 +50,7 @@ MAX_DEPTH = 999 # Cap of tree traversing for loops (recursion limit)
50
50
 
51
51
 
52
52
  class NWTree:
53
- """Core: Project Tree Data Class
53
+ """Core: Project Tree Data Class.
54
54
 
55
55
  Only one instance of this class should exist in the project class.
56
56
  This class holds all the project items of the project as instances
@@ -71,18 +71,16 @@ class NWTree:
71
71
  self._trash = None
72
72
  self._ready = False
73
73
  logger.debug("Ready: NWTree")
74
- return
75
74
 
76
75
  def __del__(self) -> None: # pragma: no cover
77
76
  logger.debug("Delete: NWTree")
78
- return
79
77
 
80
78
  def __len__(self) -> int:
81
- """The number of items in the project."""
79
+ """Return the number of items in the project."""
82
80
  return len(self._items)
83
81
 
84
82
  def __bool__(self) -> bool:
85
- """True if there are any items in the project."""
83
+ """Return True if there are any items in the project."""
86
84
  return bool(self._items)
87
85
 
88
86
  def __getitem__(self, tHandle: str | None) -> NWItem | None:
@@ -91,11 +89,11 @@ class NWTree:
91
89
  """
92
90
  if tHandle and tHandle in self._items:
93
91
  return self._items[tHandle]
94
- logger.error("No tree item with handle '%s'", str(tHandle))
92
+ logger.error("No tree item with handle '%s'", tHandle)
95
93
  return None
96
94
 
97
95
  def __contains__(self, tHandle: str) -> bool:
98
- """Checks if a handle exists in the tree."""
96
+ """Check if a handle exists in the tree."""
99
97
  return tHandle in self._items
100
98
 
101
99
  def __iter__(self) -> Iterator[NWItem]:
@@ -142,7 +140,6 @@ class NWTree:
142
140
  self._trash = None
143
141
  oldModel.deleteLater()
144
142
  del oldModel
145
- return
146
143
 
147
144
  def add(self, item: NWItem, pos: int = -1) -> bool:
148
145
  """Add a project item into the project tree."""
@@ -260,8 +257,6 @@ class NWTree:
260
257
  self._model.endInsertRows()
261
258
  self._model.layoutChanged.emit()
262
259
 
263
- return
264
-
265
260
  def pickParent(self, sNode: ProjectNode, hLevel: int, isNote: bool) -> tuple[str | None, int]:
266
261
  """Pick an appropriate parent handle for adding a new item."""
267
262
  if sNode.item.isFolderType() or sNode.item.isRootType():
@@ -299,7 +294,6 @@ class NWTree:
299
294
  indexE = self._model.indexFromNode(node, 3)
300
295
  self._model.dataChanged.emit(indexS, indexE)
301
296
  self._itemChange(node.item, nwChange.UPDATE)
302
- return
303
297
 
304
298
  def refreshAllItems(self) -> None:
305
299
  """Refresh all items in the tree."""
@@ -309,13 +303,11 @@ class NWTree:
309
303
  self._model.root.refresh()
310
304
  self._model.root.updateCount(propagate=False)
311
305
  self._model.layoutChanged.emit()
312
- return
313
306
 
314
307
  def novelStructureChanged(self, tHandle: str) -> None:
315
308
  """Emit a novel structure change signal."""
316
309
  if self._ready:
317
310
  SHARED.novelStructureChanged.emit(tHandle)
318
- return
319
311
 
320
312
  def checkConsistency(self, prefix: str) -> tuple[int, int]:
321
313
  """Check the project tree consistency. Also check the content
@@ -496,7 +488,6 @@ class NWTree:
496
488
  SHARED.emitProjectItemChanged(self._project, tHandle, change)
497
489
  if item.isRootType():
498
490
  SHARED.emitRootFolderChanged(self._project, tHandle, change)
499
- return
500
491
 
501
492
  def _getTrashNode(self) -> ProjectNode | None:
502
493
  """Get the trash node. If it doesn't exist, create it."""
@@ -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
@@ -33,10 +33,11 @@ from PyQt6.QtWidgets import (
33
33
 
34
34
  from novelwriter import CONFIG, SHARED
35
35
  from novelwriter.common import readTextFile
36
+ from novelwriter.enum import nwStandardButton
36
37
  from novelwriter.extensions.configlayout import NColorLabel
37
38
  from novelwriter.extensions.modified import NDialog
38
39
  from novelwriter.extensions.versioninfo import VersionInfoWidget
39
- from novelwriter.types import QtAlignRightTop, QtDialogClose, QtHexArgb
40
+ from novelwriter.types import QtAlignRightTop, QtHexArgb, QtRoleDestruct
40
41
 
41
42
  if TYPE_CHECKING:
42
43
  from PyQt6.QtGui import QCloseEvent
@@ -45,6 +46,7 @@ logger = logging.getLogger(__name__)
45
46
 
46
47
 
47
48
  class GuiAbout(NDialog):
49
+ """GUI: About novelWriter Dialog."""
48
50
 
49
51
  def __init__(self, parent: QWidget) -> None:
50
52
  super().__init__(parent=parent)
@@ -81,8 +83,11 @@ class GuiAbout(NDialog):
81
83
  self.txtCredits.setViewportMargins(0, 8, 8, 0)
82
84
 
83
85
  # Buttons
84
- self.btnBox = QDialogButtonBox(QtDialogClose, self)
85
- self.btnBox.rejected.connect(self.reject)
86
+ self.btnClose = SHARED.theme.getStandardButton(nwStandardButton.CLOSE, self)
87
+ self.btnClose.clicked.connect(self.reject)
88
+
89
+ self.btnBox = QDialogButtonBox(self)
90
+ self.btnBox.addButton(self.btnClose, QtRoleDestruct)
86
91
 
87
92
  # Assemble
88
93
  self.innerBox = QVBoxLayout()
@@ -109,11 +114,8 @@ class GuiAbout(NDialog):
109
114
 
110
115
  logger.debug("Ready: GuiAbout")
111
116
 
112
- return
113
-
114
117
  def __del__(self) -> None: # pragma: no cover
115
118
  logger.debug("Delete: GuiAbout")
116
- return
117
119
 
118
120
  ##
119
121
  # Events
@@ -123,7 +125,6 @@ class GuiAbout(NDialog):
123
125
  """Capture the close event and perform cleanup."""
124
126
  event.accept()
125
127
  self.softDelete()
126
- return
127
128
 
128
129
  ##
129
130
  # Internal Functions
@@ -135,7 +136,6 @@ class GuiAbout(NDialog):
135
136
  self.txtCredits.setHtml(html)
136
137
  else:
137
138
  self.txtCredits.setHtml("Error loading credits text ...")
138
- return
139
139
 
140
140
  def _setStyleSheet(self) -> None:
141
141
  """Set stylesheet text document."""
@@ -143,4 +143,3 @@ class GuiAbout(NDialog):
143
143
  self.txtCredits.setStyleSheet(
144
144
  f"QTextBrowser {{border: none; background: {baseCol};}} "
145
145
  )
146
- 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
  import logging
@@ -33,15 +33,17 @@ from PyQt6.QtWidgets import (
33
33
  )
34
34
 
35
35
  from novelwriter import SHARED
36
+ from novelwriter.enum import nwStandardButton
36
37
  from novelwriter.extensions.configlayout import NColorLabel
37
38
  from novelwriter.extensions.modified import NDialog
38
39
  from novelwriter.extensions.switch import NSwitch
39
- from novelwriter.types import QtAccepted, QtDialogCancel, QtDialogOk, QtDialogReset, QtUserRole
40
+ from novelwriter.types import QtAccepted, QtRoleAccept, QtRoleReject, QtRoleReset, QtUserRole
40
41
 
41
42
  logger = logging.getLogger(__name__)
42
43
 
43
44
 
44
45
  class GuiDocMerge(NDialog):
46
+ """GUI: Document Merge Tool."""
45
47
 
46
48
  D_HANDLE = QtUserRole
47
49
 
@@ -84,13 +86,19 @@ class GuiDocMerge(NDialog):
84
86
  self.optBox.setColumnStretch(2, 1)
85
87
 
86
88
  # Buttons
87
- self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
88
- self.buttonBox.accepted.connect(self.accept)
89
- self.buttonBox.rejected.connect(self.reject)
89
+ self.btnOk = SHARED.theme.getStandardButton(nwStandardButton.OK, self)
90
+ self.btnOk.clicked.connect(self.accept)
91
+
92
+ self.btnCancel = SHARED.theme.getStandardButton(nwStandardButton.CANCEL, self)
93
+ self.btnCancel.clicked.connect(self.reject)
90
94
 
91
- self.resetButton = self.buttonBox.addButton(QtDialogReset)
92
- if self.resetButton:
93
- self.resetButton.clicked.connect(self._resetList)
95
+ self.btnReset = SHARED.theme.getStandardButton(nwStandardButton.RESET, self)
96
+ self.btnReset.clicked.connect(self._resetList)
97
+
98
+ self.btnBox = QDialogButtonBox(self)
99
+ self.btnBox.addButton(self.btnOk, QtRoleAccept)
100
+ self.btnBox.addButton(self.btnCancel, QtRoleReject)
101
+ self.btnBox.addButton(self.btnReset, QtRoleReset)
94
102
 
95
103
  # Assemble
96
104
  self.outerBox = QVBoxLayout()
@@ -102,7 +110,7 @@ class GuiDocMerge(NDialog):
102
110
  self.outerBox.addSpacing(8)
103
111
  self.outerBox.addLayout(self.optBox)
104
112
  self.outerBox.addSpacing(12)
105
- self.outerBox.addWidget(self.buttonBox)
113
+ self.outerBox.addWidget(self.btnBox)
106
114
  self.setLayout(self.outerBox)
107
115
 
108
116
  # Load Content
@@ -110,11 +118,8 @@ class GuiDocMerge(NDialog):
110
118
 
111
119
  logger.debug("Ready: GuiDocMerge")
112
120
 
113
- return
114
-
115
121
  def __del__(self) -> None: # pragma: no cover
116
122
  logger.debug("Delete: GuiDocMerge")
117
- return
118
123
 
119
124
  def data(self) -> dict:
120
125
  """Return the user's choices."""
@@ -150,7 +155,6 @@ class GuiDocMerge(NDialog):
150
155
  if sHandle := self._data.get("sHandle"):
151
156
  itemList = self._data.get("origItems", [])
152
157
  self._loadContent(sHandle, itemList)
153
- return
154
158
 
155
159
  ##
156
160
  # Internal Functions
@@ -170,4 +174,3 @@ class GuiDocMerge(NDialog):
170
174
  item.setData(self.D_HANDLE, tHandle)
171
175
  item.setCheckState(Qt.CheckState.Checked)
172
176
  self.listBox.addItem(item)
173
- return
@@ -21,27 +21,29 @@ 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
  import logging
28
28
 
29
29
  from PyQt6.QtCore import pyqtSlot
30
30
  from PyQt6.QtWidgets import (
31
- QAbstractItemView, QComboBox, QDialogButtonBox, QGridLayout, QLabel,
32
- QListWidget, QListWidgetItem, QVBoxLayout, QWidget
31
+ QAbstractItemView, QDialogButtonBox, QGridLayout, QLabel, QListWidget,
32
+ QListWidgetItem, QVBoxLayout, QWidget
33
33
  )
34
34
 
35
35
  from novelwriter import SHARED
36
+ from novelwriter.enum import nwStandardButton
36
37
  from novelwriter.extensions.configlayout import NColorLabel
37
- from novelwriter.extensions.modified import NDialog
38
+ from novelwriter.extensions.modified import NComboBox, NDialog
38
39
  from novelwriter.extensions.switch import NSwitch
39
- from novelwriter.types import QtAccepted, QtDialogCancel, QtDialogOk, QtUserRole
40
+ from novelwriter.types import QtAccepted, QtRoleAccept, QtRoleReject, QtUserRole
40
41
 
41
42
  logger = logging.getLogger(__name__)
42
43
 
43
44
 
44
45
  class GuiDocSplit(NDialog):
46
+ """GUI: Document Split Tool."""
45
47
 
46
48
  LINE_ROLE = QtUserRole
47
49
  LEVEL_ROLE = QtUserRole + 1
@@ -79,7 +81,7 @@ class GuiDocSplit(NDialog):
79
81
  self.listBox.setMinimumWidth(400)
80
82
  self.listBox.setMinimumHeight(180)
81
83
 
82
- self.splitLevel = QComboBox(self)
84
+ self.splitLevel = NComboBox(self)
83
85
  self.splitLevel.addItem(self.tr("Split on Heading Level 1 (Partition)"), 1)
84
86
  self.splitLevel.addItem(self.tr("Split up to Heading Level 2 (Chapter)"), 2)
85
87
  self.splitLevel.addItem(self.tr("Split up to Heading Level 3 (Scene)"), 3)
@@ -116,9 +118,15 @@ class GuiDocSplit(NDialog):
116
118
  self.optBox.setColumnStretch(3, 1)
117
119
 
118
120
  # Buttons
119
- self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
120
- self.buttonBox.accepted.connect(self.accept)
121
- self.buttonBox.rejected.connect(self.reject)
121
+ self.btnOk = SHARED.theme.getStandardButton(nwStandardButton.OK, self)
122
+ self.btnOk.clicked.connect(self.accept)
123
+
124
+ self.btnCancel = SHARED.theme.getStandardButton(nwStandardButton.CANCEL, self)
125
+ self.btnCancel.clicked.connect(self.reject)
126
+
127
+ self.btnBox = QDialogButtonBox(self)
128
+ self.btnBox.addButton(self.btnOk, QtRoleAccept)
129
+ self.btnBox.addButton(self.btnCancel, QtRoleReject)
122
130
 
123
131
  # Assemble
124
132
  self.outerBox = QVBoxLayout()
@@ -131,7 +139,7 @@ class GuiDocSplit(NDialog):
131
139
  self.outerBox.addSpacing(8)
132
140
  self.outerBox.addLayout(self.optBox)
133
141
  self.outerBox.addSpacing(12)
134
- self.outerBox.addWidget(self.buttonBox)
142
+ self.outerBox.addWidget(self.btnBox)
135
143
  self.setLayout(self.outerBox)
136
144
 
137
145
  # Load Content
@@ -139,11 +147,8 @@ class GuiDocSplit(NDialog):
139
147
 
140
148
  logger.debug("Ready: GuiDocSplit")
141
149
 
142
- return
143
-
144
150
  def __del__(self) -> None: # pragma: no cover
145
151
  logger.debug("Delete: GuiDocSplit")
146
- return
147
152
 
148
153
  def data(self) -> tuple[dict, list[str]]:
149
154
  """Return the user's choices. Also save the users options for
@@ -197,7 +202,6 @@ class GuiDocSplit(NDialog):
197
202
  """Reload the content of the list box."""
198
203
  if sHandle := self._data.get("sHandle"):
199
204
  self._loadContent(sHandle)
200
- return
201
205
 
202
206
  ##
203
207
  # Internal Functions
@@ -20,20 +20,23 @@ 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
27
27
 
28
28
  from PyQt6.QtWidgets import QDialogButtonBox, QHBoxLayout, QLabel, QLineEdit, QVBoxLayout, QWidget
29
29
 
30
+ from novelwriter import SHARED
31
+ from novelwriter.enum import nwStandardButton
30
32
  from novelwriter.extensions.modified import NDialog
31
- from novelwriter.types import QtAccepted, QtDialogCancel, QtDialogOk
33
+ from novelwriter.types import QtAccepted, QtRoleAccept, QtRoleReject
32
34
 
33
35
  logger = logging.getLogger(__name__)
34
36
 
35
37
 
36
38
  class GuiEditLabel(NDialog):
39
+ """GUI: Edit Item Label Dialog."""
37
40
 
38
41
  def __init__(self, parent: QWidget, text: str = "") -> None:
39
42
  super().__init__(parent=parent)
@@ -53,9 +56,15 @@ class GuiEditLabel(NDialog):
53
56
  self.lblValue.setBuddy(self.lblValue)
54
57
 
55
58
  # Buttons
56
- self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
57
- self.buttonBox.accepted.connect(self.accept)
58
- self.buttonBox.rejected.connect(self.reject)
59
+ self.btnOk = SHARED.theme.getStandardButton(nwStandardButton.OK, self)
60
+ self.btnOk.clicked.connect(self.accept)
61
+
62
+ self.btnCancel = SHARED.theme.getStandardButton(nwStandardButton.CANCEL, self)
63
+ self.btnCancel.clicked.connect(self.reject)
64
+
65
+ self.btnBox = QDialogButtonBox(self)
66
+ self.btnBox.addButton(self.btnOk, QtRoleAccept)
67
+ self.btnBox.addButton(self.btnCancel, QtRoleReject)
59
68
 
60
69
  # Assemble
61
70
  self.innerBox = QHBoxLayout()
@@ -66,17 +75,14 @@ class GuiEditLabel(NDialog):
66
75
  self.outerBox = QVBoxLayout()
67
76
  self.outerBox.setSpacing(12)
68
77
  self.outerBox.addLayout(self.innerBox, 1)
69
- self.outerBox.addWidget(self.buttonBox, 0)
78
+ self.outerBox.addWidget(self.btnBox, 0)
70
79
 
71
80
  self.setLayout(self.outerBox)
72
81
 
73
82
  logger.debug("Ready: GuiEditLabel")
74
83
 
75
- return
76
-
77
84
  def __del__(self) -> None: # pragma: no cover
78
85
  logger.debug("Delete: GuiEditLabel")
79
- return
80
86
 
81
87
  @property
82
88
  def itemLabel(self) -> str: