novelWriter 2.2rc1__py3-none-any.whl → 2.3__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.
- {novelWriter-2.2rc1.dist-info → novelWriter-2.3.dist-info}/METADATA +1 -1
- {novelWriter-2.2rc1.dist-info → novelWriter-2.3.dist-info}/RECORD +149 -132
- {novelWriter-2.2rc1.dist-info → novelWriter-2.3.dist-info}/WHEEL +1 -1
- novelWriter-2.3.dist-info/entry_points.txt +2 -0
- novelwriter/__init__.py +11 -6
- novelwriter/assets/i18n/nw_de_DE.qm +0 -0
- novelwriter/assets/i18n/nw_en_US.qm +0 -0
- novelwriter/assets/i18n/nw_es_419.qm +0 -0
- novelwriter/assets/i18n/nw_fr_FR.qm +0 -0
- novelwriter/assets/i18n/nw_it_IT.qm +0 -0
- novelwriter/assets/i18n/nw_ja_JP.qm +0 -0
- novelwriter/assets/i18n/nw_nb_NO.qm +0 -0
- novelwriter/assets/i18n/nw_nl_NL.qm +0 -0
- novelwriter/assets/i18n/nw_zh_CN.qm +0 -0
- novelwriter/assets/i18n/project_de_DE.json +1 -0
- novelwriter/assets/i18n/project_en_US.json +1 -0
- novelwriter/assets/i18n/project_es_419.json +11 -0
- novelwriter/assets/i18n/project_fr_FR.json +11 -0
- novelwriter/assets/i18n/project_it_IT.json +11 -0
- novelwriter/assets/i18n/project_ja_JP.json +2 -1
- novelwriter/assets/i18n/project_nb_NO.json +1 -0
- novelwriter/assets/i18n/project_nl_NL.json +11 -0
- novelwriter/assets/i18n/project_pt_BR.json +11 -0
- novelwriter/assets/i18n/project_zh_CN.json +11 -0
- novelwriter/assets/icons/typicons_dark/icons.conf +11 -2
- novelwriter/assets/icons/typicons_dark/mixed_document-new.svg +6 -0
- novelwriter/assets/icons/typicons_dark/mixed_import.svg +5 -0
- novelwriter/assets/icons/typicons_dark/nw_tb-bold-md.svg +4 -0
- novelwriter/assets/icons/typicons_dark/nw_tb-bold.svg +3 -1
- novelwriter/assets/icons/typicons_dark/nw_tb-italic-md.svg +4 -0
- novelwriter/assets/icons/typicons_dark/nw_tb-italic.svg +3 -1
- novelwriter/assets/icons/typicons_dark/nw_tb-strike-md.svg +4 -0
- novelwriter/assets/icons/typicons_dark/nw_tb-strike.svg +3 -1
- novelwriter/assets/icons/typicons_dark/nw_tb-subscript.svg +4 -2
- novelwriter/assets/icons/typicons_dark/nw_tb-superscript.svg +4 -2
- novelwriter/assets/icons/typicons_dark/nw_tb-underline.svg +4 -2
- novelwriter/assets/icons/typicons_dark/typ_document-add.svg +4 -0
- novelwriter/assets/icons/typicons_dark/typ_document.svg +4 -0
- novelwriter/assets/icons/typicons_dark/typ_th-dot-more.svg +4 -0
- novelwriter/assets/icons/typicons_dark/typ_th-list.svg +9 -0
- novelwriter/assets/icons/typicons_light/icons.conf +11 -2
- novelwriter/assets/icons/typicons_light/mixed_document-new.svg +6 -0
- novelwriter/assets/icons/typicons_light/mixed_import.svg +5 -0
- novelwriter/assets/icons/typicons_light/nw_tb-bold-md.svg +4 -0
- novelwriter/assets/icons/typicons_light/nw_tb-bold.svg +3 -1
- novelwriter/assets/icons/typicons_light/nw_tb-italic-md.svg +4 -0
- novelwriter/assets/icons/typicons_light/nw_tb-italic.svg +3 -1
- novelwriter/assets/icons/typicons_light/nw_tb-strike-md.svg +4 -0
- novelwriter/assets/icons/typicons_light/nw_tb-strike.svg +3 -1
- novelwriter/assets/icons/typicons_light/nw_tb-subscript.svg +4 -2
- novelwriter/assets/icons/typicons_light/nw_tb-superscript.svg +4 -2
- novelwriter/assets/icons/typicons_light/nw_tb-underline.svg +4 -2
- novelwriter/assets/icons/typicons_light/typ_document-add.svg +4 -0
- novelwriter/assets/icons/typicons_light/typ_document.svg +4 -0
- novelwriter/assets/icons/typicons_light/typ_th-dot-more.svg +4 -0
- novelwriter/assets/icons/typicons_light/typ_th-list.svg +9 -0
- novelwriter/assets/images/novelwriter-text-dark.svg +4 -0
- novelwriter/assets/images/novelwriter-text-light.svg +4 -0
- novelwriter/assets/images/welcome-dark.jpg +0 -0
- novelwriter/assets/images/welcome-light.jpg +0 -0
- novelwriter/assets/manual.pdf +0 -0
- novelwriter/assets/sample.zip +0 -0
- novelwriter/assets/syntax/cyberpunk_night.conf +26 -0
- novelwriter/assets/syntax/default_dark.conf +1 -0
- novelwriter/assets/syntax/default_light.conf +1 -0
- novelwriter/assets/syntax/grey_dark.conf +1 -0
- novelwriter/assets/syntax/grey_light.conf +1 -0
- novelwriter/assets/syntax/light_owl.conf +1 -0
- novelwriter/assets/syntax/night_owl.conf +1 -0
- novelwriter/assets/syntax/solarized_dark.conf +1 -0
- novelwriter/assets/syntax/solarized_light.conf +1 -0
- novelwriter/assets/syntax/tango.conf +23 -0
- novelwriter/assets/syntax/tomorrow.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night_blue.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night_bright.conf +1 -0
- novelwriter/assets/syntax/tomorrow_night_eighties.conf +1 -0
- novelwriter/assets/text/credits_en.htm +4 -2
- novelwriter/assets/themes/cyberpunk_night.conf +29 -0
- novelwriter/assets/themes/default_dark.conf +2 -2
- novelwriter/assets/themes/default_light.conf +2 -2
- novelwriter/common.py +64 -66
- novelwriter/config.py +39 -44
- novelwriter/constants.py +39 -17
- novelwriter/core/buildsettings.py +8 -8
- novelwriter/core/coretools.py +198 -157
- novelwriter/core/docbuild.py +7 -4
- novelwriter/core/document.py +7 -7
- novelwriter/core/index.py +90 -57
- novelwriter/core/item.py +23 -5
- novelwriter/core/options.py +11 -10
- novelwriter/core/project.py +73 -47
- novelwriter/core/projectdata.py +3 -16
- novelwriter/core/projectxml.py +14 -42
- novelwriter/core/sessions.py +4 -3
- novelwriter/core/spellcheck.py +6 -4
- novelwriter/core/status.py +5 -4
- novelwriter/core/storage.py +183 -141
- novelwriter/core/tohtml.py +6 -4
- novelwriter/core/tokenizer.py +110 -83
- novelwriter/core/tomd.py +2 -2
- novelwriter/core/toodt.py +41 -31
- novelwriter/core/tree.py +5 -4
- novelwriter/dialogs/about.py +88 -179
- novelwriter/dialogs/docmerge.py +30 -20
- novelwriter/dialogs/docsplit.py +33 -22
- novelwriter/dialogs/editlabel.py +20 -8
- novelwriter/dialogs/preferences.py +562 -725
- novelwriter/dialogs/{projsettings.py → projectsettings.py} +301 -270
- novelwriter/dialogs/quotes.py +47 -36
- novelwriter/dialogs/wordlist.py +128 -59
- novelwriter/enum.py +25 -22
- novelwriter/error.py +2 -2
- novelwriter/extensions/circularprogress.py +12 -12
- novelwriter/extensions/configlayout.py +185 -146
- novelwriter/extensions/{wheeleventfilter.py → eventfilters.py} +15 -5
- novelwriter/extensions/modified.py +81 -0
- novelwriter/extensions/novelselector.py +27 -13
- novelwriter/extensions/pagedsidebar.py +15 -20
- novelwriter/extensions/simpleprogress.py +8 -9
- novelwriter/extensions/statusled.py +9 -9
- novelwriter/extensions/switch.py +32 -64
- novelwriter/extensions/switchbox.py +2 -7
- novelwriter/extensions/versioninfo.py +153 -0
- novelwriter/gui/doceditor.py +250 -214
- novelwriter/gui/dochighlight.py +66 -94
- novelwriter/gui/docviewer.py +71 -98
- novelwriter/gui/docviewerpanel.py +140 -47
- novelwriter/gui/editordocument.py +3 -3
- novelwriter/gui/itemdetails.py +9 -9
- novelwriter/gui/mainmenu.py +47 -47
- novelwriter/gui/noveltree.py +53 -61
- novelwriter/gui/outline.py +100 -76
- novelwriter/gui/projtree.py +246 -112
- novelwriter/gui/sidebar.py +9 -8
- novelwriter/gui/statusbar.py +49 -7
- novelwriter/gui/theme.py +74 -76
- novelwriter/guimain.py +175 -330
- novelwriter/shared.py +68 -30
- novelwriter/tools/dictionaries.py +7 -8
- novelwriter/tools/lipsum.py +34 -28
- novelwriter/tools/manusbuild.py +3 -4
- novelwriter/tools/manuscript.py +25 -32
- novelwriter/tools/manussettings.py +194 -225
- novelwriter/tools/noveldetails.py +525 -0
- novelwriter/tools/welcome.py +819 -0
- novelwriter/tools/writingstats.py +26 -13
- novelWriter-2.2rc1.dist-info/entry_points.txt +0 -5
- novelwriter/assets/icons/typicons_dark/nw_tb-markdown.svg +0 -8
- novelwriter/assets/icons/typicons_dark/nw_tb-shortcode.svg +0 -8
- novelwriter/assets/icons/typicons_light/nw_tb-markdown.svg +0 -8
- novelwriter/assets/icons/typicons_light/nw_tb-shortcode.svg +0 -8
- novelwriter/assets/images/wizard-back.jpg +0 -0
- novelwriter/assets/text/gplv3_en.htm +0 -641
- novelwriter/assets/text/release_notes.htm +0 -17
- novelwriter/dialogs/projdetails.py +0 -525
- novelwriter/dialogs/projload.py +0 -298
- novelwriter/dialogs/updates.py +0 -182
- novelwriter/extensions/pageddialog.py +0 -130
- novelwriter/tools/projwizard.py +0 -478
- {novelWriter-2.2rc1.dist-info → novelWriter-2.3.dist-info}/LICENSE.md +0 -0
- {novelWriter-2.2rc1.dist-info → novelWriter-2.3.dist-info}/top_level.txt +0 -0
novelwriter/tools/projwizard.py
DELETED
@@ -1,478 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
novelWriter – GUI New Project Wizard
|
3
|
-
====================================
|
4
|
-
|
5
|
-
File History:
|
6
|
-
Created: 2020-07-11 [0.10.1]
|
7
|
-
|
8
|
-
This file is a part of novelWriter
|
9
|
-
Copyright 2018–2023, 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
|
-
import os
|
27
|
-
import logging
|
28
|
-
|
29
|
-
from PyQt5.QtCore import Qt
|
30
|
-
from PyQt5.QtWidgets import (
|
31
|
-
QComboBox, QFileDialog, QFormLayout, QGridLayout, QHBoxLayout, QLabel,
|
32
|
-
QLineEdit, QPushButton, QRadioButton, QSpinBox, QVBoxLayout, QWizard,
|
33
|
-
QWizardPage
|
34
|
-
)
|
35
|
-
|
36
|
-
from novelwriter import CONFIG, SHARED
|
37
|
-
from novelwriter.common import makeFileNameSafe
|
38
|
-
from novelwriter.extensions.switch import NSwitch
|
39
|
-
|
40
|
-
logger = logging.getLogger(__name__)
|
41
|
-
|
42
|
-
PAGE_INTRO = 0
|
43
|
-
PAGE_STORE = 1
|
44
|
-
PAGE_POP = 2
|
45
|
-
PAGE_CUSTOM = 3
|
46
|
-
PAGE_FINAL = 4
|
47
|
-
|
48
|
-
|
49
|
-
class GuiProjectWizard(QWizard):
|
50
|
-
|
51
|
-
def __init__(self, mainGui):
|
52
|
-
super().__init__(parent=mainGui)
|
53
|
-
|
54
|
-
logger.debug("Create: GuiProjectWizard")
|
55
|
-
self.setObjectName("GuiProjectWizard")
|
56
|
-
|
57
|
-
self.mainGui = mainGui
|
58
|
-
|
59
|
-
self.sideImage = SHARED.theme.loadDecoration(
|
60
|
-
"wiz-back", None, CONFIG.pxInt(370)
|
61
|
-
)
|
62
|
-
self.setWizardStyle(QWizard.ModernStyle)
|
63
|
-
self.setPixmap(QWizard.WatermarkPixmap, self.sideImage)
|
64
|
-
|
65
|
-
self.introPage = ProjWizardIntroPage(self)
|
66
|
-
self.storagePage = ProjWizardFolderPage(self)
|
67
|
-
self.popPage = ProjWizardPopulatePage(self)
|
68
|
-
self.customPage = ProjWizardCustomPage(self)
|
69
|
-
self.finalPage = ProjWizardFinalPage(self)
|
70
|
-
|
71
|
-
self.setPage(PAGE_INTRO, self.introPage)
|
72
|
-
self.setPage(PAGE_STORE, self.storagePage)
|
73
|
-
self.setPage(PAGE_POP, self.popPage)
|
74
|
-
self.setPage(PAGE_CUSTOM, self.customPage)
|
75
|
-
self.setPage(PAGE_FINAL, self.finalPage)
|
76
|
-
|
77
|
-
self.setOption(QWizard.NoBackButtonOnStartPage, True)
|
78
|
-
|
79
|
-
logger.debug("Ready: GuiProjectWizard")
|
80
|
-
|
81
|
-
return
|
82
|
-
|
83
|
-
def __del__(self): # pragma: no cover
|
84
|
-
logger.debug("Delete: GuiProjectWizard")
|
85
|
-
return
|
86
|
-
|
87
|
-
# END Class GuiProjectWizard
|
88
|
-
|
89
|
-
|
90
|
-
class ProjWizardIntroPage(QWizardPage):
|
91
|
-
|
92
|
-
def __init__(self, theWizard):
|
93
|
-
super().__init__()
|
94
|
-
|
95
|
-
self.setTitle(self.tr("Create New Project"))
|
96
|
-
self.theText = QLabel(self.tr(
|
97
|
-
"Provide at least a project name. The project name should not "
|
98
|
-
"be changed beyond this point as it is used for generating file "
|
99
|
-
"names for for instance backups. The other fields are optional "
|
100
|
-
"and can be changed at any time in Project Settings."
|
101
|
-
))
|
102
|
-
self.theText.setWordWrap(True)
|
103
|
-
|
104
|
-
self.imgCredit = QLabel(self.tr("Side image by {0}, {1}").format(
|
105
|
-
"Peter Mitterhofer", "CC BY-SA 4.0"
|
106
|
-
))
|
107
|
-
lblFont = self.imgCredit.font()
|
108
|
-
lblFont.setPointSizeF(0.6*SHARED.theme.fontPointSize)
|
109
|
-
self.imgCredit.setFont(lblFont)
|
110
|
-
|
111
|
-
xW = CONFIG.pxInt(300)
|
112
|
-
vS = CONFIG.pxInt(12)
|
113
|
-
fS = CONFIG.pxInt(4)
|
114
|
-
|
115
|
-
# The Page Form
|
116
|
-
self.projName = QLineEdit()
|
117
|
-
self.projName.setMaxLength(200)
|
118
|
-
self.projName.setFixedWidth(xW)
|
119
|
-
self.projName.setPlaceholderText(self.tr("Required"))
|
120
|
-
|
121
|
-
self.projTitle = QLineEdit()
|
122
|
-
self.projTitle.setMaxLength(200)
|
123
|
-
self.projTitle.setFixedWidth(xW)
|
124
|
-
self.projTitle.setPlaceholderText(self.tr("Optional"))
|
125
|
-
|
126
|
-
self.projAuthor = QLineEdit()
|
127
|
-
self.projAuthor.setMaxLength(200)
|
128
|
-
self.projAuthor.setFixedWidth(xW)
|
129
|
-
self.projAuthor.setPlaceholderText(self.tr("Optional"))
|
130
|
-
|
131
|
-
self.projLang = QComboBox(self)
|
132
|
-
self.projLang.setMaximumWidth(xW)
|
133
|
-
for tag, language in CONFIG.listLanguages(CONFIG.LANG_PROJ):
|
134
|
-
self.projLang.addItem(language, tag)
|
135
|
-
|
136
|
-
langIdx = self.projLang.findData(CONFIG.guiLocale)
|
137
|
-
if langIdx == -1:
|
138
|
-
langIdx = self.projLang.findData("en_GB")
|
139
|
-
if langIdx != -1:
|
140
|
-
self.projLang.setCurrentIndex(langIdx)
|
141
|
-
|
142
|
-
self.mainForm = QFormLayout()
|
143
|
-
self.mainForm.addRow(self.tr("Project Name"), self.projName)
|
144
|
-
self.mainForm.addRow(self.tr("Novel Title"), self.projTitle)
|
145
|
-
self.mainForm.addRow(self.tr("Author(s)"), self.projAuthor)
|
146
|
-
self.mainForm.addRow(self.tr("Language"), self.projLang)
|
147
|
-
self.mainForm.setVerticalSpacing(fS)
|
148
|
-
|
149
|
-
self.registerField("projName*", self.projName)
|
150
|
-
self.registerField("projTitle", self.projTitle)
|
151
|
-
self.registerField("projAuthor", self.projAuthor)
|
152
|
-
self.registerField("projLang", self.projLang)
|
153
|
-
|
154
|
-
# Assemble
|
155
|
-
self.outerBox = QVBoxLayout()
|
156
|
-
self.outerBox.setSpacing(vS)
|
157
|
-
self.outerBox.addWidget(self.theText)
|
158
|
-
self.outerBox.addLayout(self.mainForm)
|
159
|
-
self.outerBox.addStretch(1)
|
160
|
-
self.outerBox.addWidget(self.imgCredit)
|
161
|
-
self.setLayout(self.outerBox)
|
162
|
-
|
163
|
-
return
|
164
|
-
|
165
|
-
# END Class ProjWizardIntroPage
|
166
|
-
|
167
|
-
|
168
|
-
class ProjWizardFolderPage(QWizardPage):
|
169
|
-
|
170
|
-
def __init__(self, theWizard):
|
171
|
-
super().__init__()
|
172
|
-
|
173
|
-
self.setTitle(self.tr("Select Project Folder"))
|
174
|
-
self.theText = QLabel(self.tr(
|
175
|
-
"Select a location to store the project. A new project folder "
|
176
|
-
"will be created in the selected location."
|
177
|
-
))
|
178
|
-
self.theText.setWordWrap(True)
|
179
|
-
|
180
|
-
xW = CONFIG.pxInt(300)
|
181
|
-
vS = CONFIG.pxInt(12)
|
182
|
-
fS = CONFIG.pxInt(8)
|
183
|
-
|
184
|
-
self.projPath = QLineEdit("")
|
185
|
-
self.projPath.setFixedWidth(xW)
|
186
|
-
self.projPath.setPlaceholderText(self.tr("Required"))
|
187
|
-
|
188
|
-
self.browseButton = QPushButton("...")
|
189
|
-
self.browseButton.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("...")))
|
190
|
-
self.browseButton.clicked.connect(self._doBrowse)
|
191
|
-
|
192
|
-
self.errLabel = QLabel("")
|
193
|
-
self.errLabel.setWordWrap(True)
|
194
|
-
|
195
|
-
self.mainForm = QHBoxLayout()
|
196
|
-
self.mainForm.addWidget(QLabel(self.tr("Project Path")), 0)
|
197
|
-
self.mainForm.addWidget(self.projPath, 1)
|
198
|
-
self.mainForm.addWidget(self.browseButton, 0)
|
199
|
-
self.mainForm.setSpacing(fS)
|
200
|
-
|
201
|
-
self.registerField("projPath*", self.projPath)
|
202
|
-
|
203
|
-
# Assemble
|
204
|
-
self.outerBox = QVBoxLayout()
|
205
|
-
self.outerBox.setSpacing(vS)
|
206
|
-
self.outerBox.addWidget(self.theText)
|
207
|
-
self.outerBox.addLayout(self.mainForm)
|
208
|
-
self.outerBox.addWidget(self.errLabel)
|
209
|
-
self.outerBox.addStretch(1)
|
210
|
-
self.setLayout(self.outerBox)
|
211
|
-
|
212
|
-
return
|
213
|
-
|
214
|
-
def isComplete(self):
|
215
|
-
"""Check that the selected path isn't already being used.
|
216
|
-
"""
|
217
|
-
self.errLabel.setText("")
|
218
|
-
if not super().isComplete():
|
219
|
-
return False
|
220
|
-
|
221
|
-
setPath = os.path.abspath(os.path.expanduser(self.projPath.text()))
|
222
|
-
parPath = os.path.dirname(setPath)
|
223
|
-
logger.debug("Path is: %s", setPath)
|
224
|
-
if parPath and not os.path.isdir(parPath):
|
225
|
-
self.errLabel.setText(self.tr(
|
226
|
-
"Error: A project folder cannot be created using this path."
|
227
|
-
))
|
228
|
-
return False
|
229
|
-
|
230
|
-
if os.path.exists(setPath):
|
231
|
-
self.errLabel.setText(self.tr(
|
232
|
-
"Error: The selected path already exists."
|
233
|
-
))
|
234
|
-
return False
|
235
|
-
|
236
|
-
return True
|
237
|
-
|
238
|
-
##
|
239
|
-
# Slots
|
240
|
-
##
|
241
|
-
|
242
|
-
def _doBrowse(self):
|
243
|
-
"""Select a project folder.
|
244
|
-
"""
|
245
|
-
lastPath = CONFIG.lastPath()
|
246
|
-
projDir = QFileDialog.getExistingDirectory(
|
247
|
-
self, self.tr("Select Project Folder"), str(lastPath), options=QFileDialog.ShowDirsOnly
|
248
|
-
)
|
249
|
-
if projDir:
|
250
|
-
projName = self.field("projName")
|
251
|
-
if projName is not None:
|
252
|
-
fullDir = os.path.join(os.path.abspath(projDir), makeFileNameSafe(projName))
|
253
|
-
self.projPath.setText(fullDir)
|
254
|
-
else:
|
255
|
-
self.projPath.setText("")
|
256
|
-
|
257
|
-
return
|
258
|
-
|
259
|
-
# END Class ProjWizardFolderPage
|
260
|
-
|
261
|
-
|
262
|
-
class ProjWizardPopulatePage(QWizardPage):
|
263
|
-
|
264
|
-
def __init__(self, theWizard):
|
265
|
-
super().__init__()
|
266
|
-
|
267
|
-
self.setTitle(self.tr("Populate Project"))
|
268
|
-
self.theText = QLabel(self.tr(
|
269
|
-
"Choose how to pre-fill the project. Either with a minimal set of "
|
270
|
-
"starter items, an example project explaining and showing many of "
|
271
|
-
"the features, or show further custom options on the next page."
|
272
|
-
))
|
273
|
-
self.theText.setWordWrap(True)
|
274
|
-
|
275
|
-
vS = CONFIG.pxInt(12)
|
276
|
-
fS = CONFIG.pxInt(4)
|
277
|
-
|
278
|
-
self.popMinimal = QRadioButton(self.tr("Fill the project with a minimal set of items"))
|
279
|
-
self.popSample = QRadioButton(self.tr("Fill the project with example files"))
|
280
|
-
self.popCustom = QRadioButton(self.tr("Show detailed options for filling the project"))
|
281
|
-
self.popMinimal.setChecked(True)
|
282
|
-
|
283
|
-
self.popBox = QVBoxLayout()
|
284
|
-
self.popBox.setSpacing(fS)
|
285
|
-
self.popBox.addWidget(self.popMinimal)
|
286
|
-
self.popBox.addWidget(self.popSample)
|
287
|
-
self.popBox.addWidget(self.popCustom)
|
288
|
-
|
289
|
-
self.registerField("popMinimal", self.popMinimal)
|
290
|
-
self.registerField("popSample", self.popSample)
|
291
|
-
self.registerField("popCustom", self.popCustom)
|
292
|
-
|
293
|
-
# Assemble
|
294
|
-
self.outerBox = QVBoxLayout()
|
295
|
-
self.outerBox.setSpacing(vS)
|
296
|
-
self.outerBox.addWidget(self.theText)
|
297
|
-
self.outerBox.addLayout(self.popBox)
|
298
|
-
self.outerBox.addStretch(1)
|
299
|
-
self.setLayout(self.outerBox)
|
300
|
-
|
301
|
-
return
|
302
|
-
|
303
|
-
def nextId(self):
|
304
|
-
"""Overload the nextID function to skip further pages if custom
|
305
|
-
is not selected.
|
306
|
-
"""
|
307
|
-
if self.popCustom.isChecked():
|
308
|
-
return PAGE_CUSTOM
|
309
|
-
else:
|
310
|
-
return PAGE_FINAL
|
311
|
-
|
312
|
-
# END Class ProjWizardPopulatePage
|
313
|
-
|
314
|
-
|
315
|
-
class ProjWizardCustomPage(QWizardPage):
|
316
|
-
|
317
|
-
def __init__(self, theWizard):
|
318
|
-
super().__init__()
|
319
|
-
|
320
|
-
self.setTitle(self.tr("Custom Project Options"))
|
321
|
-
self.theText = QLabel(self.tr(
|
322
|
-
"Select which additional elements to populate the project with. "
|
323
|
-
"You can skip making chapters and add only scenes by setting the "
|
324
|
-
"number of chapters to 0."
|
325
|
-
))
|
326
|
-
self.theText.setWordWrap(True)
|
327
|
-
|
328
|
-
cM = CONFIG.pxInt(12)
|
329
|
-
mH = CONFIG.pxInt(26)
|
330
|
-
fS = CONFIG.pxInt(4)
|
331
|
-
|
332
|
-
# Root Folders
|
333
|
-
self.addPlot = NSwitch()
|
334
|
-
self.addPlot.setChecked(True)
|
335
|
-
self.addPlot.clicked.connect(self._syncSwitches)
|
336
|
-
|
337
|
-
self.addChar = NSwitch()
|
338
|
-
self.addChar.setChecked(True)
|
339
|
-
self.addChar.clicked.connect(self._syncSwitches)
|
340
|
-
|
341
|
-
self.addWorld = NSwitch()
|
342
|
-
self.addWorld.setChecked(False)
|
343
|
-
self.addWorld.clicked.connect(self._syncSwitches)
|
344
|
-
|
345
|
-
self.addNotes = NSwitch()
|
346
|
-
self.addNotes.setChecked(False)
|
347
|
-
|
348
|
-
# Generate Content
|
349
|
-
self.numChapters = QSpinBox()
|
350
|
-
self.numChapters.setRange(0, 100)
|
351
|
-
self.numChapters.setValue(5)
|
352
|
-
|
353
|
-
self.numScenes = QSpinBox()
|
354
|
-
self.numScenes.setRange(0, 200)
|
355
|
-
self.numScenes.setValue(5)
|
356
|
-
|
357
|
-
# Grid Form
|
358
|
-
self.addBox = QGridLayout()
|
359
|
-
self.addBox.addWidget(QLabel(self.tr("Add a folder for plot notes")), 0, 0)
|
360
|
-
self.addBox.addWidget(QLabel(self.tr("Add a folder for character notes")), 1, 0)
|
361
|
-
self.addBox.addWidget(QLabel(self.tr("Add a folder for location notes")), 2, 0)
|
362
|
-
self.addBox.addWidget(QLabel(self.tr("Add example notes to the above")), 3, 0)
|
363
|
-
self.addBox.addWidget(QLabel(self.tr("Add chapters to the novel folder")), 4, 0)
|
364
|
-
self.addBox.addWidget(QLabel(self.tr("Add scenes to each chapter")), 5, 0)
|
365
|
-
self.addBox.addWidget(self.addPlot, 0, 1, 1, 1, Qt.AlignRight)
|
366
|
-
self.addBox.addWidget(self.addChar, 1, 1, 1, 1, Qt.AlignRight)
|
367
|
-
self.addBox.addWidget(self.addWorld, 2, 1, 1, 1, Qt.AlignRight)
|
368
|
-
self.addBox.addWidget(self.addNotes, 3, 1, 1, 1, Qt.AlignRight)
|
369
|
-
self.addBox.addWidget(self.numChapters, 4, 1, 1, 1, Qt.AlignRight)
|
370
|
-
self.addBox.addWidget(self.numScenes, 5, 1, 1, 1, Qt.AlignRight)
|
371
|
-
self.addBox.setVerticalSpacing(fS)
|
372
|
-
self.addBox.setHorizontalSpacing(cM)
|
373
|
-
self.addBox.setContentsMargins(cM, 0, cM, 0)
|
374
|
-
self.addBox.setColumnStretch(2, 1)
|
375
|
-
for i in range(6):
|
376
|
-
self.addBox.setRowMinimumHeight(i, mH)
|
377
|
-
|
378
|
-
# Wizard Fields
|
379
|
-
self.registerField("addPlot", self.addPlot)
|
380
|
-
self.registerField("addChar", self.addChar)
|
381
|
-
self.registerField("addWorld", self.addWorld)
|
382
|
-
self.registerField("addNotes", self.addNotes)
|
383
|
-
self.registerField("numChapters", self.numChapters)
|
384
|
-
self.registerField("numScenes", self.numScenes)
|
385
|
-
|
386
|
-
# Assemble
|
387
|
-
self.outerBox = QVBoxLayout()
|
388
|
-
self.outerBox.setSpacing(cM)
|
389
|
-
self.outerBox.addWidget(self.theText)
|
390
|
-
self.outerBox.addLayout(self.addBox)
|
391
|
-
self.outerBox.addStretch(1)
|
392
|
-
self.setLayout(self.outerBox)
|
393
|
-
|
394
|
-
return
|
395
|
-
|
396
|
-
##
|
397
|
-
# Internal Functions
|
398
|
-
##
|
399
|
-
|
400
|
-
def _syncSwitches(self):
|
401
|
-
"""Check if the add notes option should also be switched off.
|
402
|
-
"""
|
403
|
-
addPlot = self.addPlot.isChecked()
|
404
|
-
addChar = self.addChar.isChecked()
|
405
|
-
addWorld = self.addWorld.isChecked()
|
406
|
-
if not (addPlot or addChar or addWorld):
|
407
|
-
self.addNotes.setChecked(False)
|
408
|
-
return
|
409
|
-
|
410
|
-
# END Class ProjWizardCustomPage
|
411
|
-
|
412
|
-
|
413
|
-
class ProjWizardFinalPage(QWizardPage):
|
414
|
-
|
415
|
-
def __init__(self, theWizard):
|
416
|
-
super().__init__()
|
417
|
-
|
418
|
-
self.setTitle(self.tr("Summary"))
|
419
|
-
self.theText = QLabel("")
|
420
|
-
self.theText.setWordWrap(True)
|
421
|
-
|
422
|
-
# Assemble
|
423
|
-
self.outerBox = QVBoxLayout()
|
424
|
-
self.outerBox.setSpacing(CONFIG.pxInt(12))
|
425
|
-
self.outerBox.addWidget(self.theText)
|
426
|
-
self.outerBox.addStretch(1)
|
427
|
-
self.setLayout(self.outerBox)
|
428
|
-
|
429
|
-
return
|
430
|
-
|
431
|
-
def initializePage(self):
|
432
|
-
"""Update the summary information on the final page.
|
433
|
-
"""
|
434
|
-
super().initializePage()
|
435
|
-
|
436
|
-
sumList = []
|
437
|
-
sumList.append(self.tr("Project Name: {0}").format(self.field("projName")))
|
438
|
-
sumList.append(self.tr("Project Path: {0}").format(self.field("projPath")))
|
439
|
-
|
440
|
-
if self.field("popMinimal"):
|
441
|
-
sumList.append(self.tr("Fill the project with a minimal set of items"))
|
442
|
-
elif self.field("popSample"):
|
443
|
-
sumList.append(self.tr("Fill the project with example files"))
|
444
|
-
elif self.field("popCustom"):
|
445
|
-
if self.field("addPlot"):
|
446
|
-
sumList.append(self.tr("Add a folder for plot notes"))
|
447
|
-
if self.field("addChar"):
|
448
|
-
sumList.append(self.tr("Add a folder for character notes"))
|
449
|
-
if self.field("addWorld"):
|
450
|
-
sumList.append(self.tr("Add a folder for location notes"))
|
451
|
-
if self.field("addNotes"):
|
452
|
-
sumList.append(self.tr("Add example notes to the above"))
|
453
|
-
if self.field("numChapters") > 0:
|
454
|
-
sumList.append(self.tr("Add {0} chapters to the novel folder").format(
|
455
|
-
self.field("numChapters")
|
456
|
-
))
|
457
|
-
if self.field("numScenes") > 0:
|
458
|
-
sumList.append(self.tr("Add {0} scenes to each chapter").format(
|
459
|
-
self.field("numScenes")
|
460
|
-
))
|
461
|
-
else:
|
462
|
-
if self.field("numScenes") > 0:
|
463
|
-
sumList.append(self.tr("Add {0} scenes").format(
|
464
|
-
self.field("numScenes")
|
465
|
-
))
|
466
|
-
|
467
|
-
self.theText.setText(
|
468
|
-
"<p>%s</p><p> • %s</p><p>%s</p>" % (
|
469
|
-
self.tr("You have selected the following:"),
|
470
|
-
"<br> • ".join(sumList),
|
471
|
-
self.tr("Press '{0}' to create the new project.").format(
|
472
|
-
self.tr("Done") if CONFIG.osDarwin else self.tr("Finish")
|
473
|
-
)
|
474
|
-
)
|
475
|
-
)
|
476
|
-
return
|
477
|
-
|
478
|
-
# END Class ProjWizardFinalPage
|
File without changes
|
File without changes
|