Add project fill box
This commit is contained in:
@@ -17,6 +17,7 @@ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
[Map]
|
||||
add = typ_plus.svg
|
||||
add_document = typ_document-add.svg
|
||||
alert_error = typ_delete-full.svg
|
||||
alert_info = typ_lightbulb-full.svg
|
||||
alert_question = typ_directions-full.svg
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m15.667 12h-2.4444v-2.4444c0-0.67589-0.54633-1.2222-1.2222-1.2222s-1.2222 0.54633-1.2222 1.2222v2.4444h-2.4444c-0.67589 0-1.2222 0.54633-1.2222 1.2222s0.54633 1.2222 1.2222 1.2222h2.4444v2.4444c0 0.67589 0.54633 1.2222 1.2222 1.2222s1.2222-0.54633 1.2222-1.2222v-2.4444h2.4444c0.67589 0 1.2222-0.54633 1.2222-1.2222s-0.54633-1.2222-1.2222-1.2222zm5.753-5.753-4.8889-4.8889c-0.22856-0.22978-0.539-0.35811-0.86411-0.35811h-9.7778c-2.0216 0-3.6667 1.6451-3.6667 3.6667v14.667c0 2.0216 1.6451 3.6667 3.6667 3.6667h12.222c2.0216 0 3.6667-1.6451 3.6667-3.6667v-12.222c0-0.32511-0.12833-0.63556-0.35811-0.86411zm-2.5923 0.86411h-1.3273c-1.0108 0-1.8333-0.82256-1.8333-1.8333v-1.3273zm-0.71622 13.444h-12.222c-0.67467 0-1.2222-0.54756-1.2222-1.2222v-14.667c0-0.67467 0.54756-1.2222 1.2222-1.2222h8.5556v1.8333c0 1.6854 1.3701 3.0556 3.0556 3.0556h1.8333v11c0 0.67467-0.54756 1.2222-1.2222 1.2222z" fill="#aeaeae" stroke-width="1.2222"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -17,6 +17,7 @@ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
[Map]
|
||||
add = typ_plus.svg
|
||||
add_document = typ_document-add.svg
|
||||
alert_error = typ_delete-full.svg
|
||||
alert_info = typ_lightbulb-full.svg
|
||||
alert_question = typ_directions-full.svg
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m15.667 12h-2.4444v-2.4444c0-0.67589-0.54633-1.2222-1.2222-1.2222s-1.2222 0.54633-1.2222 1.2222v2.4444h-2.4444c-0.67589 0-1.2222 0.54633-1.2222 1.2222s0.54633 1.2222 1.2222 1.2222h2.4444v2.4444c0 0.67589 0.54633 1.2222 1.2222 1.2222s1.2222-0.54633 1.2222-1.2222v-2.4444h2.4444c0.67589 0 1.2222-0.54633 1.2222-1.2222s-0.54633-1.2222-1.2222-1.2222zm5.753-5.753-4.8889-4.8889c-0.22856-0.22978-0.539-0.35811-0.86411-0.35811h-9.7778c-2.0216 0-3.6667 1.6451-3.6667 3.6667v14.667c0 2.0216 1.6451 3.6667 3.6667 3.6667h12.222c2.0216 0 3.6667-1.6451 3.6667-3.6667v-12.222c0-0.32511-0.12833-0.63556-0.35811-0.86411zm-2.5923 0.86411h-1.3273c-1.0108 0-1.8333-0.82256-1.8333-1.8333v-1.3273zm-0.71622 13.444h-12.222c-0.67467 0-1.2222-0.54756-1.2222-1.2222v-14.667c0-0.67467 0.54756-1.2222 1.2222-1.2222h8.5556v1.8333c0 1.6854 1.3701 3.0556 3.0556 3.0556h1.8333v11c0 0.67467-0.54756 1.2222-1.2222 1.2222z" fill-opacity=".78039" stroke-width="1.2222"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -466,10 +466,10 @@ class GuiIcons:
|
||||
"fmt_subscript", "fmt_superscript", "fmt_underline",
|
||||
|
||||
# General Button Icons
|
||||
"add", "backward", "bookmark", "browse", "checked", "close", "cross", "down", "edit",
|
||||
"export", "forward", "maximise", "menu", "minimise", "noncheckable", "panel", "refresh",
|
||||
"remove", "revert", "search_replace", "search", "settings", "star", "unchecked", "up",
|
||||
"view",
|
||||
"add", "add_document", "backward", "bookmark", "browse", "checked", "close", "cross",
|
||||
"down", "edit", "export", "forward", "maximise", "menu", "minimise", "noncheckable",
|
||||
"panel", "refresh", "remove", "revert", "search_replace", "search", "settings", "star",
|
||||
"unchecked", "up", "view",
|
||||
|
||||
# Switches
|
||||
"sticky-on", "sticky-off",
|
||||
|
||||
@@ -263,23 +263,33 @@ class _NewProjectPage(QWidget):
|
||||
|
||||
class _NewProjectForm(QWidget):
|
||||
|
||||
FILL_BLANK = 0
|
||||
FILL_SAMPLE = 1
|
||||
FILL_TEMPLATE = 2
|
||||
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self._basePath = CONFIG.lastPath()
|
||||
self._fillMode = self.FILL_BLANK
|
||||
self._tmplPath = None
|
||||
|
||||
# Project Settings
|
||||
# ================
|
||||
posLast = QLineEdit.ActionPosition.TrailingPosition
|
||||
|
||||
# Project Name
|
||||
self.projName = QLineEdit()
|
||||
self.projName.setMaxLength(200)
|
||||
self.projName.setPlaceholderText(self.tr("Required"))
|
||||
self.projName.textChanged.connect(self._updateProjPath)
|
||||
|
||||
# Author(s)
|
||||
self.projAuthor = QLineEdit()
|
||||
self.projAuthor.setMaxLength(200)
|
||||
self.projAuthor.setPlaceholderText(self.tr("Optional"))
|
||||
|
||||
# Project Language
|
||||
self.projLang = QComboBox(self)
|
||||
for tag, language in CONFIG.listLanguages(CONFIG.LANG_PROJ):
|
||||
self.projLang.addItem(language, tag)
|
||||
@@ -290,23 +300,25 @@ class _NewProjectForm(QWidget):
|
||||
if langIdx != -1:
|
||||
self.projLang.setCurrentIndex(langIdx)
|
||||
|
||||
self.projPath = QLineEdit("", self)
|
||||
# Project Path
|
||||
self.projPath = QLineEdit(self)
|
||||
self.projPath.setReadOnly(True)
|
||||
self.projPath.setPlaceholderText(self.tr("Required"))
|
||||
action = self.projPath.addAction(SHARED.theme.getIcon("browse"), posLast)
|
||||
action.triggered.connect(self._doBrowse)
|
||||
|
||||
self.browsePath = QPushButton(self)
|
||||
self.browsePath.setIcon(SHARED.theme.getIcon("browse"))
|
||||
self.browsePath.clicked.connect(self._doBrowse)
|
||||
|
||||
self.pathBox = QHBoxLayout()
|
||||
self.pathBox.addWidget(self.projPath)
|
||||
self.pathBox.addWidget(self.browsePath)
|
||||
# Fill Project
|
||||
self.projFill = QLineEdit(self)
|
||||
self.projFill.setReadOnly(True)
|
||||
action = self.projFill.addAction(SHARED.theme.getIcon("add_document"), posLast)
|
||||
|
||||
# Project Form
|
||||
self.projectForm = QFormLayout()
|
||||
self.projectForm.addRow(self.tr("Project Name"), self.projName)
|
||||
self.projectForm.addRow(self.tr("Author(s)"), self.projAuthor)
|
||||
self.projectForm.addRow(self.tr("Language"), self.projLang)
|
||||
self.projectForm.addRow(self.tr("Project Path"), self.pathBox)
|
||||
self.projectForm.addRow(self.tr("Project Path"), self.projPath)
|
||||
self.projectForm.addRow(self.tr("Prefill Project"), self.projFill)
|
||||
|
||||
# Chapters and Scenes
|
||||
# ===================
|
||||
@@ -364,6 +376,7 @@ class _NewProjectForm(QWidget):
|
||||
# ========
|
||||
|
||||
self.formBox = QVBoxLayout()
|
||||
self.formBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Create New Project"))))
|
||||
self.formBox.addLayout(self.projectForm)
|
||||
self.formBox.addSpacing(16)
|
||||
self.formBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Chapters and Scenes"))))
|
||||
@@ -376,6 +389,7 @@ class _NewProjectForm(QWidget):
|
||||
self.setLayout(self.formBox)
|
||||
|
||||
self._updateProjPath()
|
||||
self._updateFillInfo()
|
||||
|
||||
return
|
||||
|
||||
@@ -412,4 +426,27 @@ class _NewProjectForm(QWidget):
|
||||
self.addNotes.setChecked(False)
|
||||
return
|
||||
|
||||
##
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _updateFillInfo(self) -> None:
|
||||
"""Update the text of the project fill box."""
|
||||
if self._fillMode == self.FILL_BLANK:
|
||||
self.projFill.setText(self.tr("Fresh Project"))
|
||||
elif self._fillMode == self.FILL_SAMPLE:
|
||||
self.projFill.setText(self.tr("Example Project"))
|
||||
elif self._fillMode == self.FILL_TEMPLATE:
|
||||
self.projFill.setText(self.tr("Template: {0}").format(str(self._tmplPath)))
|
||||
|
||||
isBlank = self._fillMode == self.FILL_BLANK
|
||||
self.numChapters.setEnabled(isBlank)
|
||||
self.numScenes.setEnabled(isBlank)
|
||||
self.addPlot.setEnabled(isBlank)
|
||||
self.addChar.setEnabled(isBlank)
|
||||
self.addWorld.setEnabled(isBlank)
|
||||
self.addNotes.setEnabled(isBlank)
|
||||
|
||||
return
|
||||
|
||||
# END Class _NewProjectForm
|
||||
|
||||
Reference in New Issue
Block a user