novelWriter 2.4.4__py3-none-any.whl → 2.5__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 (122) hide show
  1. {novelWriter-2.4.4.dist-info → novelWriter-2.5.dist-info}/METADATA +4 -5
  2. {novelWriter-2.4.4.dist-info → novelWriter-2.5.dist-info}/RECORD +121 -111
  3. {novelWriter-2.4.4.dist-info → novelWriter-2.5.dist-info}/WHEEL +1 -1
  4. novelwriter/__init__.py +33 -39
  5. novelwriter/assets/i18n/nw_de_DE.qm +0 -0
  6. novelwriter/assets/i18n/nw_en_US.qm +0 -0
  7. novelwriter/assets/i18n/nw_es_419.qm +0 -0
  8. novelwriter/assets/i18n/nw_fr_FR.qm +0 -0
  9. novelwriter/assets/i18n/nw_it_IT.qm +0 -0
  10. novelwriter/assets/i18n/nw_ja_JP.qm +0 -0
  11. novelwriter/assets/i18n/nw_nb_NO.qm +0 -0
  12. novelwriter/assets/i18n/nw_nl_NL.qm +0 -0
  13. novelwriter/assets/i18n/nw_pl_PL.qm +0 -0
  14. novelwriter/assets/i18n/nw_pt_BR.qm +0 -0
  15. novelwriter/assets/i18n/nw_zh_CN.qm +0 -0
  16. novelwriter/assets/i18n/project_en_GB.json +1 -0
  17. novelwriter/assets/i18n/project_pl_PL.json +116 -0
  18. novelwriter/assets/icons/typicons_dark/icons.conf +2 -0
  19. novelwriter/assets/icons/typicons_dark/nw_font.svg +4 -0
  20. novelwriter/assets/icons/typicons_dark/nw_quote.svg +4 -0
  21. novelwriter/assets/icons/typicons_light/icons.conf +2 -0
  22. novelwriter/assets/icons/typicons_light/nw_font.svg +4 -0
  23. novelwriter/assets/icons/typicons_light/nw_quote.svg +4 -0
  24. novelwriter/assets/manual.pdf +0 -0
  25. novelwriter/assets/sample.zip +0 -0
  26. novelwriter/assets/syntax/cyberpunk_night.conf +5 -3
  27. novelwriter/assets/syntax/default_dark.conf +32 -18
  28. novelwriter/assets/syntax/default_light.conf +24 -10
  29. novelwriter/assets/syntax/dracula.conf +44 -0
  30. novelwriter/assets/syntax/grey_dark.conf +5 -4
  31. novelwriter/assets/syntax/grey_light.conf +5 -4
  32. novelwriter/assets/syntax/light_owl.conf +7 -6
  33. novelwriter/assets/syntax/night_owl.conf +7 -6
  34. novelwriter/assets/syntax/snazzy.conf +42 -0
  35. novelwriter/assets/syntax/solarized_dark.conf +4 -3
  36. novelwriter/assets/syntax/solarized_light.conf +4 -3
  37. novelwriter/assets/syntax/tango.conf +27 -11
  38. novelwriter/assets/syntax/tomorrow.conf +6 -5
  39. novelwriter/assets/syntax/tomorrow_night.conf +7 -6
  40. novelwriter/assets/syntax/tomorrow_night_blue.conf +6 -5
  41. novelwriter/assets/syntax/tomorrow_night_bright.conf +6 -5
  42. novelwriter/assets/syntax/tomorrow_night_eighties.conf +6 -5
  43. novelwriter/assets/text/credits_en.htm +52 -41
  44. novelwriter/assets/themes/cyberpunk_night.conf +3 -0
  45. novelwriter/assets/themes/default_dark.conf +2 -0
  46. novelwriter/assets/themes/default_light.conf +2 -0
  47. novelwriter/assets/themes/dracula.conf +48 -0
  48. novelwriter/assets/themes/solarized_dark.conf +2 -0
  49. novelwriter/assets/themes/solarized_light.conf +2 -0
  50. novelwriter/common.py +33 -12
  51. novelwriter/config.py +184 -98
  52. novelwriter/constants.py +47 -35
  53. novelwriter/core/buildsettings.py +68 -69
  54. novelwriter/core/coretools.py +5 -23
  55. novelwriter/core/docbuild.py +52 -40
  56. novelwriter/core/document.py +3 -5
  57. novelwriter/core/index.py +115 -45
  58. novelwriter/core/item.py +8 -19
  59. novelwriter/core/options.py +2 -4
  60. novelwriter/core/project.py +37 -61
  61. novelwriter/core/projectdata.py +1 -3
  62. novelwriter/core/projectxml.py +12 -15
  63. novelwriter/core/sessions.py +3 -5
  64. novelwriter/core/spellcheck.py +4 -9
  65. novelwriter/core/status.py +211 -164
  66. novelwriter/core/storage.py +0 -8
  67. novelwriter/core/tohtml.py +139 -105
  68. novelwriter/core/tokenizer.py +278 -122
  69. novelwriter/core/{tomd.py → tomarkdown.py} +97 -78
  70. novelwriter/core/toodt.py +257 -166
  71. novelwriter/core/toqdoc.py +419 -0
  72. novelwriter/core/tree.py +5 -7
  73. novelwriter/dialogs/about.py +11 -18
  74. novelwriter/dialogs/docmerge.py +17 -19
  75. novelwriter/dialogs/docsplit.py +17 -19
  76. novelwriter/dialogs/editlabel.py +6 -10
  77. novelwriter/dialogs/preferences.py +200 -164
  78. novelwriter/dialogs/projectsettings.py +225 -189
  79. novelwriter/dialogs/quotes.py +12 -9
  80. novelwriter/dialogs/wordlist.py +9 -15
  81. novelwriter/enum.py +35 -30
  82. novelwriter/error.py +8 -15
  83. novelwriter/extensions/configlayout.py +55 -21
  84. novelwriter/extensions/eventfilters.py +1 -5
  85. novelwriter/extensions/modified.py +58 -14
  86. novelwriter/extensions/novelselector.py +1 -3
  87. novelwriter/extensions/pagedsidebar.py +9 -12
  88. novelwriter/extensions/{circularprogress.py → progressbars.py} +30 -8
  89. novelwriter/extensions/statusled.py +40 -26
  90. novelwriter/extensions/switch.py +4 -6
  91. novelwriter/extensions/switchbox.py +7 -6
  92. novelwriter/extensions/versioninfo.py +3 -9
  93. novelwriter/gui/doceditor.py +120 -139
  94. novelwriter/gui/dochighlight.py +231 -186
  95. novelwriter/gui/docviewer.py +69 -108
  96. novelwriter/gui/docviewerpanel.py +3 -10
  97. novelwriter/gui/editordocument.py +1 -3
  98. novelwriter/gui/itemdetails.py +7 -11
  99. novelwriter/gui/mainmenu.py +22 -18
  100. novelwriter/gui/noveltree.py +11 -24
  101. novelwriter/gui/outline.py +15 -26
  102. novelwriter/gui/projtree.py +35 -60
  103. novelwriter/gui/search.py +10 -3
  104. novelwriter/gui/sidebar.py +2 -6
  105. novelwriter/gui/statusbar.py +29 -37
  106. novelwriter/gui/theme.py +26 -48
  107. novelwriter/guimain.py +162 -160
  108. novelwriter/shared.py +36 -32
  109. novelwriter/text/patterns.py +113 -0
  110. novelwriter/tools/dictionaries.py +10 -20
  111. novelwriter/tools/lipsum.py +10 -16
  112. novelwriter/tools/manusbuild.py +9 -11
  113. novelwriter/tools/manuscript.py +71 -145
  114. novelwriter/tools/manussettings.py +71 -75
  115. novelwriter/tools/noveldetails.py +16 -21
  116. novelwriter/tools/welcome.py +21 -26
  117. novelwriter/tools/writingstats.py +9 -12
  118. novelwriter/types.py +49 -4
  119. novelwriter/extensions/simpleprogress.py +0 -55
  120. {novelWriter-2.4.4.dist-info → novelWriter-2.5.dist-info}/LICENSE.md +0 -0
  121. {novelWriter-2.4.4.dist-info → novelWriter-2.5.dist-info}/entry_points.txt +0 -0
  122. {novelWriter-2.4.4.dist-info → novelWriter-2.5.dist-info}/top_level.txt +0 -0
@@ -32,15 +32,16 @@ from typing import TYPE_CHECKING
32
32
  from PyQt5.QtCore import Qt, pyqtSlot
33
33
  from PyQt5.QtGui import QCloseEvent, QCursor, QPixmap
34
34
  from PyQt5.QtWidgets import (
35
- QAction, QApplication, QDialog, QDialogButtonBox, QFileDialog, QGridLayout,
35
+ QAction, QApplication, QDialogButtonBox, QFileDialog, QGridLayout,
36
36
  QGroupBox, QHBoxLayout, QLabel, QMenu, QSpinBox, QTreeWidget,
37
37
  QTreeWidgetItem
38
38
  )
39
39
 
40
40
  from novelwriter import CONFIG, SHARED
41
- from novelwriter.common import formatTime, checkInt, checkIntTuple, minmax
41
+ from novelwriter.common import checkInt, checkIntTuple, formatTime, minmax
42
42
  from novelwriter.constants import nwConst
43
43
  from novelwriter.error import formatException
44
+ from novelwriter.extensions.modified import NToolDialog
44
45
  from novelwriter.extensions.switch import NSwitch
45
46
  from novelwriter.types import (
46
47
  QtAlignLeftMiddle, QtAlignRight, QtAlignRightMiddle, QtDecoration,
@@ -53,7 +54,7 @@ if TYPE_CHECKING: # pragma: no cover
53
54
  logger = logging.getLogger(__name__)
54
55
 
55
56
 
56
- class GuiWritingStats(QDialog):
57
+ class GuiWritingStats(NToolDialog):
57
58
  """GUI Tools: Writing Statistics
58
59
 
59
60
  Displays data from the NWSessionLog object.
@@ -68,13 +69,11 @@ class GuiWritingStats(QDialog):
68
69
  FMT_JSON = 0
69
70
  FMT_CSV = 1
70
71
 
71
- def __init__(self, mainGui: GuiMain) -> None:
72
- super().__init__(parent=mainGui)
72
+ def __init__(self, parent: GuiMain) -> None:
73
+ super().__init__(parent=parent)
73
74
 
74
75
  logger.debug("Create: GuiWritingStats")
75
76
  self.setObjectName("GuiWritingStats")
76
- if CONFIG.osDarwin:
77
- self.setWindowFlag(Qt.WindowType.Tool)
78
77
 
79
78
  self.logData = []
80
79
  self.filterData = []
@@ -319,7 +318,7 @@ class GuiWritingStats(QDialog):
319
318
  def closeEvent(self, event: QCloseEvent) -> None:
320
319
  """Capture the user closing the window."""
321
320
  event.accept()
322
- self.deleteLater()
321
+ self.softDelete()
323
322
  return
324
323
 
325
324
  ##
@@ -385,14 +384,14 @@ class GuiWritingStats(QDialog):
385
384
  return False
386
385
 
387
386
  # Generate the file name
388
- savePath = CONFIG.lastPath() / f"sessionStats.{fileExt}"
387
+ savePath = CONFIG.lastPath("stats") / f"sessionStats.{fileExt}"
389
388
  savePath, _ = QFileDialog.getSaveFileName(
390
389
  self, self.tr("Save Data As"), str(savePath), f"{textFmt} (*.{fileExt})"
391
390
  )
392
391
  if not savePath:
393
392
  return False
394
393
 
395
- CONFIG.setLastPath(savePath)
394
+ CONFIG.setLastPath("stats", savePath)
396
395
 
397
396
  # Do the actual writing
398
397
  wSuccess = False
@@ -615,5 +614,3 @@ class GuiWritingStats(QDialog):
615
614
  self.labelFilter.setText(formatTime(round(self.timeFilter)))
616
615
 
617
616
  return
618
-
619
- # END Class GuiWritingStats
novelwriter/types.py CHANGED
@@ -23,9 +23,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
23
23
  """
24
24
  from __future__ import annotations
25
25
 
26
- from PyQt5.QtCore import Qt
27
- from PyQt5.QtGui import QColor, QPainter, QTextCursor
28
- from PyQt5.QtWidgets import QDialogButtonBox, QStyle
26
+ from PyQt5.QtCore import QRegularExpression, Qt
27
+ from PyQt5.QtGui import QColor, QFont, QPainter, QTextCharFormat, QTextCursor, QTextFormat
28
+ from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QSizePolicy, QStyle
29
29
 
30
30
  # Qt Alignment Flags
31
31
 
@@ -44,9 +44,19 @@ QtAlignRightMiddle = Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter
44
44
  QtAlignRightTop = Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTop
45
45
  QtAlignTop = Qt.AlignmentFlag.AlignTop
46
46
 
47
+ QtVAlignNormal = QTextCharFormat.VerticalAlignment.AlignNormal
48
+ QtVAlignSub = QTextCharFormat.VerticalAlignment.AlignSubScript
49
+ QtVAlignSuper = QTextCharFormat.VerticalAlignment.AlignSuperScript
50
+
51
+ # Qt Page Break
52
+
53
+ QtPageBreakBefore = QTextFormat.PageBreakFlag.PageBreak_AlwaysBefore
54
+ QtPageBreakAfter = QTextFormat.PageBreakFlag.PageBreak_AlwaysAfter
55
+
47
56
  # Qt Painter Types
48
57
 
49
58
  QtTransparent = QColor(0, 0, 0, 0)
59
+ QtBlack = QColor(0, 0, 0)
50
60
  QtNoBrush = Qt.BrushStyle.NoBrush
51
61
  QtNoPen = Qt.PenStyle.NoPen
52
62
  QtRoundCap = Qt.PenCapStyle.RoundCap
@@ -63,13 +73,16 @@ QtUserRole = Qt.ItemDataRole.UserRole
63
73
  # Keyboard and Mouse Buttons
64
74
 
65
75
  QtModCtrl = Qt.KeyboardModifier.ControlModifier
66
- QtModeNone = Qt.KeyboardModifier.NoModifier
76
+ QtModNone = Qt.KeyboardModifier.NoModifier
67
77
  QtModShift = Qt.KeyboardModifier.ShiftModifier
68
78
  QtMouseLeft = Qt.MouseButton.LeftButton
69
79
  QtMouseMiddle = Qt.MouseButton.MiddleButton
70
80
 
71
81
  # Dialog Button Box Types
72
82
 
83
+ QtAccepted = QDialog.DialogCode.Accepted
84
+ QtRejected = QDialog.DialogCode.Rejected
85
+
73
86
  QtDialogApply = QDialogButtonBox.StandardButton.Apply
74
87
  QtDialogCancel = QDialogButtonBox.StandardButton.Cancel
75
88
  QtDialogClose = QDialogButtonBox.StandardButton.Close
@@ -88,3 +101,35 @@ QtKeepAnchor = QTextCursor.MoveMode.KeepAnchor
88
101
  QtMoveAnchor = QTextCursor.MoveMode.MoveAnchor
89
102
  QtMoveLeft = QTextCursor.MoveOperation.Left
90
103
  QtMoveRight = QTextCursor.MoveOperation.Right
104
+
105
+ # Size Policy
106
+
107
+ QtSizeExpanding = QSizePolicy.Policy.Expanding
108
+ QtSizeFixed = QSizePolicy.Policy.Fixed
109
+ QtSizeIgnored = QSizePolicy.Policy.Ignored
110
+ QtSizeMinimum = QSizePolicy.Policy.Minimum
111
+ QtSizeMinimumExpanding = QSizePolicy.Policy.MinimumExpanding
112
+
113
+ # Other
114
+
115
+ QRegExUnicode = QRegularExpression.PatternOption.UseUnicodePropertiesOption
116
+
117
+ # Maps
118
+
119
+ FONT_WEIGHTS: dict[int, int] = {
120
+ QFont.Weight.Thin: 100,
121
+ QFont.Weight.ExtraLight: 200,
122
+ QFont.Weight.Light: 300,
123
+ QFont.Weight.Normal: 400,
124
+ QFont.Weight.Medium: 500,
125
+ QFont.Weight.DemiBold: 600,
126
+ QFont.Weight.Bold: 700,
127
+ QFont.Weight.ExtraBold: 800,
128
+ QFont.Weight.Black: 900,
129
+ }
130
+
131
+ FONT_STYLE: dict[int, str] = {
132
+ QFont.Style.StyleNormal: "normal",
133
+ QFont.Style.StyleItalic: "italic",
134
+ QFont.Style.StyleOblique: "oblique",
135
+ }
@@ -1,55 +0,0 @@
1
- """
2
- novelWriter – Custom Widget: Progress Simple
3
- ============================================
4
-
5
- File History:
6
- Created: 2023-06-09 [2.1b1]
7
-
8
- This file is a part of novelWriter
9
- Copyright 2018–2024, Veronica Berglyd Olsen
10
-
11
- This program is free software: you can redistribute it and/or modify
12
- it under the terms of the GNU General Public License as published by
13
- the Free Software Foundation, either version 3 of the License, or
14
- (at your option) any later version.
15
-
16
- This program is distributed in the hope that it will be useful, but
17
- WITHOUT ANY WARRANTY; without even the implied warranty of
18
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
- General Public License for more details.
20
-
21
- You should have received a copy of the GNU General Public License
22
- along with this program. If not, see <https://www.gnu.org/licenses/>.
23
- """
24
- from __future__ import annotations
25
-
26
- from math import ceil
27
-
28
- from PyQt5.QtGui import QPaintEvent, QPainter
29
- from PyQt5.QtWidgets import QProgressBar, QWidget
30
-
31
- from novelwriter.types import QtPaintAnitAlias
32
-
33
-
34
- class NProgressSimple(QProgressBar):
35
- """Extension: Simple Progress Widget
36
-
37
- A custom widget that paints a plain bar with no other styling.
38
- """
39
-
40
- def __init__(self, parent: QWidget) -> None:
41
- super().__init__(parent=parent)
42
- return
43
-
44
- def paintEvent(self, event: QPaintEvent) -> None:
45
- """Custom painter for the progress bar."""
46
- if (value := self.value()) > 0:
47
- progress = ceil(self.width()*float(value)/self.maximum())
48
- painter = QPainter(self)
49
- painter.setRenderHint(QtPaintAnitAlias, True)
50
- painter.setPen(self.palette().highlight().color())
51
- painter.setBrush(self.palette().highlight())
52
- painter.drawRect(0, 0, progress, self.height())
53
- return
54
-
55
- # END Class NProgressSimple