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,11 +3,11 @@ novelWriter – Project Item Status Class
3
3
  =======================================
4
4
 
5
5
  File History:
6
- Created: 2019-05-19 [0.1.3]
7
- Rewritten: 2022-04-05 [2.0b1]
6
+ Created: 2019-05-19 [0.1.3] NWStatus
7
+ Rewritten: 2022-04-05 [2.0b1] NWStatus
8
8
 
9
9
  This file is a part of novelWriter
10
- Copyright 2018–2023, Veronica Berglyd Olsen
10
+ Copyright 2018–2024, Veronica Berglyd Olsen
11
11
 
12
12
  This program is free software: you can redistribute it and/or modify
13
13
  it under the terms of the GNU General Public License as published by
@@ -6,7 +6,7 @@ File History:
6
6
  Created: 2022-11-01 [2.0rc2] NWStorage
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
@@ -3,10 +3,10 @@ novelWriter – HTML Text Converter
3
3
  =================================
4
4
 
5
5
  File History:
6
- Created: 2019-05-07 [0.0.1]
6
+ Created: 2019-05-07 [0.0.1] ToHtml
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
@@ -7,7 +7,7 @@ Created: 2019-05-05 [0.0.1] Tokenizer
7
7
  Created: 2023-05-23 [2.1b1] HeadingFormatter
8
8
 
9
9
  This file is a part of novelWriter
10
- Copyright 2018–2023, Veronica Berglyd Olsen
10
+ Copyright 2018–2024, Veronica Berglyd Olsen
11
11
 
12
12
  This program is free software: you can redistribute it and/or modify
13
13
  it under the terms of the GNU General Public License as published by
novelwriter/core/tomd.py CHANGED
@@ -3,10 +3,10 @@ novelWriter – Markdown Text Converter
3
3
  =====================================
4
4
 
5
5
  File History:
6
- Created: 2021-02-06 [1.2b1]
6
+ Created: 2021-02-06 [1.2b1] ToMarkdown
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
novelwriter/core/toodt.py CHANGED
@@ -9,7 +9,7 @@ Created: 2021-01-27 [1.2b1] ODTTextStyle
9
9
  Created: 2021-08-14 [1.5b1] XMLParagraph
10
10
 
11
11
  This file is a part of novelWriter
12
- Copyright 2018–2023, Veronica Berglyd Olsen
12
+ Copyright 2018–2024, Veronica Berglyd Olsen
13
13
 
14
14
  This program is free software: you can redistribute it and/or modify
15
15
  it under the terms of the GNU General Public License as published by
novelwriter/core/tree.py CHANGED
@@ -3,10 +3,10 @@ novelWriter – Project Tree Class
3
3
  ================================
4
4
 
5
5
  File History:
6
- Created: 2020-05-07 [0.4.5]
6
+ Created: 2020-05-07 [0.4.5] NWTree
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
@@ -3,10 +3,10 @@ novelWriter – GUI About Box
3
3
  ===========================
4
4
 
5
5
  File History:
6
- Created: 2020-05-21 [0.5.2]
6
+ Created: 2020-05-21 [0.5.2] GuiAbout
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
@@ -28,7 +28,7 @@ import novelwriter
28
28
 
29
29
  from datetime import datetime
30
30
 
31
- from PyQt5.QtGui import QCursor
31
+ from PyQt5.QtGui import QCloseEvent, QCursor
32
32
  from PyQt5.QtCore import Qt
33
33
  from PyQt5.QtWidgets import (
34
34
  qApp, QDialog, QDialogButtonBox, QHBoxLayout, QLabel, QTabWidget,
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
44
44
 
45
45
  class GuiAbout(QDialog):
46
46
 
47
- def __init__(self, parent: QWidget):
47
+ def __init__(self, parent: QWidget) -> None:
48
48
  super().__init__(parent=parent)
49
49
 
50
50
  logger.debug("Create: GuiAbout")
@@ -101,7 +101,7 @@ class GuiAbout(QDialog):
101
101
 
102
102
  # OK Button
103
103
  self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
104
- self.buttonBox.accepted.connect(self._doClose)
104
+ self.buttonBox.accepted.connect(self.close)
105
105
 
106
106
  self.outerBox.addLayout(self.innerBox)
107
107
  self.outerBox.addWidget(self.buttonBox)
@@ -111,13 +111,12 @@ class GuiAbout(QDialog):
111
111
 
112
112
  return
113
113
 
114
- def __del__(self): # pragma: no cover
114
+ def __del__(self) -> None: # pragma: no cover
115
115
  logger.debug("Delete: GuiAbout")
116
116
  return
117
117
 
118
- def populateGUI(self):
119
- """Populate tabs with text.
120
- """
118
+ def populateGUI(self) -> None:
119
+ """Populate tabs with text."""
121
120
  qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
122
121
  self._setStyleSheet()
123
122
  self._fillAboutPage()
@@ -127,19 +126,27 @@ class GuiAbout(QDialog):
127
126
  qApp.restoreOverrideCursor()
128
127
  return
129
128
 
130
- def showReleaseNotes(self):
131
- """Show the release notes.
132
- """
129
+ def showReleaseNotes(self) -> None:
130
+ """Show the release notes."""
133
131
  self.tabBox.setCurrentWidget(self.pageNotes)
134
132
  return
135
133
 
134
+ ##
135
+ # Events
136
+ ##
137
+
138
+ def closeEvent(self, event: QCloseEvent) -> None:
139
+ """Capture the close event and perform cleanup."""
140
+ event.accept()
141
+ self.deleteLater()
142
+ return
143
+
136
144
  ##
137
145
  # Internal Functions
138
146
  ##
139
147
 
140
- def _fillAboutPage(self):
141
- """Generate the content for the About page.
142
- """
148
+ def _fillAboutPage(self) -> None:
149
+ """Generate the content for the About page."""
143
150
  aboutMsg = (
144
151
  "<h2>{title1}</h2>"
145
152
  "<p>{copy}</p>"
@@ -181,9 +188,8 @@ class GuiAbout(QDialog):
181
188
 
182
189
  return
183
190
 
184
- def _fillNotesPage(self):
185
- """Load the content for the Release Notes page.
186
- """
191
+ def _fillNotesPage(self) -> None:
192
+ """Load the content for the Release Notes page."""
187
193
  docPath = CONFIG.assetPath("text") / "release_notes.htm"
188
194
  docText = readTextFile(docPath)
189
195
  if docText:
@@ -192,9 +198,8 @@ class GuiAbout(QDialog):
192
198
  self.pageNotes.setHtml("Error loading release notes text ...")
193
199
  return
194
200
 
195
- def _fillCreditsPage(self):
196
- """Load the content for the Credits page.
197
- """
201
+ def _fillCreditsPage(self) -> None:
202
+ """Load the content for the Credits page."""
198
203
  docPath = CONFIG.assetPath("text") / "credits_en.htm"
199
204
  docText = readTextFile(docPath)
200
205
  if docText:
@@ -203,9 +208,8 @@ class GuiAbout(QDialog):
203
208
  self.pageCredits.setHtml("Error loading credits text ...")
204
209
  return
205
210
 
206
- def _fillLicensePage(self):
207
- """Load the content for the Licence page.
208
- """
211
+ def _fillLicensePage(self) -> None:
212
+ """Load the content for the Licence page."""
209
213
  docPath = CONFIG.assetPath("text") / "gplv3_en.htm"
210
214
  docText = readTextFile(docPath)
211
215
  if docText:
@@ -214,9 +218,8 @@ class GuiAbout(QDialog):
214
218
  self.pageLicense.setHtml("Error loading licence text ...")
215
219
  return
216
220
 
217
- def _setStyleSheet(self):
218
- """Set stylesheet for all browser tabs
219
- """
221
+ def _setStyleSheet(self) -> None:
222
+ """Set stylesheet for all browser tabs."""
220
223
  styleSheet = (
221
224
  "h1, h2, h3, h4 {{"
222
225
  " color: rgb({hColR},{hColG},{hColB});"
@@ -242,8 +245,4 @@ class GuiAbout(QDialog):
242
245
 
243
246
  return
244
247
 
245
- def _doClose(self):
246
- self.close()
247
- return
248
-
249
248
  # END Class GuiAbout
@@ -3,11 +3,11 @@ novelWriter – GUI Doc Merge Dialog
3
3
  ==================================
4
4
 
5
5
  File History:
6
- Created: 2020-01-23 [0.4.3]
7
- Rewritten: 2022-10-06 [2.0rc1]
6
+ Created: 2020-01-23 [0.4.3] GuiDocMerge
7
+ Rewritten: 2022-10-06 [2.0rc1] GuiDocMerge
8
8
 
9
9
  This file is a part of novelWriter
10
- Copyright 2018–2023, Veronica Berglyd Olsen
10
+ Copyright 2018–2024, Veronica Berglyd Olsen
11
11
 
12
12
  This program is free software: you can redistribute it and/or modify
13
13
  it under the terms of the GNU General Public License as published by
@@ -26,7 +26,8 @@ from __future__ import annotations
26
26
 
27
27
  import logging
28
28
 
29
- from PyQt5.QtCore import Qt, QSize
29
+ from PyQt5.QtGui import QCloseEvent
30
+ from PyQt5.QtCore import Qt, QSize, pyqtSlot
30
31
  from PyQt5.QtWidgets import (
31
32
  QAbstractItemView, QDialog, QDialogButtonBox, QGridLayout, QLabel,
32
33
  QListWidget, QListWidgetItem, QVBoxLayout, QWidget
@@ -108,13 +109,12 @@ class GuiDocMerge(QDialog):
108
109
 
109
110
  return
110
111
 
111
- def __del__(self): # pragma: no cover
112
+ def __del__(self) -> None: # pragma: no cover
112
113
  logger.debug("Delete: GuiDocMerge")
113
114
  return
114
115
 
115
- def getData(self):
116
- """Return the user's choices.
117
- """
116
+ def getData(self) -> dict:
117
+ """Return the user's choices."""
118
118
  finalItems = []
119
119
  for i in range(self.listBox.count()):
120
120
  item = self.listBox.item(i)
@@ -127,12 +127,22 @@ class GuiDocMerge(QDialog):
127
127
  return self._data
128
128
 
129
129
  ##
130
- # Slots
130
+ # Events
131
131
  ##
132
132
 
133
- def _resetList(self):
134
- """Reset the content of the list box to its original state.
135
- """
133
+ def closeEvent(self, event: QCloseEvent) -> None:
134
+ """Capture the close event and perform cleanup."""
135
+ event.accept()
136
+ self.deleteLater()
137
+ return
138
+
139
+ ##
140
+ # Private Slots
141
+ ##
142
+
143
+ @pyqtSlot()
144
+ def _resetList(self) -> None:
145
+ """Reset the content of the list box to its original state."""
136
146
  logger.debug("Resetting list box content")
137
147
  sHandle = self._data.get("sHandle", None)
138
148
  itemList = self._data.get("origItems", [])
@@ -143,9 +153,8 @@ class GuiDocMerge(QDialog):
143
153
  # Internal Functions
144
154
  ##
145
155
 
146
- def _loadContent(self, sHandle, itemList):
147
- """Load content from a given list of items.
148
- """
156
+ def _loadContent(self, sHandle: str, itemList: list[str]) -> None:
157
+ """Load content from a given list of items."""
149
158
  self._data = {}
150
159
  self._data["sHandle"] = sHandle
151
160
  self._data["origItems"] = itemList
@@ -3,11 +3,11 @@ novelWriter – GUI Doc Split Dialog
3
3
  ==================================
4
4
 
5
5
  File History:
6
- Created: 2020-02-01 [0.4.3]
7
- Rewritten: 2022-10-12 [2.0rc1]
6
+ Created: 2020-02-01 [0.4.3] GuiDocSplit
7
+ Rewritten: 2022-10-12 [2.0rc1] GuiDocSplit
8
8
 
9
9
  This file is a part of novelWriter
10
- Copyright 2018–2023, Veronica Berglyd Olsen
10
+ Copyright 2018–2024, Veronica Berglyd Olsen
11
11
 
12
12
  This program is free software: you can redistribute it and/or modify
13
13
  it under the terms of the GNU General Public License as published by
@@ -26,10 +26,11 @@ from __future__ import annotations
26
26
 
27
27
  import logging
28
28
 
29
- from PyQt5.QtCore import Qt
29
+ from PyQt5.QtGui import QCloseEvent
30
+ from PyQt5.QtCore import Qt, pyqtSlot
30
31
  from PyQt5.QtWidgets import (
31
- QDialog, QVBoxLayout, QComboBox, QListWidget, QAbstractItemView,
32
- QListWidgetItem, QDialogButtonBox, QLabel, QGridLayout
32
+ QAbstractItemView, QComboBox, QDialog, QDialogButtonBox, QGridLayout,
33
+ QLabel, QListWidget, QListWidgetItem, QVBoxLayout, QWidget
33
34
  )
34
35
 
35
36
  from novelwriter import CONFIG, SHARED
@@ -45,7 +46,7 @@ class GuiDocSplit(QDialog):
45
46
  LEVEL_ROLE = Qt.ItemDataRole.UserRole + 1
46
47
  LABEL_ROLE = Qt.ItemDataRole.UserRole + 2
47
48
 
48
- def __init__(self, parent, sHandle):
49
+ def __init__(self, parent: QWidget, sHandle: str) -> None:
49
50
  super().__init__(parent=parent)
50
51
 
51
52
  logger.debug("Create: GuiDocSplit")
@@ -138,11 +139,11 @@ class GuiDocSplit(QDialog):
138
139
 
139
140
  return
140
141
 
141
- def __del__(self): # pragma: no cover
142
+ def __del__(self) -> None: # pragma: no cover
142
143
  logger.debug("Delete: GuiDocSplit")
143
144
  return
144
145
 
145
- def getData(self):
146
+ def getData(self) -> tuple[dict, list]:
146
147
  """Return the user's choices. Also save the users options for
147
148
  the next time the dialog is used.
148
149
  """
@@ -167,6 +168,7 @@ class GuiDocSplit(QDialog):
167
168
  self._data["docHierarchy"] = docHierarchy
168
169
  self._data["moveToTrash"] = moveToTrash
169
170
 
171
+ logger.debug("Saving State: GuiDocSplit")
170
172
  pOptions = SHARED.project.options
171
173
  pOptions.setValue("GuiDocSplit", "spLevel", spLevel)
172
174
  pOptions.setValue("GuiDocSplit", "intoFolder", intoFolder)
@@ -175,12 +177,22 @@ class GuiDocSplit(QDialog):
175
177
  return self._data, self._text
176
178
 
177
179
  ##
178
- # Slots
180
+ # Events
179
181
  ##
180
182
 
181
- def _reloadList(self):
182
- """Reload the content of the list box.
183
- """
183
+ def closeEvent(self, event: QCloseEvent) -> None:
184
+ """Capture the close event and perform cleanup."""
185
+ event.accept()
186
+ self.deleteLater()
187
+ return
188
+
189
+ ##
190
+ # Private Slots
191
+ ##
192
+
193
+ @pyqtSlot()
194
+ def _reloadList(self) -> None:
195
+ """Reload the content of the list box."""
184
196
  sHandle = self._data.get("sHandle", None)
185
197
  self._loadContent(sHandle)
186
198
  return
@@ -189,9 +201,8 @@ class GuiDocSplit(QDialog):
189
201
  # Internal Functions
190
202
  ##
191
203
 
192
- def _loadContent(self, sHandle):
193
- """Load content from a given source item.
194
- """
204
+ def _loadContent(self, sHandle: str) -> None:
205
+ """Load content from a given source item."""
195
206
  self._data = {}
196
207
  self._data["sHandle"] = sHandle
197
208
 
@@ -3,10 +3,10 @@ novelWriter – Edit Label Dialog
3
3
  ===============================
4
4
 
5
5
  File History:
6
- Created: 2022-06-11 [2.0rc1]
6
+ Created: 2022-06-11 [2.0rc1] GuiEditLabel
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
@@ -26,7 +26,8 @@ from __future__ import annotations
26
26
  import logging
27
27
 
28
28
  from PyQt5.QtWidgets import (
29
- QDialog, QVBoxLayout, QLineEdit, QLabel, QDialogButtonBox, QHBoxLayout
29
+ QDialog, QDialogButtonBox, QHBoxLayout, QLabel, QLineEdit, QVBoxLayout,
30
+ QWidget
30
31
  )
31
32
 
32
33
  from novelwriter import CONFIG
@@ -36,9 +37,10 @@ logger = logging.getLogger(__name__)
36
37
 
37
38
  class GuiEditLabel(QDialog):
38
39
 
39
- def __init__(self, parent, text=""):
40
+ def __init__(self, parent: QWidget, text: str = "") -> None:
40
41
  super().__init__(parent=parent)
41
42
 
43
+ logger.debug("Create: GuiEditLabel")
42
44
  self.setObjectName("GuiEditLabel")
43
45
  self.setWindowTitle(self.tr("Item Label"))
44
46
 
@@ -70,16 +72,26 @@ class GuiEditLabel(QDialog):
70
72
 
71
73
  self.setLayout(self.outerBox)
72
74
 
75
+ logger.debug("Ready: GuiEditLabel")
76
+
77
+ return
78
+
79
+ def __del__(self) -> None: # pragma: no cover
80
+ logger.debug("Delete: GuiEditLabel")
73
81
  return
74
82
 
75
83
  @property
76
- def itemLabel(self):
84
+ def itemLabel(self) -> str:
77
85
  return self.labelValue.text()
78
86
 
79
87
  @classmethod
80
- def getLabel(cls, parent, text):
88
+ def getLabel(cls, parent: QWidget, text: str) -> tuple[str, bool]:
89
+ """Pop the dialog and return the result."""
81
90
  cls = GuiEditLabel(parent, text=text)
82
91
  cls.exec_()
83
- return cls.itemLabel, cls.result() == QDialog.Accepted
92
+ label = cls.itemLabel
93
+ accepted = cls.result() == QDialog.Accepted
94
+ cls.deleteLater()
95
+ return label, accepted
84
96
 
85
97
  # END Class GuiEditLabel