Hide unused controls on new project form
This commit is contained in:
@@ -539,6 +539,7 @@ class _NewProjectForm(QWidget):
|
||||
self._copyPath = None
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
sPx = CONFIG.pxInt(16)
|
||||
|
||||
# Project Settings
|
||||
# ================
|
||||
@@ -668,15 +669,23 @@ class _NewProjectForm(QWidget):
|
||||
# Assemble
|
||||
# ========
|
||||
|
||||
self.extraBox = QVBoxLayout()
|
||||
self.extraBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Chapters and Scenes"))))
|
||||
self.extraBox.addLayout(self.novelForm)
|
||||
self.extraBox.addSpacing(sPx)
|
||||
self.extraBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Project Notes"))))
|
||||
self.extraBox.addLayout(self.notesForm)
|
||||
self.extraBox.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.extraWidget = QWidget(self)
|
||||
self.extraWidget.setLayout(self.extraBox)
|
||||
self.extraWidget.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
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"))))
|
||||
self.formBox.addLayout(self.novelForm)
|
||||
self.formBox.addSpacing(16)
|
||||
self.formBox.addWidget(QLabel("<b>{0}</b>".format(self.tr("Project Notes"))))
|
||||
self.formBox.addLayout(self.notesForm)
|
||||
self.formBox.addSpacing(sPx)
|
||||
self.formBox.addWidget(self.extraWidget)
|
||||
self.formBox.addStretch(1)
|
||||
|
||||
self.setLayout(self.formBox)
|
||||
@@ -782,14 +791,7 @@ class _NewProjectForm(QWidget):
|
||||
self.projFill.setText(text)
|
||||
self.projFill.setToolTip(text)
|
||||
self.projFill.setCursorPosition(0)
|
||||
|
||||
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)
|
||||
self.extraWidget.setVisible(self._fillMode == self.FILL_BLANK)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -196,12 +196,7 @@ def testToolWelcome_New(qtbot: QtBot, caplog, monkeypatch, nwGUI, fncPath):
|
||||
newForm.fillSample.trigger()
|
||||
assert newForm._fillMode == newForm.FILL_SAMPLE
|
||||
assert newForm.projFill.text() == "Example Project"
|
||||
assert newForm.addNotes.isEnabled() is False
|
||||
assert newForm.addPlot.isEnabled() is False
|
||||
assert newForm.addChar.isEnabled() is False
|
||||
assert newForm.addWorld.isEnabled() is False
|
||||
assert newForm.numChapters.isEnabled() is False
|
||||
assert newForm.numScenes.isEnabled() is False
|
||||
assert newForm.extraWidget.isVisible() is False
|
||||
|
||||
# Change fill info to template
|
||||
with monkeypatch.context() as mp:
|
||||
@@ -209,12 +204,7 @@ def testToolWelcome_New(qtbot: QtBot, caplog, monkeypatch, nwGUI, fncPath):
|
||||
newForm.fillCopy.trigger()
|
||||
assert newForm._fillMode == newForm.FILL_COPY
|
||||
assert newForm.projFill.text() == f"Template: {fncPath}"
|
||||
assert newForm.addNotes.isEnabled() is False
|
||||
assert newForm.addPlot.isEnabled() is False
|
||||
assert newForm.addChar.isEnabled() is False
|
||||
assert newForm.addWorld.isEnabled() is False
|
||||
assert newForm.numChapters.isEnabled() is False
|
||||
assert newForm.numScenes.isEnabled() is False
|
||||
assert newForm.extraWidget.isVisible() is False
|
||||
|
||||
# Change back to fill blank using the menu
|
||||
newForm.browseFill.click()
|
||||
@@ -223,12 +213,7 @@ def testToolWelcome_New(qtbot: QtBot, caplog, monkeypatch, nwGUI, fncPath):
|
||||
newForm.fillMenu.close()
|
||||
assert newForm._fillMode == newForm.FILL_BLANK
|
||||
assert newForm.projFill.text() == "Fresh Project"
|
||||
assert newForm.addNotes.isEnabled() is True
|
||||
assert newForm.addPlot.isEnabled() is True
|
||||
assert newForm.addChar.isEnabled() is True
|
||||
assert newForm.addWorld.isEnabled() is True
|
||||
assert newForm.numChapters.isEnabled() is True
|
||||
assert newForm.numScenes.isEnabled() is True
|
||||
assert newForm.extraWidget.isVisible() is True
|
||||
|
||||
# Creating a project without a name, pops an error
|
||||
caplog.clear()
|
||||
|
||||
Reference in New Issue
Block a user