novelWriter 2.7.5__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 +160 -225
  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 +23 -13
  169. {novelwriter-2.7.5.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.5.dist-info/RECORD +0 -163
  192. {novelwriter-2.7.5.dist-info → novelwriter-2.8b1.dist-info}/WHEEL +0 -0
  193. {novelwriter-2.7.5.dist-info → novelwriter-2.8b1.dist-info}/entry_points.txt +0 -0
  194. {novelwriter-2.7.5.dist-info → novelwriter-2.8b1.dist-info}/licenses/LICENSE.md +0 -0
  195. {novelwriter-2.7.5.dist-info → novelwriter-2.8b1.dist-info}/licenses/setup/LICENSE-Apache-2.0.txt +0 -0
  196. {novelwriter-2.7.5.dist-info → novelwriter-2.8b1.dist-info}/top_level.txt +0 -0
@@ -23,7 +23,7 @@ General Public License for more details.
23
23
 
24
24
  You should have received a copy of the GNU General Public License
25
25
  along with this program. If not, see <https://www.gnu.org/licenses/>.
26
- """
26
+ """ # noqa
27
27
  from __future__ import annotations
28
28
 
29
29
  import logging
@@ -53,13 +53,15 @@ from novelwriter.formats.toqdoc import ToQTextDocument
53
53
  from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
54
54
  from novelwriter.types import (
55
55
  QtAlignCenterTop, QtKeepAnchor, QtMouseLeft, QtMoveAnchor,
56
- QtScrollAlwaysOff, QtScrollAsNeeded
56
+ QtScrollAlwaysOff, QtScrollAsNeeded, QtSelectBlock, QtSelectDocument,
57
+ QtSelectWord
57
58
  )
58
59
 
59
60
  logger = logging.getLogger(__name__)
60
61
 
61
62
 
62
63
  class GuiDocViewer(QTextBrowser):
64
+ """GUI: Document Viewer."""
63
65
 
64
66
  closeDocumentRequest = pyqtSignal()
65
67
  documentLoaded = pyqtSignal(str)
@@ -110,8 +112,6 @@ class GuiDocViewer(QTextBrowser):
110
112
 
111
113
  logger.debug("Ready: GuiDocViewer")
112
114
 
113
- return
114
-
115
115
  ##
116
116
  # Properties
117
117
  ##
@@ -138,13 +138,12 @@ class GuiDocViewer(QTextBrowser):
138
138
  self.setSearchPaths([""])
139
139
  self._docHandle = None
140
140
  self.docHeader.clearHeader()
141
- return
142
141
 
143
142
  def updateTheme(self) -> None:
144
143
  """Update theme elements."""
144
+ logger.debug("Theme Update: GuiDocViewer")
145
145
  self.docHeader.updateTheme()
146
146
  self.docFooter.updateTheme()
147
- return
148
147
 
149
148
  def initViewer(self) -> None:
150
149
  """Set editor settings from main config."""
@@ -206,8 +205,6 @@ class GuiDocViewer(QTextBrowser):
206
205
  # If we have a document open, we should reload it in case the font changed
207
206
  self.reloadText()
208
207
 
209
- return
210
-
211
208
  def loadText(self, tHandle: str, updateHistory: bool = True) -> bool:
212
209
  """Load text into the viewer from an item handle."""
213
210
  if not SHARED.project.tree.checkType(tHandle, nwItemType.FILE):
@@ -228,11 +225,11 @@ class GuiDocViewer(QTextBrowser):
228
225
  qDoc.setTheme(self._docTheme)
229
226
  qDoc.initDocument()
230
227
  qDoc.setKeywords(True)
231
- qDoc.setCommentType(nwComment.NOTE, CONFIG.viewComments)
232
- qDoc.setCommentType(nwComment.STORY, CONFIG.viewComments)
233
228
  qDoc.setCommentType(nwComment.PLAIN, CONFIG.viewComments)
234
229
  qDoc.setCommentType(nwComment.SYNOPSIS, CONFIG.viewSynopsis)
235
230
  qDoc.setCommentType(nwComment.SHORT, CONFIG.viewSynopsis)
231
+ qDoc.setCommentType(nwComment.STORY, CONFIG.viewNotes)
232
+ qDoc.setCommentType(nwComment.NOTE, CONFIG.viewNotes)
236
233
 
237
234
  # Be extra careful here to prevent crashes when first opening a
238
235
  # project as a crash here leaves no way of recovering.
@@ -280,7 +277,6 @@ class GuiDocViewer(QTextBrowser):
280
277
  """Reload the text in the current document."""
281
278
  if self._docHandle:
282
279
  self.loadText(self._docHandle, updateHistory=False)
283
- return
284
280
 
285
281
  def docAction(self, action: nwDocAction) -> bool:
286
282
  """Process document actions on the current document."""
@@ -293,11 +289,11 @@ class GuiDocViewer(QTextBrowser):
293
289
  elif action == nwDocAction.COPY:
294
290
  self.copy()
295
291
  elif action == nwDocAction.SEL_ALL:
296
- self._makeSelection(QTextCursor.SelectionType.Document)
292
+ self._makeSelection(QtSelectDocument)
297
293
  elif action == nwDocAction.SEL_PARA:
298
- self._makeSelection(QTextCursor.SelectionType.BlockUnderCursor)
294
+ self._makeSelection(QtSelectBlock)
299
295
  else:
300
- logger.debug("Unknown or unsupported document action '%s'", str(action))
296
+ logger.debug("Unknown or unsupported document action '%s'", action)
301
297
  return False
302
298
  return True
303
299
 
@@ -308,7 +304,6 @@ class GuiDocViewer(QTextBrowser):
308
304
  def clearNavHistory(self) -> None:
309
305
  """Clear the navigation history."""
310
306
  self.docHistory.clear()
311
- return
312
307
 
313
308
  def updateDocMargins(self) -> None:
314
309
  """Automatically adjust the margins so the text is centred."""
@@ -337,8 +332,6 @@ class GuiDocViewer(QTextBrowser):
337
332
  self.docFooter.setGeometry(tB, fY, tW, fH)
338
333
  self.setViewportMargins(tM, max(cM, tH), tM, max(cM, fH))
339
334
 
340
- return
341
-
342
335
  ##
343
336
  # Setters
344
337
  ##
@@ -347,7 +340,6 @@ class GuiDocViewer(QTextBrowser):
347
340
  """Set the scrollbar position."""
348
341
  if (vBar := self.verticalScrollBar()) and vBar.isVisible():
349
342
  vBar.setValue(pos)
350
- return
351
343
 
352
344
  ##
353
345
  # Public Slots
@@ -359,7 +351,6 @@ class GuiDocViewer(QTextBrowser):
359
351
  if tHandle == self._docHandle and change == nwChange.UPDATE:
360
352
  self.docHeader.setHandle(tHandle)
361
353
  self.updateDocMargins()
362
- return
363
354
 
364
355
  @pyqtSlot(str)
365
356
  def navigateTo(self, anchor: str) -> None:
@@ -367,7 +358,6 @@ class GuiDocViewer(QTextBrowser):
367
358
  if isinstance(anchor, str) and anchor.startswith("#"):
368
359
  logger.debug("Moving to anchor '%s'", anchor)
369
360
  self.setSource(QUrl(anchor))
370
- return
371
361
 
372
362
  ##
373
363
  # Private Slots
@@ -377,13 +367,11 @@ class GuiDocViewer(QTextBrowser):
377
367
  def navBackward(self) -> None:
378
368
  """Navigate backwards in the document view history."""
379
369
  self.docHistory.backward()
380
- return
381
370
 
382
371
  @pyqtSlot()
383
372
  def navForward(self) -> None:
384
373
  """Navigate forwards in the document view history."""
385
374
  self.docHistory.forward()
386
- return
387
375
 
388
376
  @pyqtSlot("QUrl")
389
377
  def _linkClicked(self, url: QUrl) -> None:
@@ -396,7 +384,6 @@ class GuiDocViewer(QTextBrowser):
396
384
  self.navigateTo(link)
397
385
  elif link.startswith("http"):
398
386
  QDesktopServices.openUrl(QUrl(url))
399
- return
400
387
 
401
388
  @pyqtSlot("QPoint")
402
389
  def _openContextMenu(self, point: QPoint) -> None:
@@ -415,14 +402,10 @@ class GuiDocViewer(QTextBrowser):
415
402
  action.triggered.connect(qtLambda(self.docAction, nwDocAction.SEL_ALL))
416
403
 
417
404
  action = qtAddAction(ctxMenu, self.tr("Select Word"))
418
- action.triggered.connect(qtLambda(
419
- self._makePosSelection, QTextCursor.SelectionType.WordUnderCursor, point
420
- ))
405
+ action.triggered.connect(qtLambda(self._makePosSelection, QtSelectWord, point))
421
406
 
422
407
  action = qtAddAction(ctxMenu, self.tr("Select Paragraph"))
423
- action.triggered.connect(qtLambda(
424
- self._makePosSelection, QTextCursor.SelectionType.BlockUnderCursor, point
425
- ))
408
+ action.triggered.connect(qtLambda(self._makePosSelection, QtSelectBlock, point))
426
409
 
427
410
  # Open the context menu
428
411
  if viewport := self.viewport():
@@ -430,8 +413,6 @@ class GuiDocViewer(QTextBrowser):
430
413
 
431
414
  ctxMenu.setParent(None)
432
415
 
433
- return
434
-
435
416
  ##
436
417
  # Events
437
418
  ##
@@ -440,7 +421,6 @@ class GuiDocViewer(QTextBrowser):
440
421
  """Update document margins when widget is resized."""
441
422
  self.updateDocMargins()
442
423
  super().resizeEvent(event)
443
- return
444
424
 
445
425
  def mouseReleaseEvent(self, event: QMouseEvent) -> None:
446
426
  """Capture mouse click events on the document."""
@@ -450,7 +430,6 @@ class GuiDocViewer(QTextBrowser):
450
430
  self.navForward()
451
431
  else:
452
432
  super().mouseReleaseEvent(event)
453
- return
454
433
 
455
434
  def dragEnterEvent(self, event: QDragEnterEvent) -> None:
456
435
  """Overload drag enter event to handle dragged items."""
@@ -458,7 +437,6 @@ class GuiDocViewer(QTextBrowser):
458
437
  event.acceptProposedAction()
459
438
  else:
460
439
  super().dragEnterEvent(event)
461
- return
462
440
 
463
441
  def dragMoveEvent(self, event: QDragMoveEvent) -> None:
464
442
  """Overload drag move event to handle dragged items."""
@@ -466,7 +444,6 @@ class GuiDocViewer(QTextBrowser):
466
444
  event.acceptProposedAction()
467
445
  else:
468
446
  super().dragMoveEvent(event)
469
- return
470
447
 
471
448
  def dropEvent(self, event: QDropEvent) -> None:
472
449
  """Overload drop event to handle dragged items."""
@@ -476,7 +453,6 @@ class GuiDocViewer(QTextBrowser):
476
453
  self.openDocumentRequest.emit(handles[0], nwDocMode.VIEW, "", True)
477
454
  else:
478
455
  super().dropEvent(event)
479
- return
480
456
 
481
457
  ##
482
458
  # Internal Functions
@@ -488,7 +464,7 @@ class GuiDocViewer(QTextBrowser):
488
464
  cursor.clearSelection()
489
465
  cursor.select(selType)
490
466
 
491
- if selType == QTextCursor.SelectionType.BlockUnderCursor:
467
+ if selType == QtSelectBlock:
492
468
  # This selection mode also selects the preceding paragraph
493
469
  # separator, which we want to avoid.
494
470
  posS = cursor.selectionStart()
@@ -500,16 +476,18 @@ class GuiDocViewer(QTextBrowser):
500
476
 
501
477
  self.setTextCursor(cursor)
502
478
 
503
- return
504
-
505
479
  def _makePosSelection(self, selType: QTextCursor.SelectionType, pos: QPoint) -> None:
506
480
  """Handle text selection at a given location."""
507
481
  self.setTextCursor(self.cursorForPosition(pos))
508
482
  self._makeSelection(selType)
509
- return
510
483
 
511
484
 
512
485
  class GuiDocViewHistory:
486
+ """GUI: Document Viewer History.
487
+
488
+ This class holds the navigation history for the viewer panel, which
489
+ is used for backward/forward navigation.
490
+ """
513
491
 
514
492
  def __init__(self, docViewer: GuiDocViewer) -> None:
515
493
  self.docViewer = docViewer
@@ -517,7 +495,6 @@ class GuiDocViewHistory:
517
495
  self._posHistory = []
518
496
  self._currPos = -1
519
497
  self._prevPos = -1
520
- return
521
498
 
522
499
  def clear(self) -> None:
523
500
  """Clear the view history."""
@@ -526,7 +503,6 @@ class GuiDocViewHistory:
526
503
  self._posHistory = []
527
504
  self._currPos = -1
528
505
  self._prevPos = -1
529
- return
530
506
 
531
507
  def append(self, tHandle: str) -> bool:
532
508
  """Append a document handle and its scroll bar position to the
@@ -566,7 +542,6 @@ class GuiDocViewHistory:
566
542
  self._currPos = newPos
567
543
  self._updateNavButtons()
568
544
  self._dumpHistory()
569
- return
570
545
 
571
546
  def backward(self) -> None:
572
547
  """Navigate to the previous entry in the view history."""
@@ -580,7 +555,6 @@ class GuiDocViewHistory:
580
555
  self._currPos = newPos
581
556
  self._updateNavButtons()
582
557
  self._dumpHistory()
583
- return
584
558
 
585
559
  ##
586
560
  # Internal Functions
@@ -590,12 +564,10 @@ class GuiDocViewHistory:
590
564
  """Update the scrollbar position of the previous entry."""
591
565
  if self._prevPos >= 0 and self._prevPos < len(self._posHistory):
592
566
  self._posHistory[self._prevPos] = self.docViewer.scrollPosition
593
- return
594
567
 
595
568
  def _updateNavButtons(self) -> None:
596
569
  """Update the navigation buttons in the document header."""
597
570
  self.docViewer.docHeader.updateNavButtons(0, len(self._navHistory) - 1, self._currPos)
598
- return
599
571
 
600
572
  def _truncateHistory(self, atPos: int) -> None:
601
573
  """Truncate the navigation history to the given position. Also
@@ -606,7 +578,6 @@ class GuiDocViewHistory:
606
578
  self._posHistory = self._posHistory[nSkip:atPos + 1]
607
579
  self._currPos -= nSkip
608
580
  self._prevPos -= nSkip
609
- return
610
581
 
611
582
  def _dumpHistory(self) -> None:
612
583
  """Debug function to dump history to the logger. Since it is a
@@ -616,11 +587,10 @@ class GuiDocViewHistory:
616
587
  for i, (h, p) in enumerate(zip(self._navHistory, self._posHistory, strict=False)):
617
588
  a = ">" if i == self._currPos else " "
618
589
  logger.debug(f"History {i + 1:02d}: {a} {h:13s} [x:{p}]")
619
- return
620
590
 
621
591
 
622
592
  class GuiDocViewHeader(QWidget):
623
- """The Embedded Document Header
593
+ """The Embedded Document Header.
624
594
 
625
595
  Only used by DocViewer, and is at a fixed position in the
626
596
  QTextBrowser's viewport.
@@ -711,8 +681,6 @@ class GuiDocViewHeader(QWidget):
711
681
 
712
682
  logger.debug("Ready: GuiDocViewHeader")
713
683
 
714
- return
715
-
716
684
  ##
717
685
  # Methods
718
686
  ##
@@ -730,7 +698,6 @@ class GuiDocViewHeader(QWidget):
730
698
  self.editButton.setVisible(False)
731
699
  self.refreshButton.setVisible(False)
732
700
  self.closeButton.setVisible(False)
733
- return
734
701
 
735
702
  def setOutline(self, data: dict[str, tuple[str, int]]) -> None:
736
703
  """Set the document outline dataset."""
@@ -750,22 +717,22 @@ class GuiDocViewHeader(QWidget):
750
717
  lambda _, title=title: self.docViewer.navigateTo(f"#{tHandle}:{title}")
751
718
  )
752
719
  self._docOutline = data
753
- return
754
720
 
755
721
  def updateFont(self) -> None:
756
722
  """Update the font settings."""
757
723
  self.setFont(SHARED.theme.guiFont)
758
724
  self.itemTitle.setFont(SHARED.theme.guiFontSmall)
759
- return
760
725
 
761
726
  def updateTheme(self) -> None:
762
727
  """Update theme elements."""
763
- self.outlineButton.setThemeIcon("list", "blue")
764
- self.backButton.setThemeIcon("chevron_left", "blue")
765
- self.forwardButton.setThemeIcon("chevron_right", "blue")
766
- self.editButton.setThemeIcon("edit", "green")
767
- self.refreshButton.setThemeIcon("refresh", "green")
768
- self.closeButton.setThemeIcon("close", "red")
728
+ logger.debug("Theme Update: GuiDocViewHeader")
729
+
730
+ self.outlineButton.setThemeIcon("list", "action")
731
+ self.backButton.setThemeIcon("chevron_left", "action")
732
+ self.forwardButton.setThemeIcon("chevron_right", "action")
733
+ self.editButton.setThemeIcon("edit", "change")
734
+ self.refreshButton.setThemeIcon("refresh", "change")
735
+ self.closeButton.setThemeIcon("close", "reject")
769
736
 
770
737
  buttonStyle = SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON)
771
738
  self.outlineButton.setStyleSheet(buttonStyle)
@@ -777,8 +744,6 @@ class GuiDocViewHeader(QWidget):
777
744
 
778
745
  self.matchColors()
779
746
 
780
- return
781
-
782
747
  def matchColors(self) -> None:
783
748
  """Update the colours of the widget to match those of the syntax
784
749
  theme rather than the main GUI.
@@ -792,15 +757,13 @@ class GuiDocViewHeader(QWidget):
792
757
  self.itemTitle.setTextColors(
793
758
  color=palette.windowText().color(), faded=SHARED.theme.fadedText
794
759
  )
795
- return
796
760
 
797
761
  def changeFocusState(self, state: bool) -> None:
798
762
  """Toggle focus state."""
799
763
  self.itemTitle.setColorState(state)
800
- return
801
764
 
802
765
  def setHandle(self, tHandle: str) -> None:
803
- """Sets the document title from the handle, or alternatively,
766
+ """Set the document title from the handle, or alternatively,
804
767
  set the whole document path.
805
768
  """
806
769
  self._docHandle = tHandle
@@ -819,13 +782,10 @@ class GuiDocViewHeader(QWidget):
819
782
  self.refreshButton.setVisible(True)
820
783
  self.closeButton.setVisible(True)
821
784
 
822
- return
823
-
824
785
  def updateNavButtons(self, firstIdx: int, lastIdx: int, currIdx: int) -> None:
825
786
  """Enable and disable nav buttons based on index in history."""
826
787
  self.backButton.setEnabled(currIdx > firstIdx)
827
788
  self.forwardButton.setEnabled(currIdx < lastIdx)
828
- return
829
789
 
830
790
  ##
831
791
  # Private Slots
@@ -836,20 +796,17 @@ class GuiDocViewHeader(QWidget):
836
796
  """Trigger the close editor/viewer on the main window."""
837
797
  self.clearHeader()
838
798
  self.docViewer.closeDocumentRequest.emit()
839
- return
840
799
 
841
800
  @pyqtSlot()
842
801
  def _refreshDocument(self) -> None:
843
802
  """Reload the content of the document."""
844
803
  self.docViewer.reloadDocumentRequest.emit()
845
- return
846
804
 
847
805
  @pyqtSlot()
848
806
  def _editDocument(self) -> None:
849
807
  """Open the document in the editor."""
850
808
  if tHandle := self._docHandle:
851
809
  self.docViewer.openDocumentRequest.emit(tHandle, nwDocMode.EDIT, "", True)
852
- return
853
810
 
854
811
  ##
855
812
  # Events
@@ -861,11 +818,10 @@ class GuiDocViewHeader(QWidget):
861
818
  """
862
819
  if event.button() == QtMouseLeft:
863
820
  self.docViewer.requestProjectItemSelected.emit(self._docHandle, True)
864
- return
865
821
 
866
822
 
867
823
  class GuiDocViewFooter(QWidget):
868
- """The Embedded Document Footer
824
+ """The Embedded Document Footer.
869
825
 
870
826
  Only used by DocViewer, and is at a fixed position in the
871
827
  QTextBrowser's viewport.
@@ -913,12 +869,23 @@ class GuiDocViewFooter(QWidget):
913
869
  self.showSynopsis.toggled.connect(self._doToggleSynopsis)
914
870
  self.showSynopsis.setToolTip(self.tr("Show Synopsis Comments"))
915
871
 
872
+ # Show Notes
873
+ self.showNotes = QToolButton(self)
874
+ self.showNotes.setText(self.tr("Notes"))
875
+ self.showNotes.setCheckable(True)
876
+ self.showNotes.setChecked(CONFIG.viewNotes)
877
+ self.showNotes.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
878
+ self.showNotes.setIconSize(iSz)
879
+ self.showNotes.toggled.connect(self._doToggleNotes)
880
+ self.showNotes.setToolTip(self.tr("Show Notes"))
881
+
916
882
  # Assemble Layout
917
883
  self.outerBox = QHBoxLayout()
918
884
  self.outerBox.addWidget(self.showHide, 0)
919
885
  self.outerBox.addStretch(1)
920
886
  self.outerBox.addWidget(self.showComments, 0)
921
887
  self.outerBox.addWidget(self.showSynopsis, 0)
888
+ self.outerBox.addWidget(self.showNotes, 0)
922
889
  self.outerBox.setSpacing(4)
923
890
  self.setLayout(self.outerBox)
924
891
 
@@ -933,8 +900,6 @@ class GuiDocViewFooter(QWidget):
933
900
 
934
901
  logger.debug("Ready: GuiDocViewFooter")
935
902
 
936
- return
937
-
938
903
  ##
939
904
  # Methods
940
905
  ##
@@ -944,27 +909,28 @@ class GuiDocViewFooter(QWidget):
944
909
  self.setFont(SHARED.theme.guiFont)
945
910
  self.showComments.setFont(SHARED.theme.guiFontSmall)
946
911
  self.showSynopsis.setFont(SHARED.theme.guiFontSmall)
947
- return
912
+ self.showNotes.setFont(SHARED.theme.guiFontSmall)
948
913
 
949
914
  def updateTheme(self) -> None:
950
915
  """Update theme elements."""
951
- # Icons
916
+ logger.debug("Theme Update: GuiDocViewFooter")
917
+
952
918
  fPx = int(0.9*SHARED.theme.fontPixelSize)
953
- bulletIcon = SHARED.theme.getToggleIcon("bullet", (fPx, fPx), "blue")
919
+ bulletIcon = SHARED.theme.getToggleIcon("bullet", (fPx, fPx), "action")
954
920
 
955
- self.showHide.setThemeIcon("panel")
921
+ self.showHide.setThemeIcon("panel", "default")
956
922
  self.showComments.setIcon(bulletIcon)
957
923
  self.showSynopsis.setIcon(bulletIcon)
924
+ self.showNotes.setIcon(bulletIcon)
958
925
 
959
926
  buttonStyle = SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON)
960
927
  self.showHide.setStyleSheet(buttonStyle)
961
928
  self.showComments.setStyleSheet(buttonStyle)
962
929
  self.showSynopsis.setStyleSheet(buttonStyle)
930
+ self.showNotes.setStyleSheet(buttonStyle)
963
931
 
964
932
  self.matchColors()
965
933
 
966
- return
967
-
968
934
  def matchColors(self) -> None:
969
935
  """Update the colours of the widget to match those of the syntax
970
936
  theme rather than the main GUI.
@@ -975,7 +941,6 @@ class GuiDocViewFooter(QWidget):
975
941
  palette.setColor(QPalette.ColorRole.WindowText, syntax.text)
976
942
  palette.setColor(QPalette.ColorRole.Text, syntax.text)
977
943
  self.setPalette(palette)
978
- return
979
944
 
980
945
  ##
981
946
  # Private Slots
@@ -986,11 +951,15 @@ class GuiDocViewFooter(QWidget):
986
951
  """Toggle the view comment button and reload the document."""
987
952
  CONFIG.viewComments = state
988
953
  self.docViewer.reloadText()
989
- return
990
954
 
991
955
  @pyqtSlot(bool)
992
956
  def _doToggleSynopsis(self, state: bool) -> None:
993
957
  """Toggle the view synopsis button and reload the document."""
994
958
  CONFIG.viewSynopsis = state
995
959
  self.docViewer.reloadText()
996
- return
960
+
961
+ @pyqtSlot(bool)
962
+ def _doToggleNotes(self, state: bool) -> None:
963
+ """Toggle the view notes button and reload the document."""
964
+ CONFIG.viewNotes = state
965
+ self.docViewer.reloadText()