novelWriter 2.3.1__py3-none-any.whl → 2.4rc1__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 (107) hide show
  1. {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/METADATA +5 -6
  2. {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/RECORD +102 -95
  3. novelwriter/__init__.py +7 -7
  4. novelwriter/assets/icons/none.svg +4 -0
  5. novelwriter/assets/icons/typicons_dark/icons.conf +4 -0
  6. novelwriter/assets/icons/typicons_dark/nw_tb-mark.svg +7 -0
  7. novelwriter/assets/icons/typicons_dark/typ_refresh-flipped.svg +1 -1
  8. novelwriter/assets/icons/typicons_dark/typ_refresh.svg +1 -1
  9. novelwriter/assets/icons/typicons_dark/typ_search-grey.svg +4 -0
  10. novelwriter/assets/icons/typicons_dark/typ_times.svg +1 -1
  11. novelwriter/assets/icons/typicons_dark/typ_unfold-hidden.svg +4 -0
  12. novelwriter/assets/icons/typicons_dark/typ_unfold-visible.svg +4 -0
  13. novelwriter/assets/icons/typicons_light/icons.conf +4 -0
  14. novelwriter/assets/icons/typicons_light/nw_tb-mark.svg +7 -0
  15. novelwriter/assets/icons/typicons_light/typ_refresh-flipped.svg +1 -1
  16. novelwriter/assets/icons/typicons_light/typ_refresh.svg +1 -1
  17. novelwriter/assets/icons/typicons_light/typ_search-grey.svg +4 -0
  18. novelwriter/assets/icons/typicons_light/typ_times.svg +1 -1
  19. novelwriter/assets/icons/typicons_light/typ_unfold-hidden.svg +4 -0
  20. novelwriter/assets/icons/typicons_light/typ_unfold-visible.svg +4 -0
  21. novelwriter/assets/manual.pdf +0 -0
  22. novelwriter/assets/sample.zip +0 -0
  23. novelwriter/assets/syntax/default_dark.conf +1 -0
  24. novelwriter/assets/syntax/default_light.conf +1 -0
  25. novelwriter/assets/syntax/grey_dark.conf +1 -0
  26. novelwriter/assets/syntax/grey_light.conf +1 -0
  27. novelwriter/assets/syntax/light_owl.conf +1 -0
  28. novelwriter/assets/syntax/night_owl.conf +1 -0
  29. novelwriter/assets/syntax/solarized_dark.conf +1 -0
  30. novelwriter/assets/syntax/solarized_light.conf +1 -0
  31. novelwriter/assets/syntax/tomorrow.conf +1 -0
  32. novelwriter/assets/syntax/tomorrow_night.conf +1 -0
  33. novelwriter/assets/syntax/tomorrow_night_blue.conf +1 -0
  34. novelwriter/assets/syntax/tomorrow_night_bright.conf +1 -0
  35. novelwriter/assets/syntax/tomorrow_night_eighties.conf +1 -0
  36. novelwriter/assets/text/credits_en.htm +25 -23
  37. novelwriter/common.py +7 -2
  38. novelwriter/config.py +43 -16
  39. novelwriter/constants.py +5 -6
  40. novelwriter/core/buildsettings.py +60 -40
  41. novelwriter/core/coretools.py +97 -13
  42. novelwriter/core/docbuild.py +74 -7
  43. novelwriter/core/document.py +24 -3
  44. novelwriter/core/index.py +31 -112
  45. novelwriter/core/project.py +10 -15
  46. novelwriter/core/sessions.py +2 -2
  47. novelwriter/core/status.py +6 -5
  48. novelwriter/core/storage.py +8 -2
  49. novelwriter/core/tohtml.py +22 -25
  50. novelwriter/core/tokenizer.py +416 -232
  51. novelwriter/core/tomd.py +17 -8
  52. novelwriter/core/toodt.py +385 -350
  53. novelwriter/core/tree.py +8 -8
  54. novelwriter/dialogs/about.py +9 -11
  55. novelwriter/dialogs/docmerge.py +17 -14
  56. novelwriter/dialogs/docsplit.py +20 -19
  57. novelwriter/dialogs/editlabel.py +5 -4
  58. novelwriter/dialogs/preferences.py +31 -39
  59. novelwriter/dialogs/projectsettings.py +29 -26
  60. novelwriter/dialogs/quotes.py +10 -9
  61. novelwriter/dialogs/wordlist.py +15 -12
  62. novelwriter/enum.py +17 -14
  63. novelwriter/error.py +13 -11
  64. novelwriter/extensions/circularprogress.py +12 -8
  65. novelwriter/extensions/configlayout.py +1 -3
  66. novelwriter/extensions/modified.py +51 -2
  67. novelwriter/extensions/pagedsidebar.py +16 -14
  68. novelwriter/extensions/simpleprogress.py +3 -1
  69. novelwriter/extensions/statusled.py +3 -1
  70. novelwriter/extensions/switch.py +10 -9
  71. novelwriter/extensions/switchbox.py +14 -13
  72. novelwriter/extensions/versioninfo.py +1 -1
  73. novelwriter/gui/doceditor.py +413 -478
  74. novelwriter/gui/dochighlight.py +33 -29
  75. novelwriter/gui/docviewer.py +162 -175
  76. novelwriter/gui/docviewerpanel.py +20 -37
  77. novelwriter/gui/editordocument.py +15 -4
  78. novelwriter/gui/itemdetails.py +51 -54
  79. novelwriter/gui/mainmenu.py +37 -16
  80. novelwriter/gui/noveltree.py +30 -36
  81. novelwriter/gui/outline.py +114 -92
  82. novelwriter/gui/projtree.py +60 -66
  83. novelwriter/gui/search.py +362 -0
  84. novelwriter/gui/sidebar.py +36 -45
  85. novelwriter/gui/statusbar.py +14 -14
  86. novelwriter/gui/theme.py +93 -28
  87. novelwriter/guimain.py +207 -200
  88. novelwriter/shared.py +31 -6
  89. novelwriter/text/counting.py +137 -0
  90. novelwriter/tools/dictionaries.py +13 -12
  91. novelwriter/tools/lipsum.py +20 -17
  92. novelwriter/tools/manusbuild.py +35 -27
  93. novelwriter/tools/manuscript.py +374 -90
  94. novelwriter/tools/manussettings.py +261 -124
  95. novelwriter/tools/noveldetails.py +20 -18
  96. novelwriter/tools/welcome.py +48 -44
  97. novelwriter/tools/writingstats.py +61 -55
  98. novelwriter/types.py +90 -0
  99. novelwriter/core/__init__.py +0 -3
  100. novelwriter/dialogs/__init__.py +0 -3
  101. novelwriter/extensions/__init__.py +0 -3
  102. novelwriter/gui/__init__.py +0 -3
  103. novelwriter/tools/__init__.py +0 -3
  104. {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/LICENSE.md +0 -0
  105. {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/WHEEL +0 -0
  106. {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/entry_points.txt +0 -0
  107. {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/top_level.txt +0 -0
@@ -45,16 +45,16 @@ logger = logging.getLogger(__name__)
45
45
  SPELLRX = QRegularExpression(r"\b[^\s\-\+\/–—\[\]:]+\b")
46
46
  SPELLRX.setPatternOptions(QRegularExpression.UseUnicodePropertiesOption)
47
47
 
48
+ BLOCK_NONE = 0
49
+ BLOCK_TEXT = 1
50
+ BLOCK_META = 2
51
+ BLOCK_TITLE = 4
52
+
48
53
 
49
54
  class GuiDocHighlighter(QSyntaxHighlighter):
50
55
 
51
56
  __slots__ = ("_tItem", "_tHandle", "_spellCheck", "_spellErr", "_hRules", "_hStyles")
52
57
 
53
- BLOCK_NONE = 0
54
- BLOCK_TEXT = 1
55
- BLOCK_META = 2
56
- BLOCK_TITLE = 4
57
-
58
58
  def __init__(self, document: QTextDocument) -> None:
59
59
  super().__init__(document)
60
60
 
@@ -90,10 +90,10 @@ class GuiDocHighlighter(QSyntaxHighlighter):
90
90
  "header2": self._makeFormat(SHARED.theme.colHead, "bold", 1.6),
91
91
  "header3": self._makeFormat(SHARED.theme.colHead, "bold", 1.4),
92
92
  "header4": self._makeFormat(SHARED.theme.colHead, "bold", 1.2),
93
- "header1h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.8),
94
- "header2h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.6),
95
- "header3h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.4),
96
- "header4h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.2),
93
+ "head1h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.8),
94
+ "head2h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.6),
95
+ "head3h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.4),
96
+ "head4h": self._makeFormat(SHARED.theme.colHeadH, "bold", 1.2),
97
97
  "bold": self._makeFormat(colEmph, "bold"),
98
98
  "italic": self._makeFormat(colEmph, "italic"),
99
99
  "strike": self._makeFormat(SHARED.theme.colHidden, "strike"),
@@ -116,7 +116,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
116
116
  # Cache Spell Error Format
117
117
  self._spellErr = QTextCharFormat()
118
118
  self._spellErr.setUnderlineColor(SHARED.theme.colSpell)
119
- self._spellErr.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
119
+ self._spellErr.setUnderlineStyle(QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
120
120
 
121
121
  # Multiple or Trailing Spaces
122
122
  if CONFIG.showMultiSpaces:
@@ -272,12 +272,12 @@ class GuiDocHighlighter(QSyntaxHighlighter):
272
272
  is significantly faster than running the regex checks used for
273
273
  text paragraphs.
274
274
  """
275
- self.setCurrentBlockState(self.BLOCK_NONE)
275
+ self.setCurrentBlockState(BLOCK_NONE)
276
276
  if self._tHandle is None or not text:
277
277
  return
278
278
 
279
279
  if text.startswith("@"): # Keywords and commands
280
- self.setCurrentBlockState(self.BLOCK_META)
280
+ self.setCurrentBlockState(BLOCK_META)
281
281
  index = SHARED.project.index
282
282
  isValid, bits, pos = index.scanThis(text)
283
283
  isGood = index.checkThese(bits, self._tHandle)
@@ -300,35 +300,39 @@ class GuiDocHighlighter(QSyntaxHighlighter):
300
300
  # so we force a return here
301
301
  return
302
302
 
303
- elif text.startswith(("# ", "#! ", "## ", "##! ", "### ", "#### ")):
304
- self.setCurrentBlockState(self.BLOCK_TITLE)
303
+ elif text.startswith(("# ", "#! ", "## ", "##! ", "### ", "###! ", "#### ")):
304
+ self.setCurrentBlockState(BLOCK_TITLE)
305
305
 
306
- if text.startswith("# "): # Header 1
307
- self.setFormat(0, 1, self._hStyles["header1h"])
306
+ if text.startswith("# "): # Heading 1
307
+ self.setFormat(0, 1, self._hStyles["head1h"])
308
308
  self.setFormat(1, len(text), self._hStyles["header1"])
309
309
 
310
- elif text.startswith("## "): # Header 2
311
- self.setFormat(0, 2, self._hStyles["header2h"])
310
+ elif text.startswith("## "): # Heading 2
311
+ self.setFormat(0, 2, self._hStyles["head2h"])
312
312
  self.setFormat(2, len(text), self._hStyles["header2"])
313
313
 
314
- elif text.startswith("### "): # Header 3
315
- self.setFormat(0, 3, self._hStyles["header3h"])
314
+ elif text.startswith("### "): # Heading 3
315
+ self.setFormat(0, 3, self._hStyles["head3h"])
316
316
  self.setFormat(3, len(text), self._hStyles["header3"])
317
317
 
318
- elif text.startswith("#### "): # Header 4
319
- self.setFormat(0, 4, self._hStyles["header4h"])
318
+ elif text.startswith("#### "): # Heading 4
319
+ self.setFormat(0, 4, self._hStyles["head4h"])
320
320
  self.setFormat(4, len(text), self._hStyles["header4"])
321
321
 
322
322
  elif text.startswith("#! "): # Title
323
- self.setFormat(0, 2, self._hStyles["header1h"])
323
+ self.setFormat(0, 2, self._hStyles["head1h"])
324
324
  self.setFormat(2, len(text), self._hStyles["header1"])
325
325
 
326
326
  elif text.startswith("##! "): # Unnumbered
327
- self.setFormat(0, 3, self._hStyles["header2h"])
327
+ self.setFormat(0, 3, self._hStyles["head2h"])
328
328
  self.setFormat(3, len(text), self._hStyles["header2"])
329
329
 
330
+ elif text.startswith("###! "): # Hard Scene
331
+ self.setFormat(0, 4, self._hStyles["head3h"])
332
+ self.setFormat(4, len(text), self._hStyles["header3"])
333
+
330
334
  elif text.startswith("%"): # Comments
331
- self.setCurrentBlockState(self.BLOCK_TEXT)
335
+ self.setCurrentBlockState(BLOCK_TEXT)
332
336
  cStyle, _, cPos = processComment(text)
333
337
  if cStyle == nwComment.PLAIN:
334
338
  self.setFormat(0, len(text), self._hStyles["hidden"])
@@ -353,7 +357,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
353
357
  return
354
358
 
355
359
  # Regular Text
356
- self.setCurrentBlockState(self.BLOCK_TEXT)
360
+ self.setCurrentBlockState(BLOCK_TEXT)
357
361
  for rX, xFmt in self.rxRules:
358
362
  rxItt = rX.globalMatch(text, 0)
359
363
  while rxItt.hasNext():
@@ -398,16 +402,16 @@ class GuiDocHighlighter(QSyntaxHighlighter):
398
402
  if style is not None:
399
403
  styles = style.split(",")
400
404
  if "bold" in styles:
401
- charFormat.setFontWeight(QFont.Bold)
405
+ charFormat.setFontWeight(QFont.Weight.Bold)
402
406
  if "italic" in styles:
403
407
  charFormat.setFontItalic(True)
404
408
  if "strike" in styles:
405
409
  charFormat.setFontStrikeOut(True)
406
410
  if "errline" in styles:
407
411
  charFormat.setUnderlineColor(SHARED.theme.colError)
408
- charFormat.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
412
+ charFormat.setUnderlineStyle(QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
409
413
  if "background" in styles and color is not None:
410
- charFormat.setBackground(QBrush(color, Qt.SolidPattern))
414
+ charFormat.setBackground(QBrush(color, Qt.BrushStyle.SolidPattern))
411
415
 
412
416
  if size is not None:
413
417
  charFormat.setFontPointSize(int(round(size*CONFIG.textSize)))