Allow hiding scene and section titles in export builds (#974)

This commit is contained in:
Veronica Berglyd Olsen
2022-01-23 15:57:51 +01:00
committed by GitHub
parent ec07cebb51
commit 1a9efa4e1e
2 changed files with 47 additions and 24 deletions
+5 -4
View File
@@ -42,10 +42,11 @@ VALID_MAP = {
},
"GuiDocSplit": {"spLevel"},
"GuiBuildNovel": {
"winWidth", "winHeight", "boxWidth", "docWidth", "addNovel",
"addNotes", "ignoreFlag", "justifyText", "excludeBody", "textFont",
"textSize", "lineHeight", "noStyling", "incSynopsis", "incComments",
"incKeywords", "incBodyText", "replaceTabs", "replaceUCode"
"winWidth", "winHeight", "boxWidth", "docWidth", "hideScene",
"hideSection", "addNovel", "addNotes", "ignoreFlag", "justifyText",
"excludeBody", "textFont", "textSize", "lineHeight", "noStyling",
"incSynopsis", "incComments", "incKeywords", "incBodyText",
"replaceTabs", "replaceUCode"
},
"GuiOutline": {"headerOrder", "columnWidth", "columnHidden"},
"GuiProjectSettings": {
+42 -20
View File
@@ -172,6 +172,16 @@ class GuiBuildNovel(QDialog):
if langIdx != -1:
self.buildLang.setCurrentIndex(langIdx)
self.hideScene = QSwitch(width=wS, height=hS)
self.hideScene.setChecked(
self.optState.getBool("GuiBuildNovel", "hideScene", False)
)
self.hideSection = QSwitch(width=wS, height=hS)
self.hideSection.setChecked(
self.optState.getBool("GuiBuildNovel", "hideSection", True)
)
# Wrapper boxes due to QGridView and QLineEdit expand bug
self.boxTitle = QHBoxLayout()
self.boxTitle.addWidget(self.fmtTitle)
@@ -184,25 +194,31 @@ class GuiBuildNovel(QDialog):
self.boxSection = QHBoxLayout()
self.boxSection.addWidget(self.fmtSection)
titleLabel = QLabel(self.tr("Title"))
chapterLabel = QLabel(self.tr("Chapter"))
unnumbLabel = QLabel(self.tr("Unnumbered"))
sceneLabel = QLabel(self.tr("Scene"))
sectionLabel = QLabel(self.tr("Section"))
langLabel = QLabel(self.tr("Language"))
titleLabel = QLabel(self.tr("Title"))
chapterLabel = QLabel(self.tr("Chapter"))
unnumbLabel = QLabel(self.tr("Unnumbered"))
sceneLabel = QLabel(self.tr("Scene"))
sectionLabel = QLabel(self.tr("Section"))
langLabel = QLabel(self.tr("Language"))
hSceneLabel = QLabel(self.tr("Hide scene"))
hSectionLabel = QLabel(self.tr("Hide section"))
self.titleForm.addWidget(titleLabel, 0, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxTitle, 0, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(chapterLabel, 1, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxChapter, 1, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(unnumbLabel, 2, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxUnnumb, 2, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(sceneLabel, 3, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxScene, 3, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(sectionLabel, 4, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxSection, 4, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(langLabel, 5, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addWidget(self.buildLang, 5, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(titleLabel, 0, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxTitle, 0, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(chapterLabel, 1, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxChapter, 1, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(unnumbLabel, 2, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxUnnumb, 2, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(sceneLabel, 3, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxScene, 3, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(sectionLabel, 4, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addLayout(self.boxSection, 4, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(langLabel, 5, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addWidget(self.buildLang, 5, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(hSceneLabel, 6, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addWidget(self.hideScene, 6, 1, 1, 1, Qt.AlignRight)
self.titleForm.addWidget(hSectionLabel, 7, 0, 1, 1, Qt.AlignLeft)
self.titleForm.addWidget(self.hideSection, 7, 1, 1, 1, Qt.AlignRight)
self.titleForm.setColumnStretch(0, 0)
self.titleForm.setColumnStretch(1, 1)
@@ -643,6 +659,8 @@ class GuiBuildNovel(QDialog):
fmtUnnumbered = self.fmtUnnumbered.text()
fmtScene = self.fmtScene.text()
fmtSection = self.fmtSection.text()
hideScene = self.hideScene.isChecked()
hideSection = self.hideSection.isChecked()
textFont = self.textFont.text()
textSize = self.textSize.value()
lineHeight = self.lineHeight.value()
@@ -670,8 +688,8 @@ class GuiBuildNovel(QDialog):
bldObj.setTitleFormat(fmtTitle)
bldObj.setChapterFormat(fmtChapter)
bldObj.setUnNumberedFormat(fmtUnnumbered)
bldObj.setSceneFormat(fmtScene, False)
bldObj.setSectionFormat(fmtSection, fmtSection == "")
bldObj.setSceneFormat(fmtScene, hideScene)
bldObj.setSectionFormat(fmtSection, hideSection)
bldObj.setFont(textFont, textSize, textFixed)
bldObj.setJustify(justifyText)
@@ -1115,6 +1133,8 @@ class GuiBuildNovel(QDialog):
})
buildLang = self.buildLang.currentData()
hideScene = self.hideScene.isChecked()
hideSection = self.hideSection.isChecked()
winWidth = self.mainConf.rpxInt(self.width())
winHeight = self.mainConf.rpxInt(self.height())
justifyText = self.justifyText.isChecked()
@@ -1139,6 +1159,8 @@ class GuiBuildNovel(QDialog):
self.theProject.setProjectLang(buildLang)
# GUI Settings
self.optState.setValue("GuiBuildNovel", "hideScene", hideScene)
self.optState.setValue("GuiBuildNovel", "hideSection", hideSection)
self.optState.setValue("GuiBuildNovel", "winWidth", winWidth)
self.optState.setValue("GuiBuildNovel", "winHeight", winHeight)
self.optState.setValue("GuiBuildNovel", "boxWidth", boxWidth)