novelWriter 2.4.4__py3-none-any.whl → 2.5rc1__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 (110) hide show
  1. {novelWriter-2.4.4.dist-info → novelWriter-2.5rc1.dist-info}/METADATA +4 -5
  2. {novelWriter-2.4.4.dist-info → novelWriter-2.5rc1.dist-info}/RECORD +109 -101
  3. {novelWriter-2.4.4.dist-info → novelWriter-2.5rc1.dist-info}/WHEEL +1 -1
  4. novelwriter/__init__.py +33 -39
  5. novelwriter/assets/i18n/project_en_GB.json +1 -0
  6. novelwriter/assets/icons/typicons_dark/icons.conf +2 -0
  7. novelwriter/assets/icons/typicons_dark/nw_font.svg +4 -0
  8. novelwriter/assets/icons/typicons_dark/nw_quote.svg +4 -0
  9. novelwriter/assets/icons/typicons_light/icons.conf +2 -0
  10. novelwriter/assets/icons/typicons_light/nw_font.svg +4 -0
  11. novelwriter/assets/icons/typicons_light/nw_quote.svg +4 -0
  12. novelwriter/assets/manual.pdf +0 -0
  13. novelwriter/assets/sample.zip +0 -0
  14. novelwriter/assets/syntax/cyberpunk_night.conf +5 -3
  15. novelwriter/assets/syntax/default_dark.conf +32 -18
  16. novelwriter/assets/syntax/default_light.conf +24 -10
  17. novelwriter/assets/syntax/dracula.conf +44 -0
  18. novelwriter/assets/syntax/grey_dark.conf +5 -4
  19. novelwriter/assets/syntax/grey_light.conf +5 -4
  20. novelwriter/assets/syntax/light_owl.conf +7 -6
  21. novelwriter/assets/syntax/night_owl.conf +7 -6
  22. novelwriter/assets/syntax/snazzy.conf +42 -0
  23. novelwriter/assets/syntax/solarized_dark.conf +4 -3
  24. novelwriter/assets/syntax/solarized_light.conf +4 -3
  25. novelwriter/assets/syntax/tango.conf +27 -11
  26. novelwriter/assets/syntax/tomorrow.conf +6 -5
  27. novelwriter/assets/syntax/tomorrow_night.conf +7 -6
  28. novelwriter/assets/syntax/tomorrow_night_blue.conf +6 -5
  29. novelwriter/assets/syntax/tomorrow_night_bright.conf +6 -5
  30. novelwriter/assets/syntax/tomorrow_night_eighties.conf +6 -5
  31. novelwriter/assets/text/credits_en.htm +4 -1
  32. novelwriter/assets/themes/cyberpunk_night.conf +3 -0
  33. novelwriter/assets/themes/default_dark.conf +2 -0
  34. novelwriter/assets/themes/default_light.conf +2 -0
  35. novelwriter/assets/themes/dracula.conf +48 -0
  36. novelwriter/assets/themes/solarized_dark.conf +2 -0
  37. novelwriter/assets/themes/solarized_light.conf +2 -0
  38. novelwriter/common.py +33 -12
  39. novelwriter/config.py +184 -98
  40. novelwriter/constants.py +47 -35
  41. novelwriter/core/buildsettings.py +68 -69
  42. novelwriter/core/coretools.py +5 -23
  43. novelwriter/core/docbuild.py +52 -40
  44. novelwriter/core/document.py +3 -5
  45. novelwriter/core/index.py +115 -45
  46. novelwriter/core/item.py +8 -19
  47. novelwriter/core/options.py +2 -4
  48. novelwriter/core/project.py +23 -57
  49. novelwriter/core/projectdata.py +1 -3
  50. novelwriter/core/projectxml.py +12 -15
  51. novelwriter/core/sessions.py +3 -5
  52. novelwriter/core/spellcheck.py +4 -9
  53. novelwriter/core/status.py +211 -164
  54. novelwriter/core/storage.py +0 -8
  55. novelwriter/core/tohtml.py +139 -105
  56. novelwriter/core/tokenizer.py +278 -122
  57. novelwriter/core/{tomd.py → tomarkdown.py} +97 -78
  58. novelwriter/core/toodt.py +257 -166
  59. novelwriter/core/toqdoc.py +419 -0
  60. novelwriter/core/tree.py +5 -7
  61. novelwriter/dialogs/about.py +11 -18
  62. novelwriter/dialogs/docmerge.py +17 -19
  63. novelwriter/dialogs/docsplit.py +17 -19
  64. novelwriter/dialogs/editlabel.py +6 -10
  65. novelwriter/dialogs/preferences.py +193 -144
  66. novelwriter/dialogs/projectsettings.py +225 -189
  67. novelwriter/dialogs/quotes.py +12 -9
  68. novelwriter/dialogs/wordlist.py +9 -15
  69. novelwriter/enum.py +35 -30
  70. novelwriter/error.py +8 -15
  71. novelwriter/extensions/configlayout.py +40 -21
  72. novelwriter/extensions/eventfilters.py +1 -5
  73. novelwriter/extensions/modified.py +58 -14
  74. novelwriter/extensions/novelselector.py +1 -3
  75. novelwriter/extensions/pagedsidebar.py +9 -12
  76. novelwriter/extensions/{circularprogress.py → progressbars.py} +30 -8
  77. novelwriter/extensions/statusled.py +29 -25
  78. novelwriter/extensions/switch.py +4 -6
  79. novelwriter/extensions/switchbox.py +7 -6
  80. novelwriter/extensions/versioninfo.py +3 -9
  81. novelwriter/gui/doceditor.py +118 -137
  82. novelwriter/gui/dochighlight.py +231 -186
  83. novelwriter/gui/docviewer.py +66 -107
  84. novelwriter/gui/docviewerpanel.py +3 -10
  85. novelwriter/gui/editordocument.py +1 -3
  86. novelwriter/gui/itemdetails.py +7 -11
  87. novelwriter/gui/mainmenu.py +22 -18
  88. novelwriter/gui/noveltree.py +11 -24
  89. novelwriter/gui/outline.py +14 -26
  90. novelwriter/gui/projtree.py +35 -60
  91. novelwriter/gui/search.py +10 -3
  92. novelwriter/gui/sidebar.py +2 -6
  93. novelwriter/gui/statusbar.py +29 -37
  94. novelwriter/gui/theme.py +26 -48
  95. novelwriter/guimain.py +134 -148
  96. novelwriter/shared.py +36 -32
  97. novelwriter/text/patterns.py +113 -0
  98. novelwriter/tools/dictionaries.py +10 -20
  99. novelwriter/tools/lipsum.py +10 -16
  100. novelwriter/tools/manusbuild.py +9 -11
  101. novelwriter/tools/manuscript.py +71 -145
  102. novelwriter/tools/manussettings.py +71 -75
  103. novelwriter/tools/noveldetails.py +16 -21
  104. novelwriter/tools/welcome.py +12 -26
  105. novelwriter/tools/writingstats.py +9 -12
  106. novelwriter/types.py +49 -4
  107. novelwriter/extensions/simpleprogress.py +0 -55
  108. {novelWriter-2.4.4.dist-info → novelWriter-2.5rc1.dist-info}/LICENSE.md +0 -0
  109. {novelWriter-2.4.4.dist-info → novelWriter-2.5rc1.dist-info}/entry_points.txt +0 -0
  110. {novelWriter-2.4.4.dist-info → novelWriter-2.5rc1.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,50 @@ 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.enum import nwTrinary
32
+ from novelwriter.types import QtBlack, QtPaintAnitAlias
34
33
 
35
34
  logger = logging.getLogger(__name__)
36
35
 
37
36
 
38
37
  class StatusLED(QAbstractButton):
39
38
 
40
- S_NONE = 0
41
- S_BAD = 1
42
- S_GOOD = 2
43
-
44
- def __init__(self, colNone: QColor, colGood: QColor, colBad: QColor,
45
- sW: int, sH: int, parent: QWidget | None = None) -> None:
39
+ def __init__(self, sW: int, sH: int, parent: QWidget | None = None) -> None:
46
40
  super().__init__(parent=parent)
47
-
48
- self._colNone = colNone
49
- self._colGood = colGood
50
- self._colBad = colBad
51
- self._theCol = colNone
52
-
41
+ self._neutral = QtBlack
42
+ self._postitve = QtBlack
43
+ self._negative = QtBlack
44
+ self._color = QtBlack
45
+ self._state = nwTrinary.NEUTRAL
53
46
  self.setFixedWidth(sW)
54
47
  self.setFixedHeight(sH)
48
+ return
55
49
 
50
+ @property
51
+ def state(self) -> nwTrinary:
52
+ """The current state of the LED."""
53
+ return self._state
54
+
55
+ def setColors(self, neutral: QColor, positive: QColor, negative: QColor) -> None:
56
+ """Set the three colours for the status values."""
57
+ self._neutral = neutral
58
+ self._postitve = positive
59
+ self._negative = negative
60
+ self.setState(self._state)
56
61
  return
57
62
 
58
- def setState(self, state: Literal[0, 1, 2]) -> None:
63
+ def setState(self, state: nwTrinary) -> None:
59
64
  """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
65
+ if state == nwTrinary.POSITIVE:
66
+ self._color = self._postitve
67
+ elif state == nwTrinary.NEGATIVE:
68
+ self._color = self._negative
64
69
  else:
65
- self._theCol = self._colNone
70
+ self._color = self._neutral
71
+ self._state = state
66
72
  self.update()
67
73
  return
68
74
 
@@ -71,9 +77,7 @@ class StatusLED(QAbstractButton):
71
77
  painter = QPainter(self)
72
78
  painter.setRenderHint(QtPaintAnitAlias, True)
73
79
  painter.setPen(self.palette().dark().color())
74
- painter.setBrush(self._theCol)
80
+ painter.setBrush(self._color)
75
81
  painter.setOpacity(1.0)
76
82
  painter.drawEllipse(1, 1, self.width() - 2, self.height() - 2)
77
83
  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