novelWriter 2.4.3__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 (123) hide show
  1. {novelWriter-2.4.3.dist-info → novelWriter-2.5.dist-info}/METADATA +4 -5
  2. {novelWriter-2.4.3.dist-info → novelWriter-2.5.dist-info}/RECORD +122 -112
  3. {novelWriter-2.4.3.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/i18n/project_pt_BR.json +74 -74
  19. novelwriter/assets/icons/typicons_dark/icons.conf +2 -0
  20. novelwriter/assets/icons/typicons_dark/nw_font.svg +4 -0
  21. novelwriter/assets/icons/typicons_dark/nw_quote.svg +4 -0
  22. novelwriter/assets/icons/typicons_light/icons.conf +2 -0
  23. novelwriter/assets/icons/typicons_light/nw_font.svg +4 -0
  24. novelwriter/assets/icons/typicons_light/nw_quote.svg +4 -0
  25. novelwriter/assets/manual.pdf +0 -0
  26. novelwriter/assets/sample.zip +0 -0
  27. novelwriter/assets/syntax/cyberpunk_night.conf +5 -3
  28. novelwriter/assets/syntax/default_dark.conf +32 -18
  29. novelwriter/assets/syntax/default_light.conf +24 -10
  30. novelwriter/assets/syntax/dracula.conf +44 -0
  31. novelwriter/assets/syntax/grey_dark.conf +5 -4
  32. novelwriter/assets/syntax/grey_light.conf +5 -4
  33. novelwriter/assets/syntax/light_owl.conf +7 -6
  34. novelwriter/assets/syntax/night_owl.conf +7 -6
  35. novelwriter/assets/syntax/snazzy.conf +42 -0
  36. novelwriter/assets/syntax/solarized_dark.conf +4 -3
  37. novelwriter/assets/syntax/solarized_light.conf +4 -3
  38. novelwriter/assets/syntax/tango.conf +27 -11
  39. novelwriter/assets/syntax/tomorrow.conf +6 -5
  40. novelwriter/assets/syntax/tomorrow_night.conf +7 -6
  41. novelwriter/assets/syntax/tomorrow_night_blue.conf +6 -5
  42. novelwriter/assets/syntax/tomorrow_night_bright.conf +6 -5
  43. novelwriter/assets/syntax/tomorrow_night_eighties.conf +6 -5
  44. novelwriter/assets/text/credits_en.htm +52 -41
  45. novelwriter/assets/themes/cyberpunk_night.conf +3 -0
  46. novelwriter/assets/themes/default_dark.conf +2 -0
  47. novelwriter/assets/themes/default_light.conf +2 -0
  48. novelwriter/assets/themes/dracula.conf +48 -0
  49. novelwriter/assets/themes/solarized_dark.conf +2 -0
  50. novelwriter/assets/themes/solarized_light.conf +2 -0
  51. novelwriter/common.py +33 -12
  52. novelwriter/config.py +184 -98
  53. novelwriter/constants.py +47 -35
  54. novelwriter/core/buildsettings.py +68 -69
  55. novelwriter/core/coretools.py +5 -23
  56. novelwriter/core/docbuild.py +52 -40
  57. novelwriter/core/document.py +3 -5
  58. novelwriter/core/index.py +115 -45
  59. novelwriter/core/item.py +8 -19
  60. novelwriter/core/options.py +2 -4
  61. novelwriter/core/project.py +37 -61
  62. novelwriter/core/projectdata.py +1 -3
  63. novelwriter/core/projectxml.py +12 -15
  64. novelwriter/core/sessions.py +3 -5
  65. novelwriter/core/spellcheck.py +4 -9
  66. novelwriter/core/status.py +211 -164
  67. novelwriter/core/storage.py +0 -8
  68. novelwriter/core/tohtml.py +139 -105
  69. novelwriter/core/tokenizer.py +278 -122
  70. novelwriter/core/{tomd.py → tomarkdown.py} +97 -78
  71. novelwriter/core/toodt.py +257 -166
  72. novelwriter/core/toqdoc.py +419 -0
  73. novelwriter/core/tree.py +5 -7
  74. novelwriter/dialogs/about.py +11 -18
  75. novelwriter/dialogs/docmerge.py +17 -19
  76. novelwriter/dialogs/docsplit.py +17 -19
  77. novelwriter/dialogs/editlabel.py +6 -10
  78. novelwriter/dialogs/preferences.py +200 -164
  79. novelwriter/dialogs/projectsettings.py +225 -189
  80. novelwriter/dialogs/quotes.py +12 -9
  81. novelwriter/dialogs/wordlist.py +9 -15
  82. novelwriter/enum.py +35 -30
  83. novelwriter/error.py +8 -15
  84. novelwriter/extensions/configlayout.py +55 -21
  85. novelwriter/extensions/eventfilters.py +1 -5
  86. novelwriter/extensions/modified.py +70 -14
  87. novelwriter/extensions/novelselector.py +1 -3
  88. novelwriter/extensions/pagedsidebar.py +9 -12
  89. novelwriter/extensions/{circularprogress.py → progressbars.py} +30 -8
  90. novelwriter/extensions/statusled.py +40 -26
  91. novelwriter/extensions/switch.py +4 -6
  92. novelwriter/extensions/switchbox.py +7 -6
  93. novelwriter/extensions/versioninfo.py +3 -9
  94. novelwriter/gui/doceditor.py +120 -139
  95. novelwriter/gui/dochighlight.py +231 -186
  96. novelwriter/gui/docviewer.py +69 -108
  97. novelwriter/gui/docviewerpanel.py +3 -10
  98. novelwriter/gui/editordocument.py +1 -3
  99. novelwriter/gui/itemdetails.py +7 -11
  100. novelwriter/gui/mainmenu.py +22 -18
  101. novelwriter/gui/noveltree.py +11 -24
  102. novelwriter/gui/outline.py +15 -26
  103. novelwriter/gui/projtree.py +39 -65
  104. novelwriter/gui/search.py +10 -3
  105. novelwriter/gui/sidebar.py +2 -6
  106. novelwriter/gui/statusbar.py +29 -37
  107. novelwriter/gui/theme.py +26 -48
  108. novelwriter/guimain.py +162 -160
  109. novelwriter/shared.py +36 -19
  110. novelwriter/text/patterns.py +113 -0
  111. novelwriter/tools/dictionaries.py +10 -20
  112. novelwriter/tools/lipsum.py +10 -16
  113. novelwriter/tools/manusbuild.py +9 -11
  114. novelwriter/tools/manuscript.py +75 -149
  115. novelwriter/tools/manussettings.py +74 -76
  116. novelwriter/tools/noveldetails.py +16 -21
  117. novelwriter/tools/welcome.py +21 -26
  118. novelwriter/tools/writingstats.py +9 -12
  119. novelwriter/types.py +49 -4
  120. novelwriter/extensions/simpleprogress.py +0 -55
  121. {novelWriter-2.4.3.dist-info → novelWriter-2.5.dist-info}/LICENSE.md +0 -0
  122. {novelWriter-2.4.3.dist-info → novelWriter-2.5.dist-info}/entry_points.txt +0 -0
  123. {novelWriter-2.4.3.dist-info → novelWriter-2.5.dist-info}/top_level.txt +0 -0
@@ -25,14 +25,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
25
25
  """
26
26
  from __future__ import annotations
27
27
 
28
- from PyQt5.QtGui import QColor, QPaintEvent, QPainter, QPolygon
29
28
  from PyQt5.QtCore import QPoint, QRectF, QSize, Qt, pyqtSignal, pyqtSlot
29
+ from PyQt5.QtGui import QColor, QPainter, QPaintEvent, QPolygon
30
30
  from PyQt5.QtWidgets import (
31
- QAbstractButton, QAction, QButtonGroup, QLabel, QSizePolicy, QStyle,
31
+ QAbstractButton, QAction, QButtonGroup, QLabel, QStyle,
32
32
  QStyleOptionToolButton, QToolBar, QToolButton, QWidget
33
33
  )
34
34
 
35
- from novelwriter.types import QtPaintAnitAlias, QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen
35
+ from novelwriter.types import (
36
+ QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen, QtPaintAnitAlias,
37
+ QtSizeExpanding, QtSizeFixed
38
+ )
36
39
 
37
40
 
38
41
  class NPagedSideBar(QToolBar):
@@ -59,7 +62,7 @@ class NPagedSideBar(QToolBar):
59
62
  self.setOrientation(Qt.Orientation.Vertical)
60
63
 
61
64
  stretch = QWidget(self)
62
- stretch.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
65
+ stretch.setSizePolicy(QtSizeExpanding, QtSizeExpanding)
63
66
  self._stretchAction = self.addWidget(stretch)
64
67
 
65
68
  return
@@ -109,8 +112,6 @@ class NPagedSideBar(QToolBar):
109
112
  self.buttonClicked.emit(buttonId)
110
113
  return
111
114
 
112
- # END Class NPagedSideBar
113
-
114
115
 
115
116
  class _NPagedToolButton(QToolButton):
116
117
 
@@ -119,7 +120,7 @@ class _NPagedToolButton(QToolButton):
119
120
  def __init__(self, parent: QWidget) -> None:
120
121
  super().__init__(parent=parent)
121
122
 
122
- self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
123
+ self.setSizePolicy(QtSizeExpanding, QtSizeFixed)
123
124
  self.setCheckable(True)
124
125
 
125
126
  fH = self.fontMetrics().height()
@@ -187,8 +188,6 @@ class _NPagedToolButton(QToolButton):
187
188
 
188
189
  return
189
190
 
190
- # END Class _NPagedToolButton
191
-
192
191
 
193
192
  class _NPagedToolLabel(QLabel):
194
193
 
@@ -197,7 +196,7 @@ class _NPagedToolLabel(QLabel):
197
196
  def __init__(self, parent: QWidget, textColor: QColor | None = None) -> None:
198
197
  super().__init__(parent=parent)
199
198
 
200
- self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
199
+ self.setSizePolicy(QtSizeExpanding, QtSizeFixed)
201
200
 
202
201
  fH = self.fontMetrics().height()
203
202
  self._bH = round(fH * 1.7)
@@ -228,5 +227,3 @@ class _NPagedToolLabel(QLabel):
228
227
  paint.drawText(QRectF(self._lM, self._tM, tW, tH), QtAlignLeft, self.text())
229
228
 
230
229
  return
231
-
232
- # END Class _NPagedToolLabel
@@ -1,9 +1,10 @@
1
1
  """
2
- novelWriter – Custom Widget: Progress Circle
3
- ============================================
2
+ novelWriter – Custom Widget: Progress Bars
3
+ ==========================================
4
4
 
5
5
  File History:
6
- Created: 2023-06-07 [2.1b1]
6
+ Created: 2023-06-07 [2.1b1] NProgressCircle
7
+ Created: 2023-06-09 [2.1b1] NProgressSimple
7
8
 
8
9
  This file is a part of novelWriter
9
10
  Copyright 2018–2024, Veronica Berglyd Olsen
@@ -26,11 +27,12 @@ from __future__ import annotations
26
27
  from math import ceil
27
28
 
28
29
  from PyQt5.QtCore import QRect
29
- from PyQt5.QtGui import QBrush, QColor, QPaintEvent, QPainter, QPen
30
- from PyQt5.QtWidgets import QProgressBar, QSizePolicy, QWidget
30
+ from PyQt5.QtGui import QBrush, QColor, QPainter, QPaintEvent, QPen
31
+ from PyQt5.QtWidgets import QProgressBar, QWidget
31
32
 
32
33
  from novelwriter.types import (
33
- QtPaintAnitAlias, QtAlignCenter, QtRoundCap, QtSolidLine, QtTransparent
34
+ QtAlignCenter, QtPaintAnitAlias, QtRoundCap, QtSizeFixed, QtSolidLine,
35
+ QtTransparent
34
36
  )
35
37
 
36
38
 
@@ -59,7 +61,7 @@ class NProgressCircle(QProgressBar):
59
61
  bar=self.palette().highlight().color(),
60
62
  text=self.palette().text().color()
61
63
  )
62
- self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
64
+ self.setSizePolicy(QtSizeFixed, QtSizeFixed)
63
65
  self.setFixedWidth(size)
64
66
  self.setFixedHeight(size)
65
67
  return
@@ -101,4 +103,24 @@ class NProgressCircle(QProgressBar):
101
103
  painter.drawText(self._cRect, QtAlignCenter, self._text or f"{progress:.1f} %")
102
104
  return
103
105
 
104
- # END Class NProgressCircle
106
+
107
+ class NProgressSimple(QProgressBar):
108
+ """Extension: Simple Progress Widget
109
+
110
+ A custom widget that paints a plain bar with no other styling.
111
+ """
112
+
113
+ def __init__(self, parent: QWidget) -> None:
114
+ super().__init__(parent=parent)
115
+ return
116
+
117
+ def paintEvent(self, event: QPaintEvent) -> None:
118
+ """Custom painter for the progress bar."""
119
+ if (value := self.value()) > 0:
120
+ progress = ceil(self.width()*float(value)/self.maximum())
121
+ painter = QPainter(self)
122
+ painter.setRenderHint(QtPaintAnitAlias, True)
123
+ painter.setPen(self.palette().highlight().color())
124
+ painter.setBrush(self.palette().highlight())
125
+ painter.drawRect(0, 0, progress, self.height())
126
+ return
@@ -25,44 +25,56 @@ from __future__ import annotations
25
25
 
26
26
  import logging
27
27
 
28
- from typing import Literal
29
-
30
- from PyQt5.QtGui import QColor, QPaintEvent, QPainter
28
+ from PyQt5.QtGui import QColor, QPainter, QPaintEvent
31
29
  from PyQt5.QtWidgets import QAbstractButton, QWidget
32
30
 
33
- from novelwriter.types import QtPaintAnitAlias
31
+ from novelwriter import CONFIG
32
+ from novelwriter.enum import nwTrinary
33
+ from novelwriter.types import QtBlack, QtPaintAnitAlias
34
34
 
35
35
  logger = logging.getLogger(__name__)
36
36
 
37
37
 
38
38
  class StatusLED(QAbstractButton):
39
39
 
40
- S_NONE = 0
41
- S_BAD = 1
42
- S_GOOD = 2
40
+ __slots__ = (
41
+ "_neutral", "_postitve", "_negative", "_color", "_state", "_bPx"
42
+ )
43
43
 
44
- def __init__(self, colNone: QColor, colGood: QColor, colBad: QColor,
45
- sW: int, sH: int, parent: QWidget | None = None) -> None:
44
+ def __init__(self, sW: int, sH: int, parent: QWidget | None = None) -> None:
46
45
  super().__init__(parent=parent)
47
-
48
- self._colNone = colNone
49
- self._colGood = colGood
50
- self._colBad = colBad
51
- self._theCol = colNone
52
-
46
+ self._neutral = QtBlack
47
+ self._postitve = QtBlack
48
+ self._negative = QtBlack
49
+ self._color = QtBlack
50
+ self._state = nwTrinary.NEUTRAL
51
+ self._bPx = CONFIG.pxInt(1)
53
52
  self.setFixedWidth(sW)
54
53
  self.setFixedHeight(sH)
54
+ return
55
55
 
56
+ @property
57
+ def state(self) -> nwTrinary:
58
+ """The current state of the LED."""
59
+ return self._state
60
+
61
+ def setColors(self, neutral: QColor, positive: QColor, negative: QColor) -> None:
62
+ """Set the three colours for the status values."""
63
+ self._neutral = neutral
64
+ self._postitve = positive
65
+ self._negative = negative
66
+ self.setState(self._state)
56
67
  return
57
68
 
58
- def setState(self, state: Literal[0, 1, 2]) -> None:
69
+ def setState(self, state: nwTrinary) -> None:
59
70
  """Set the colour state."""
60
- if state == self.S_GOOD:
61
- self._theCol = self._colGood
62
- elif state == self.S_BAD:
63
- self._theCol = self._colBad
71
+ if state == nwTrinary.POSITIVE:
72
+ self._color = self._postitve
73
+ elif state == nwTrinary.NEGATIVE:
74
+ self._color = self._negative
64
75
  else:
65
- self._theCol = self._colNone
76
+ self._color = self._neutral
77
+ self._state = state
66
78
  self.update()
67
79
  return
68
80
 
@@ -70,10 +82,12 @@ class StatusLED(QAbstractButton):
70
82
  """Draw the LED."""
71
83
  painter = QPainter(self)
72
84
  painter.setRenderHint(QtPaintAnitAlias, True)
73
- painter.setPen(self.palette().dark().color())
74
- painter.setBrush(self._theCol)
85
+ painter.setPen(self.palette().windowText().color())
86
+ painter.setBrush(self._color)
75
87
  painter.setOpacity(1.0)
76
- painter.drawEllipse(1, 1, self.width() - 2, self.height() - 2)
88
+ painter.drawEllipse(
89
+ self._bPx, self._bPx,
90
+ self.width() - 2*self._bPx,
91
+ self.height() - 2*self._bPx
92
+ )
77
93
  return
78
-
79
- # END Class StatusLED
@@ -23,12 +23,12 @@ 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.QtGui import QMouseEvent, QPainter, QPaintEvent, QResizeEvent
27
26
  from PyQt5.QtCore import QEvent, QPropertyAnimation, Qt, pyqtProperty
28
- from PyQt5.QtWidgets import QAbstractButton, QSizePolicy, QWidget
27
+ from PyQt5.QtGui import QMouseEvent, QPainter, QPaintEvent, QResizeEvent
28
+ from PyQt5.QtWidgets import QAbstractButton, QWidget
29
29
 
30
30
  from novelwriter import CONFIG, SHARED
31
- from novelwriter.types import QtPaintAnitAlias, QtMouseLeft, QtNoPen
31
+ from novelwriter.types import QtMouseLeft, QtNoPen, QtPaintAnitAlias, QtSizeFixed
32
32
 
33
33
 
34
34
  class NSwitch(QAbstractButton):
@@ -46,7 +46,7 @@ class NSwitch(QAbstractButton):
46
46
  self._rR = self._xR - self._rB
47
47
 
48
48
  self.setCheckable(True)
49
- self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
49
+ self.setSizePolicy(QtSizeFixed, QtSizeFixed)
50
50
  self.setFixedWidth(self._xW)
51
51
  self.setFixedHeight(self._xH)
52
52
  self._offset = self._xR
@@ -133,5 +133,3 @@ class NSwitch(QAbstractButton):
133
133
  self.setCursor(Qt.CursorShape.PointingHandCursor)
134
134
  super().enterEvent(event)
135
135
  return
136
-
137
- # END Class NSwitch
@@ -23,12 +23,15 @@ 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.QtGui import QIcon
27
26
  from PyQt5.QtCore import pyqtSignal
28
- from PyQt5.QtWidgets import QGridLayout, QLabel, QScrollArea, QSizePolicy, QWidget
27
+ from PyQt5.QtGui import QIcon
28
+ from PyQt5.QtWidgets import QGridLayout, QLabel, QScrollArea, QWidget
29
29
 
30
30
  from novelwriter.extensions.switch import NSwitch
31
- from novelwriter.types import QtAlignLeft, QtAlignRight, QtAlignRightMiddle
31
+ from novelwriter.types import (
32
+ QtAlignLeft, QtAlignRight, QtAlignRightMiddle, QtSizeMinimum,
33
+ QtSizeMinimumExpanding
34
+ )
32
35
 
33
36
 
34
37
  class NSwitchBox(QScrollArea):
@@ -59,7 +62,7 @@ class NSwitchBox(QScrollArea):
59
62
  self._content.setColumnStretch(1, 1)
60
63
 
61
64
  self._widget = QWidget(self)
62
- self._widget.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Minimum)
65
+ self._widget.setSizePolicy(QtSizeMinimumExpanding, QtSizeMinimum)
63
66
  self._widget.setLayout(self._content)
64
67
 
65
68
  self.setWidgetResizable(True)
@@ -124,5 +127,3 @@ class NSwitchBox(QScrollArea):
124
127
  self._content.setRowStretch(self._index + 1, 1)
125
128
  self._index += 1
126
129
  return
127
-
128
- # END Class NSwitchBox
@@ -26,16 +26,16 @@ from __future__ import annotations
26
26
  import json
27
27
  import logging
28
28
 
29
- from time import sleep
30
29
  from datetime import datetime
30
+ from time import sleep
31
31
  from urllib.error import HTTPError
32
32
  from urllib.request import Request, urlopen
33
33
 
34
- from PyQt5.QtGui import QDesktopServices
35
34
  from PyQt5.QtCore import QObject, QRunnable, QUrl, pyqtSignal, pyqtSlot
35
+ from PyQt5.QtGui import QDesktopServices
36
36
  from PyQt5.QtWidgets import QLabel, QVBoxLayout, QWidget
37
37
 
38
- from novelwriter import CONFIG, SHARED, __version__, __date__, __domain__
38
+ from novelwriter import CONFIG, SHARED, __date__, __domain__, __version__
39
39
  from novelwriter.common import formatVersion
40
40
  from novelwriter.constants import nwConst
41
41
 
@@ -111,8 +111,6 @@ class VersionInfoWidget(QWidget):
111
111
  self._lblRelease.setText(self._trLatest.format(reason or self.tr("Failed")))
112
112
  return
113
113
 
114
- # END Class VersionInfoWidget
115
-
116
114
 
117
115
  class _Retriever(QRunnable):
118
116
 
@@ -144,10 +142,6 @@ class _Retriever(QRunnable):
144
142
  self.signals.dataReady.emit("", str(e))
145
143
  return
146
144
 
147
- # END Class _Retriever
148
-
149
145
 
150
146
  class _RetrieverSignal(QObject):
151
147
  dataReady = pyqtSignal(str, str)
152
-
153
- # END Class _RetrieverSignal