novelWriter 2.2rc1__py3-none-any.whl → 2.2.1__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 (117) hide show
  1. {novelWriter-2.2rc1.dist-info → novelWriter-2.2.1.dist-info}/METADATA +1 -1
  2. {novelWriter-2.2rc1.dist-info → novelWriter-2.2.1.dist-info}/RECORD +113 -111
  3. {novelWriter-2.2rc1.dist-info → novelWriter-2.2.1.dist-info}/WHEEL +1 -1
  4. novelwriter/__init__.py +10 -5
  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_zh_CN.qm +0 -0
  13. novelwriter/assets/i18n/project_de_DE.json +1 -0
  14. novelwriter/assets/i18n/project_en_US.json +1 -0
  15. novelwriter/assets/i18n/project_es_419.json +11 -0
  16. novelwriter/assets/i18n/project_fr_FR.json +11 -0
  17. novelwriter/assets/i18n/project_it_IT.json +11 -0
  18. novelwriter/assets/i18n/project_ja_JP.json +2 -1
  19. novelwriter/assets/i18n/project_nb_NO.json +1 -0
  20. novelwriter/assets/i18n/project_zh_CN.json +11 -0
  21. novelwriter/assets/icons/typicons_dark/icons.conf +3 -2
  22. novelwriter/assets/icons/typicons_dark/nw_tb-bold-md.svg +4 -0
  23. novelwriter/assets/icons/typicons_dark/nw_tb-bold.svg +3 -1
  24. novelwriter/assets/icons/typicons_dark/nw_tb-italic-md.svg +4 -0
  25. novelwriter/assets/icons/typicons_dark/nw_tb-italic.svg +3 -1
  26. novelwriter/assets/icons/typicons_dark/nw_tb-strike-md.svg +4 -0
  27. novelwriter/assets/icons/typicons_dark/nw_tb-strike.svg +3 -1
  28. novelwriter/assets/icons/typicons_dark/nw_tb-subscript.svg +4 -2
  29. novelwriter/assets/icons/typicons_dark/nw_tb-superscript.svg +4 -2
  30. novelwriter/assets/icons/typicons_dark/nw_tb-underline.svg +4 -2
  31. novelwriter/assets/icons/typicons_light/icons.conf +3 -2
  32. novelwriter/assets/icons/typicons_light/nw_tb-bold-md.svg +4 -0
  33. novelwriter/assets/icons/typicons_light/nw_tb-bold.svg +3 -1
  34. novelwriter/assets/icons/typicons_light/nw_tb-italic-md.svg +4 -0
  35. novelwriter/assets/icons/typicons_light/nw_tb-italic.svg +3 -1
  36. novelwriter/assets/icons/typicons_light/nw_tb-strike-md.svg +4 -0
  37. novelwriter/assets/icons/typicons_light/nw_tb-strike.svg +3 -1
  38. novelwriter/assets/icons/typicons_light/nw_tb-subscript.svg +4 -2
  39. novelwriter/assets/icons/typicons_light/nw_tb-superscript.svg +4 -2
  40. novelwriter/assets/icons/typicons_light/nw_tb-underline.svg +4 -2
  41. novelwriter/assets/manual.pdf +0 -0
  42. novelwriter/assets/sample.zip +0 -0
  43. novelwriter/assets/text/release_notes.htm +50 -7
  44. novelwriter/common.py +16 -29
  45. novelwriter/config.py +3 -3
  46. novelwriter/constants.py +1 -1
  47. novelwriter/core/buildsettings.py +1 -1
  48. novelwriter/core/coretools.py +2 -1
  49. novelwriter/core/docbuild.py +1 -1
  50. novelwriter/core/document.py +1 -1
  51. novelwriter/core/index.py +2 -2
  52. novelwriter/core/item.py +2 -2
  53. novelwriter/core/options.py +3 -3
  54. novelwriter/core/project.py +3 -3
  55. novelwriter/core/projectdata.py +2 -2
  56. novelwriter/core/projectxml.py +1 -1
  57. novelwriter/core/sessions.py +2 -2
  58. novelwriter/core/spellcheck.py +4 -3
  59. novelwriter/core/status.py +3 -3
  60. novelwriter/core/storage.py +1 -1
  61. novelwriter/core/tohtml.py +2 -2
  62. novelwriter/core/tokenizer.py +1 -1
  63. novelwriter/core/tomd.py +2 -2
  64. novelwriter/core/toodt.py +1 -1
  65. novelwriter/core/tree.py +2 -2
  66. novelwriter/dialogs/about.py +30 -31
  67. novelwriter/dialogs/docmerge.py +24 -15
  68. novelwriter/dialogs/docsplit.py +27 -16
  69. novelwriter/dialogs/editlabel.py +19 -7
  70. novelwriter/dialogs/preferences.py +44 -57
  71. novelwriter/dialogs/projdetails.py +29 -36
  72. novelwriter/dialogs/projload.py +32 -36
  73. novelwriter/dialogs/projsettings.py +20 -15
  74. novelwriter/dialogs/quotes.py +32 -25
  75. novelwriter/dialogs/updates.py +4 -14
  76. novelwriter/dialogs/wordlist.py +34 -21
  77. novelwriter/enum.py +5 -4
  78. novelwriter/error.py +1 -1
  79. novelwriter/extensions/circularprogress.py +1 -1
  80. novelwriter/extensions/configlayout.py +3 -15
  81. novelwriter/extensions/{wheeleventfilter.py → eventfilters.py} +15 -5
  82. novelwriter/extensions/novelselector.py +1 -1
  83. novelwriter/extensions/pageddialog.py +1 -1
  84. novelwriter/extensions/pagedsidebar.py +2 -5
  85. novelwriter/extensions/simpleprogress.py +8 -9
  86. novelwriter/extensions/statusled.py +1 -1
  87. novelwriter/extensions/switch.py +4 -4
  88. novelwriter/extensions/switchbox.py +1 -6
  89. novelwriter/gui/doceditor.py +72 -64
  90. novelwriter/gui/dochighlight.py +3 -2
  91. novelwriter/gui/docviewer.py +22 -47
  92. novelwriter/gui/docviewerpanel.py +68 -23
  93. novelwriter/gui/editordocument.py +3 -3
  94. novelwriter/gui/itemdetails.py +2 -2
  95. novelwriter/gui/mainmenu.py +35 -30
  96. novelwriter/gui/noveltree.py +44 -53
  97. novelwriter/gui/outline.py +2 -1
  98. novelwriter/gui/projtree.py +5 -6
  99. novelwriter/gui/sidebar.py +6 -4
  100. novelwriter/gui/statusbar.py +47 -4
  101. novelwriter/gui/theme.py +5 -6
  102. novelwriter/guimain.py +139 -189
  103. novelwriter/shared.py +53 -29
  104. novelwriter/tools/dictionaries.py +2 -2
  105. novelwriter/tools/lipsum.py +34 -28
  106. novelwriter/tools/manusbuild.py +3 -4
  107. novelwriter/tools/manuscript.py +19 -26
  108. novelwriter/tools/manussettings.py +2 -4
  109. novelwriter/tools/projwizard.py +3 -3
  110. novelwriter/tools/writingstats.py +17 -4
  111. novelwriter/assets/icons/typicons_dark/nw_tb-markdown.svg +0 -8
  112. novelwriter/assets/icons/typicons_dark/nw_tb-shortcode.svg +0 -8
  113. novelwriter/assets/icons/typicons_light/nw_tb-markdown.svg +0 -8
  114. novelwriter/assets/icons/typicons_light/nw_tb-shortcode.svg +0 -8
  115. {novelWriter-2.2rc1.dist-info → novelWriter-2.2.1.dist-info}/LICENSE.md +0 -0
  116. {novelWriter-2.2rc1.dist-info → novelWriter-2.2.1.dist-info}/entry_points.txt +0 -0
  117. {novelWriter-2.2rc1.dist-info → novelWriter-2.2.1.dist-info}/top_level.txt +0 -0
@@ -3,10 +3,10 @@ novelWriter – GUI Project Settings
3
3
  ==================================
4
4
 
5
5
  File History:
6
- Created: 2018-09-29 [0.0.1]
6
+ Created: 2018-09-29 [0.0.1] GuiProjectSettings
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -27,11 +27,11 @@ import logging
27
27
 
28
28
  from typing import TYPE_CHECKING
29
29
 
30
- from PyQt5.QtGui import QIcon, QPixmap, QColor
31
- from PyQt5.QtCore import Qt, pyqtSlot
30
+ from PyQt5.QtGui import QCloseEvent, QIcon, QPixmap, QColor
31
+ from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
32
32
  from PyQt5.QtWidgets import (
33
33
  QColorDialog, QComboBox, QDialogButtonBox, QHBoxLayout, QLabel, QLineEdit,
34
- QPushButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
34
+ QPushButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, qApp
35
35
  )
36
36
 
37
37
  from novelwriter import CONFIG, SHARED
@@ -53,6 +53,8 @@ class GuiProjectSettings(NPagedDialog):
53
53
  TAB_IMPORT = 2
54
54
  TAB_REPLACE = 3
55
55
 
56
+ newProjectSettingsReady = pyqtSignal()
57
+
56
58
  def __init__(self, mainGui: GuiMain, focusTab: int = TAB_MAIN) -> None:
57
59
  super().__init__(parent=mainGui)
58
60
 
@@ -86,7 +88,8 @@ class GuiProjectSettings(NPagedDialog):
86
88
 
87
89
  self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
88
90
  self.buttonBox.accepted.connect(self._doSave)
89
- self.buttonBox.rejected.connect(self._doClose)
91
+ self.buttonBox.rejected.connect(self.close)
92
+ self.rejected.connect(self.close)
90
93
  self.addControls(self.buttonBox)
91
94
 
92
95
  # Focus Tab
@@ -100,6 +103,13 @@ class GuiProjectSettings(NPagedDialog):
100
103
  logger.debug("Delete: GuiProjectSettings")
101
104
  return
102
105
 
106
+ def closeEvent(self, event: QCloseEvent) -> None:
107
+ """Capture the close event and perform cleanup."""
108
+ self._saveGuiSettings()
109
+ event.accept()
110
+ self.deleteLater()
111
+ return
112
+
103
113
  ##
104
114
  # Private Slots
105
115
  ##
@@ -137,18 +147,12 @@ class GuiProjectSettings(NPagedDialog):
137
147
  newList = self.tabReplace.getNewList()
138
148
  project.data.setAutoReplace(newList)
139
149
 
140
- self._saveGuiSettings()
141
- self.accept()
150
+ self.newProjectSettingsReady.emit()
151
+ qApp.processEvents()
152
+ self.close()
142
153
 
143
154
  return
144
155
 
145
- @pyqtSlot()
146
- def _doClose(self) -> None:
147
- """Save settings and close the dialog."""
148
- self._saveGuiSettings()
149
- self.reject()
150
- return
151
-
152
156
  ##
153
157
  # Internal Functions
154
158
  ##
@@ -173,6 +177,7 @@ class GuiProjectSettings(NPagedDialog):
173
177
  statusColW = CONFIG.rpxInt(self.tabStatus.listBox.columnWidth(0))
174
178
  importColW = CONFIG.rpxInt(self.tabImport.listBox.columnWidth(0))
175
179
 
180
+ logger.debug("Saving State: GuiProjectSettings")
176
181
  pOptions = SHARED.project.options
177
182
  pOptions.setValue("GuiProjectSettings", "winWidth", winWidth)
178
183
  pOptions.setValue("GuiProjectSettings", "winHeight", winHeight)
@@ -3,10 +3,10 @@ novelWriter – GUI Quotes Dialog
3
3
  ===============================
4
4
 
5
5
  File History:
6
- Created: 2020-06-18 [0.9]
6
+ Created: 2020-06-18 [0.9.0] GuiQuoteSelect
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -25,11 +25,11 @@ from __future__ import annotations
25
25
 
26
26
  import logging
27
27
 
28
- from PyQt5.QtGui import QFontMetrics
29
- from PyQt5.QtCore import Qt, QSize
28
+ from PyQt5.QtGui import QCloseEvent, QFontMetrics
29
+ from PyQt5.QtCore import QSize, Qt, pyqtSlot
30
30
  from PyQt5.QtWidgets import (
31
- QLabel, QVBoxLayout, QHBoxLayout, QDialog, QDialogButtonBox,
32
- QListWidget, QListWidgetItem, QFrame
31
+ QDialog, QDialogButtonBox, QFrame, QHBoxLayout, QLabel, QListWidget,
32
+ QListWidgetItem, QVBoxLayout, QWidget
33
33
  )
34
34
 
35
35
  from novelwriter import CONFIG
@@ -44,9 +44,12 @@ class GuiQuoteSelect(QDialog):
44
44
 
45
45
  D_KEY = Qt.ItemDataRole.UserRole
46
46
 
47
- def __init__(self, parent=None, currentQuote='"'):
47
+ def __init__(self, parent: QWidget, currentQuote: str = '"') -> None:
48
48
  super().__init__(parent=parent)
49
49
 
50
+ logger.debug("Create: GuiQuoteSelect")
51
+ self.setObjectName("GuiQuoteSelect")
52
+
50
53
  self.outerBox = QVBoxLayout()
51
54
  self.innerBox = QHBoxLayout()
52
55
  self.labelBox = QVBoxLayout()
@@ -87,8 +90,8 @@ class GuiQuoteSelect(QDialog):
87
90
 
88
91
  # Buttons
89
92
  self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
90
- self.buttonBox.accepted.connect(self._doAccept)
91
- self.buttonBox.rejected.connect(self._doReject)
93
+ self.buttonBox.accepted.connect(self.accept)
94
+ self.buttonBox.rejected.connect(self.reject)
92
95
 
93
96
  # Assemble
94
97
  self.labelBox.addWidget(self.previewLabel, 0, Qt.AlignTop)
@@ -102,15 +105,31 @@ class GuiQuoteSelect(QDialog):
102
105
 
103
106
  self.setLayout(self.outerBox)
104
107
 
108
+ logger.debug("Ready: GuiQuoteSelect")
109
+
110
+ return
111
+
112
+ def __del__(self) -> None: # pragma: no cover
113
+ logger.debug("Delete: GuiQuoteSelect")
105
114
  return
106
115
 
107
116
  ##
108
- # Slots
117
+ # Events
109
118
  ##
110
119
 
111
- def _selectedSymbol(self):
112
- """Update the preview label and the selected quote style.
113
- """
120
+ def closeEvent(self, event: QCloseEvent) -> None:
121
+ """Capture the close event and perform cleanup."""
122
+ event.accept()
123
+ self.deleteLater()
124
+ return
125
+
126
+ ##
127
+ # Private Slots
128
+ ##
129
+
130
+ @pyqtSlot()
131
+ def _selectedSymbol(self) -> None:
132
+ """Update the preview label and the selected quote style."""
114
133
  selItems = self.listBox.selectedItems()
115
134
  if selItems:
116
135
  theSymbol = selItems[0].data(self.D_KEY)
@@ -118,16 +137,4 @@ class GuiQuoteSelect(QDialog):
118
137
  self.selectedQuote = theSymbol
119
138
  return
120
139
 
121
- def _doAccept(self):
122
- """Ok button clicked.
123
- """
124
- self.accept()
125
- return
126
-
127
- def _doReject(self):
128
- """Cancel button clicked.
129
- """
130
- self.reject()
131
- return
132
-
133
140
  # END Class GuiQuoteSelect
@@ -3,10 +3,10 @@ novelWriter – GUI Updates
3
3
  =========================
4
4
 
5
5
  File History:
6
- Created: 2021-08-21 [1.5b1]
6
+ Created: 2021-08-21 [1.5b1] GuiUpdates
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ from datetime import datetime
30
30
  from urllib.request import Request, urlopen
31
31
 
32
32
  from PyQt5.QtGui import QCloseEvent, QCursor
33
- from PyQt5.QtCore import Qt, pyqtSlot
33
+ from PyQt5.QtCore import Qt
34
34
  from PyQt5.QtWidgets import (
35
35
  QWidget, qApp, QDialog, QHBoxLayout, QVBoxLayout, QDialogButtonBox, QLabel
36
36
  )
@@ -95,7 +95,7 @@ class GuiUpdates(QDialog):
95
95
 
96
96
  # Buttons
97
97
  self.buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
98
- self.buttonBox.rejected.connect(self._doClose)
98
+ self.buttonBox.rejected.connect(self.close)
99
99
 
100
100
  # Assemble
101
101
  self.innerBox = QHBoxLayout()
@@ -169,14 +169,4 @@ class GuiUpdates(QDialog):
169
169
  self.deleteLater()
170
170
  return
171
171
 
172
- ##
173
- # Private Slots
174
- ##
175
-
176
- @pyqtSlot()
177
- def _doClose(self) -> None:
178
- """Close the dialog."""
179
- self.close()
180
- return
181
-
182
172
  # END Class GuiUpdates
@@ -3,10 +3,10 @@ novelWriter – GUI User Wordlist
3
3
  ===============================
4
4
 
5
5
  File History:
6
- Created: 2021-02-12 [1.2rc1]
6
+ Created: 2021-02-12 [1.2rc1] GuiWordList
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -27,10 +27,11 @@ import logging
27
27
 
28
28
  from typing import TYPE_CHECKING
29
29
 
30
- from PyQt5.QtCore import Qt
30
+ from PyQt5.QtGui import QCloseEvent
31
+ from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
31
32
  from PyQt5.QtWidgets import (
32
33
  QAbstractItemView, QDialog, QDialogButtonBox, QHBoxLayout, QLabel,
33
- QLineEdit, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout
34
+ QLineEdit, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout, qApp
34
35
  )
35
36
 
36
37
  from novelwriter import CONFIG, SHARED
@@ -44,7 +45,9 @@ logger = logging.getLogger(__name__)
44
45
 
45
46
  class GuiWordList(QDialog):
46
47
 
47
- def __init__(self, mainGui: GuiMain):
48
+ newWordListReady = pyqtSignal()
49
+
50
+ def __init__(self, mainGui: GuiMain) -> None:
48
51
  super().__init__(parent=mainGui)
49
52
 
50
53
  logger.debug("Create: GuiWordList")
@@ -87,7 +90,7 @@ class GuiWordList(QDialog):
87
90
 
88
91
  self.buttonBox = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
89
92
  self.buttonBox.accepted.connect(self._doSave)
90
- self.buttonBox.rejected.connect(self._doClose)
93
+ self.buttonBox.rejected.connect(self.close)
91
94
 
92
95
  # Assemble
93
96
  # ========
@@ -108,15 +111,27 @@ class GuiWordList(QDialog):
108
111
 
109
112
  return
110
113
 
111
- def __del__(self): # pragma: no cover
114
+ def __del__(self) -> None: # pragma: no cover
112
115
  logger.debug("Delete: GuiWordList")
113
116
  return
114
117
 
115
118
  ##
116
- # Slots
119
+ # Events
120
+ ##
121
+
122
+ def closeEvent(self, event: QCloseEvent) -> None:
123
+ """Capture the close event and perform cleanup."""
124
+ self._saveGuiSettings()
125
+ event.accept()
126
+ self.deleteLater()
127
+ return
128
+
129
+ ##
130
+ # Private Slots
117
131
  ##
118
132
 
119
- def _doAdd(self):
133
+ @pyqtSlot()
134
+ def _doAdd(self) -> None:
120
135
  """Add a new word to the word list."""
121
136
  word = self.newEntry.text().strip()
122
137
  if word == "":
@@ -134,16 +149,17 @@ class GuiWordList(QDialog):
134
149
 
135
150
  return
136
151
 
137
- def _doDelete(self):
152
+ @pyqtSlot()
153
+ def _doDelete(self) -> None:
138
154
  """Delete the selected item."""
139
155
  selItem = self.listBox.selectedItems()
140
156
  if selItem:
141
157
  self.listBox.takeItem(self.listBox.row(selItem[0]))
142
158
  return
143
159
 
144
- def _doSave(self):
160
+ @pyqtSlot()
161
+ def _doSave(self) -> None:
145
162
  """Save the new word list and close."""
146
- self._saveGuiSettings()
147
163
  userDict = UserDictionary(SHARED.project)
148
164
  for i in range(self.listBox.count()):
149
165
  item = self.listBox.item(i)
@@ -152,20 +168,16 @@ class GuiWordList(QDialog):
152
168
  if word:
153
169
  userDict.add(word)
154
170
  userDict.save()
155
- self.accept()
156
- return True
157
-
158
- def _doClose(self):
159
- """Close without saving the word list."""
160
- self._saveGuiSettings()
161
- self.reject()
171
+ self.newWordListReady.emit()
172
+ qApp.processEvents()
173
+ self.close()
162
174
  return
163
175
 
164
176
  ##
165
177
  # Internal Functions
166
178
  ##
167
179
 
168
- def _loadWordList(self):
180
+ def _loadWordList(self) -> None:
169
181
  """Load the project's word list, if it exists."""
170
182
  userDict = UserDictionary(SHARED.project)
171
183
  userDict.load()
@@ -175,11 +187,12 @@ class GuiWordList(QDialog):
175
187
  self.listBox.addItem(word)
176
188
  return
177
189
 
178
- def _saveGuiSettings(self):
190
+ def _saveGuiSettings(self) -> None:
179
191
  """Save GUI settings."""
180
192
  winWidth = CONFIG.rpxInt(self.width())
181
193
  winHeight = CONFIG.rpxInt(self.height())
182
194
 
195
+ logger.debug("Saving State: GuiWordList")
183
196
  pOptions = SHARED.project.options
184
197
  pOptions.setValue("GuiWordList", "winWidth", winWidth)
185
198
  pOptions.setValue("GuiWordList", "winHeight", winHeight)
novelwriter/enum.py CHANGED
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2018-11-02 [0.0.1]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -95,9 +95,9 @@ class nwDocAction(Enum):
95
95
  CUT = 3
96
96
  COPY = 4
97
97
  PASTE = 5
98
- EMPH = 6
99
- STRONG = 7
100
- STRIKE = 8
98
+ MD_ITALIC = 6
99
+ MD_BOLD = 7
100
+ MD_STRIKE = 8
101
101
  S_QUOTE = 9
102
102
  D_QUOTE = 10
103
103
  SEL_ALL = 11
@@ -140,6 +140,7 @@ class nwDocInsert(Enum):
140
140
  NEW_PAGE = 7
141
141
  VSPACE_S = 8
142
142
  VSPACE_M = 9
143
+ LIPSUM = 10
143
144
 
144
145
  # END Enum nwDocInsert
145
146
 
novelwriter/error.py CHANGED
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2020-08-02 [0.10.2]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2023-06-07 [2.1b1]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2020-05-03 [0.4.5]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -59,10 +59,7 @@ class NConfigLayout(QGridLayout):
59
59
  def setHelpTextStyle(self, color: QColor | list | tuple,
60
60
  fontScale: float = FONT_SCALE) -> None:
61
61
  """Set the text color for the help text."""
62
- if isinstance(color, QColor):
63
- self._helpCol = color
64
- else:
65
- self._helpCol = QColor(*color)
62
+ self._helpCol = color if isinstance(color, QColor) else QColor(*color)
66
63
  self._fontScale = fontScale
67
64
  return
68
65
 
@@ -74,12 +71,6 @@ class NConfigLayout(QGridLayout):
74
71
  qHelp.setText(text)
75
72
  return
76
73
 
77
- def setLabelText(self, row: int, text: str) -> None:
78
- """Set the text for the main label."""
79
- if row in self._itemMap:
80
- self._itemMap[row](0).setText(text)
81
- return
82
-
83
74
  ##
84
75
  # Class Methods
85
76
  ##
@@ -211,10 +202,7 @@ class NHelpLabel(QLabel):
211
202
  fontSize: float = FONT_SCALE) -> None:
212
203
  super().__init__(text)
213
204
 
214
- if isinstance(color, QColor):
215
- qCol = color
216
- else:
217
- qCol = QColor(*color)
205
+ qCol = color if isinstance(color, QColor) else QColor(*color)
218
206
 
219
207
  lblCol = self.palette()
220
208
  lblCol.setColor(QPalette.WindowText, qCol)
@@ -1,12 +1,13 @@
1
1
  """
2
- novelWriter – Custom Object: Wheel Event Filter
3
- ===============================================
2
+ novelWriter – Custom Objects: Event Filters
3
+ ===========================================
4
4
 
5
5
  File History:
6
- Created: 2023-08-31 [2.1rc1]
6
+ Created: 2023-08-31 [2.1rc1] WheelEventFilter
7
+ Created: 2023-11-28 [2.2] StatusTipFilter
7
8
 
8
9
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
10
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
11
 
11
12
  This program is free software: you can redistribute it and/or modify
12
13
  it under the terms of the GNU General Public License as published by
@@ -23,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
23
24
  """
24
25
  from __future__ import annotations
25
26
 
26
- from PyQt5.QtGui import QWheelEvent
27
+ from PyQt5.QtGui import QStatusTipEvent, QWheelEvent
27
28
  from PyQt5.QtCore import QEvent, QObject
28
29
  from PyQt5.QtWidgets import QWidget
29
30
 
@@ -63,3 +64,12 @@ class WheelEventFilter(QObject):
63
64
  return False
64
65
 
65
66
  # END Class WheelEventFilter
67
+
68
+
69
+ class StatusTipFilter(QObject):
70
+
71
+ def eventFilter(self, obj: QObject, event: QEvent) -> bool:
72
+ """Filter out status tip events on menus."""
73
+ return True if isinstance(event, QStatusTipEvent) else super().eventFilter(obj, event)
74
+
75
+ # END Class StatusTipFilter
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2022-11-17 [2.0]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2020-05-17 [0.5.1]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -8,7 +8,7 @@ Created: 2023-02-21 [2.1b1] NPagedToolButton
8
8
  Created: 2023-02-21 [2.1b1] NPagedToolLabel
9
9
 
10
10
  This file is a part of novelWriter
11
- Copyright 2018–2023, Veronica Berglyd Olsen
11
+ Copyright 2018–2024, Veronica Berglyd Olsen
12
12
 
13
13
  This program is free software: you can redistribute it and/or modify
14
14
  it under the terms of the GNU General Public License as published by
@@ -65,10 +65,7 @@ class NPagedSideBar(QToolBar):
65
65
 
66
66
  def setLabelColor(self, color: list | QColor) -> None:
67
67
  """Set the text color for the labels."""
68
- if isinstance(color, list):
69
- self._labelCol = QColor(*color)
70
- elif isinstance(color, QColor):
71
- self._labelCol = color
68
+ self._labelCol = color if isinstance(color, QColor) else QColor(*color)
72
69
  return
73
70
 
74
71
  def addSeparator(self) -> None:
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2023-06-09 [2.1b1]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -41,14 +41,13 @@ class NProgressSimple(QProgressBar):
41
41
 
42
42
  def paintEvent(self, event: QPaintEvent) -> None:
43
43
  """Custom painter for the progress bar."""
44
- if self.value() == 0:
45
- return
46
- progress = ceil(self.width()*float(self.value())/self.maximum())
47
- qPaint = QPainter(self)
48
- qPaint.setRenderHint(QPainter.Antialiasing, True)
49
- qPaint.setPen(self.palette().highlight().color())
50
- qPaint.setBrush(self.palette().highlight())
51
- qPaint.drawRect(0, 0, progress, self.height())
44
+ if (value := self.value()) > 0:
45
+ progress = ceil(self.width()*float(value)/self.maximum())
46
+ qPaint = QPainter(self)
47
+ qPaint.setRenderHint(QPainter.Antialiasing, True)
48
+ qPaint.setPen(self.palette().highlight().color())
49
+ qPaint.setBrush(self.palette().highlight())
50
+ qPaint.drawRect(0, 0, progress, self.height())
52
51
  return
53
52
 
54
53
  # END Class NProgressSimple
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2020-05-17 [0.5.1]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2020-05-03 [0.4.5]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -134,10 +134,10 @@ class NSwitch(QAbstractButton):
134
134
  qPaint.setBrush(thumbBrush)
135
135
  qPaint.drawEllipse(self._offset - self._rR, self._rB, self._rH, self._rH)
136
136
 
137
- theFont = qPaint.font()
138
- theFont.setPixelSize(self._xT)
137
+ font = qPaint.font()
138
+ font.setPixelSize(self._xT)
139
139
  qPaint.setPen(textColor)
140
- qPaint.setFont(theFont)
140
+ qPaint.setFont(font)
141
141
  qPaint.drawText(
142
142
  QRectF(self._offset - self._rR, self._rB, self._rH, self._rH),
143
143
  Qt.AlignCenter, thumbText
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2023-04-16 [2.1b1]
7
7
 
8
8
  This file is a part of novelWriter
9
- Copyright 2018–2023, Veronica Berglyd Olsen
9
+ Copyright 2018–2024, Veronica Berglyd Olsen
10
10
 
11
11
  This program is free software: you can redistribute it and/or modify
12
12
  it under the terms of the GNU General Public License as published by
@@ -106,11 +106,6 @@ class NSwitchBox(QScrollArea):
106
106
  self._bumpIndex()
107
107
  return
108
108
 
109
- def setInnerContentsMargins(self, left: int, top: int, right: int, bottom: int) -> None:
110
- """Set the contents margins of the inner layout."""
111
- self._content.setContentsMargins(left, top, right, bottom)
112
- return
113
-
114
109
  ##
115
110
  # Internal Functions
116
111
  ##