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.
- {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/METADATA +5 -6
- {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/RECORD +102 -95
- novelwriter/__init__.py +7 -7
- novelwriter/assets/icons/none.svg +4 -0
- novelwriter/assets/icons/typicons_dark/icons.conf +4 -0
- novelwriter/assets/icons/typicons_dark/nw_tb-mark.svg +7 -0
- novelwriter/assets/icons/typicons_dark/typ_refresh-flipped.svg +1 -1
- novelwriter/assets/icons/typicons_dark/typ_refresh.svg +1 -1
- novelwriter/assets/icons/typicons_dark/typ_search-grey.svg +4 -0
- novelwriter/assets/icons/typicons_dark/typ_times.svg +1 -1
- novelwriter/assets/icons/typicons_dark/typ_unfold-hidden.svg +4 -0
- novelwriter/assets/icons/typicons_dark/typ_unfold-visible.svg +4 -0
- novelwriter/assets/icons/typicons_light/icons.conf +4 -0
- novelwriter/assets/icons/typicons_light/nw_tb-mark.svg +7 -0
- novelwriter/assets/icons/typicons_light/typ_refresh-flipped.svg +1 -1
- novelwriter/assets/icons/typicons_light/typ_refresh.svg +1 -1
- novelwriter/assets/icons/typicons_light/typ_search-grey.svg +4 -0
- novelwriter/assets/icons/typicons_light/typ_times.svg +1 -1
- novelwriter/assets/icons/typicons_light/typ_unfold-hidden.svg +4 -0
- novelwriter/assets/icons/typicons_light/typ_unfold-visible.svg +4 -0
- novelwriter/assets/manual.pdf +0 -0
- novelwriter/assets/sample.zip +0 -0
- novelwriter/assets/syntax/default_dark.conf +1 -0
- novelwriter/assets/syntax/default_light.conf +1 -0
- novelwriter/assets/syntax/grey_dark.conf +1 -0
- novelwriter/assets/syntax/grey_light.conf +1 -0
- novelwriter/assets/syntax/light_owl.conf +1 -0
- novelwriter/assets/syntax/night_owl.conf +1 -0
- novelwriter/assets/syntax/solarized_dark.conf +1 -0
- novelwriter/assets/syntax/solarized_light.conf +1 -0
- novelwriter/assets/syntax/tomorrow.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night_blue.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night_bright.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night_eighties.conf +1 -0
- novelwriter/assets/text/credits_en.htm +25 -23
- novelwriter/common.py +7 -2
- novelwriter/config.py +43 -16
- novelwriter/constants.py +5 -6
- novelwriter/core/buildsettings.py +60 -40
- novelwriter/core/coretools.py +97 -13
- novelwriter/core/docbuild.py +74 -7
- novelwriter/core/document.py +24 -3
- novelwriter/core/index.py +31 -112
- novelwriter/core/project.py +10 -15
- novelwriter/core/sessions.py +2 -2
- novelwriter/core/status.py +6 -5
- novelwriter/core/storage.py +8 -2
- novelwriter/core/tohtml.py +22 -25
- novelwriter/core/tokenizer.py +416 -232
- novelwriter/core/tomd.py +17 -8
- novelwriter/core/toodt.py +385 -350
- novelwriter/core/tree.py +8 -8
- novelwriter/dialogs/about.py +9 -11
- novelwriter/dialogs/docmerge.py +17 -14
- novelwriter/dialogs/docsplit.py +20 -19
- novelwriter/dialogs/editlabel.py +5 -4
- novelwriter/dialogs/preferences.py +31 -39
- novelwriter/dialogs/projectsettings.py +29 -26
- novelwriter/dialogs/quotes.py +10 -9
- novelwriter/dialogs/wordlist.py +15 -12
- novelwriter/enum.py +17 -14
- novelwriter/error.py +13 -11
- novelwriter/extensions/circularprogress.py +12 -8
- novelwriter/extensions/configlayout.py +1 -3
- novelwriter/extensions/modified.py +51 -2
- novelwriter/extensions/pagedsidebar.py +16 -14
- novelwriter/extensions/simpleprogress.py +3 -1
- novelwriter/extensions/statusled.py +3 -1
- novelwriter/extensions/switch.py +10 -9
- novelwriter/extensions/switchbox.py +14 -13
- novelwriter/extensions/versioninfo.py +1 -1
- novelwriter/gui/doceditor.py +413 -478
- novelwriter/gui/dochighlight.py +33 -29
- novelwriter/gui/docviewer.py +162 -175
- novelwriter/gui/docviewerpanel.py +20 -37
- novelwriter/gui/editordocument.py +15 -4
- novelwriter/gui/itemdetails.py +51 -54
- novelwriter/gui/mainmenu.py +37 -16
- novelwriter/gui/noveltree.py +30 -36
- novelwriter/gui/outline.py +114 -92
- novelwriter/gui/projtree.py +60 -66
- novelwriter/gui/search.py +362 -0
- novelwriter/gui/sidebar.py +36 -45
- novelwriter/gui/statusbar.py +14 -14
- novelwriter/gui/theme.py +93 -28
- novelwriter/guimain.py +207 -200
- novelwriter/shared.py +31 -6
- novelwriter/text/counting.py +137 -0
- novelwriter/tools/dictionaries.py +13 -12
- novelwriter/tools/lipsum.py +20 -17
- novelwriter/tools/manusbuild.py +35 -27
- novelwriter/tools/manuscript.py +374 -90
- novelwriter/tools/manussettings.py +261 -124
- novelwriter/tools/noveldetails.py +20 -18
- novelwriter/tools/welcome.py +48 -44
- novelwriter/tools/writingstats.py +61 -55
- novelwriter/types.py +90 -0
- novelwriter/core/__init__.py +0 -3
- novelwriter/dialogs/__init__.py +0 -3
- novelwriter/extensions/__init__.py +0 -3
- novelwriter/gui/__init__.py +0 -3
- novelwriter/tools/__init__.py +0 -3
- {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/LICENSE.md +0 -0
- {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/WHEEL +0 -0
- {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/entry_points.txt +0 -0
- {novelWriter-2.3.1.dist-info → novelWriter-2.4rc1.dist-info}/top_level.txt +0 -0
novelwriter/gui/dochighlight.py
CHANGED
@@ -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
|
-
"
|
94
|
-
"
|
95
|
-
"
|
96
|
-
"
|
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(
|
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(
|
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(
|
303
|
+
elif text.startswith(("# ", "#! ", "## ", "##! ", "### ", "###! ", "#### ")):
|
304
|
+
self.setCurrentBlockState(BLOCK_TITLE)
|
305
305
|
|
306
|
-
if text.startswith("# "): #
|
307
|
-
self.setFormat(0, 1, self._hStyles["
|
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("## "): #
|
311
|
-
self.setFormat(0, 2, self._hStyles["
|
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("### "): #
|
315
|
-
self.setFormat(0, 3, self._hStyles["
|
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("#### "): #
|
319
|
-
self.setFormat(0, 4, self._hStyles["
|
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["
|
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["
|
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(
|
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(
|
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)))
|