Also make tree and options properties of the project

This commit is contained in:
Veronica Berglyd Olsen
2022-05-28 14:33:25 +02:00
parent 8bdd09400a
commit 44926a4e9a
28 changed files with 324 additions and 315 deletions
+45 -45
View File
@@ -75,7 +75,6 @@ class GuiBuildNovel(QDialog):
self.theParent = theParent
self.theTheme = theParent.theTheme
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.htmlText = [] # List of html documents
self.htmlStyle = [] # List of html styles
@@ -86,9 +85,10 @@ class GuiBuildNovel(QDialog):
self.setMinimumWidth(self.mainConf.pxInt(700))
self.setMinimumHeight(self.mainConf.pxInt(600))
pOptions = self.theProject.options
self.resize(
self.mainConf.pxInt(self.optState.getInt("GuiBuildNovel", "winWidth", 900)),
self.mainConf.pxInt(self.optState.getInt("GuiBuildNovel", "winHeight", 800))
self.mainConf.pxInt(pOptions.getInt("GuiBuildNovel", "winWidth", 900)),
self.mainConf.pxInt(pOptions.getInt("GuiBuildNovel", "winHeight", 800))
)
self.docView = GuiBuildNovelDocView(self, self.theProject)
@@ -174,12 +174,12 @@ class GuiBuildNovel(QDialog):
self.hideScene = QSwitch(width=wS, height=hS)
self.hideScene.setChecked(
self.optState.getBool("GuiBuildNovel", "hideScene", False)
pOptions.getBool("GuiBuildNovel", "hideScene", False)
)
self.hideSection = QSwitch(width=wS, height=hS)
self.hideSection.setChecked(
self.optState.getBool("GuiBuildNovel", "hideSection", True)
pOptions.getBool("GuiBuildNovel", "hideSection", True)
)
# Wrapper boxes due to QGridView and QLineEdit expand bug
@@ -235,7 +235,7 @@ class GuiBuildNovel(QDialog):
self.textFont.setReadOnly(True)
self.textFont.setMinimumWidth(xFmt)
self.textFont.setText(
self.optState.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)
pOptions.getString("GuiBuildNovel", "textFont", self.mainConf.textFont)
)
self.fontButton = QPushButton("...")
self.fontButton.setMaximumWidth(int(2.5*self.theTheme.getTextWidth("...")))
@@ -247,7 +247,7 @@ class GuiBuildNovel(QDialog):
self.textSize.setMaximum(72)
self.textSize.setSingleStep(1)
self.textSize.setValue(
self.optState.getInt("GuiBuildNovel", "textSize", self.mainConf.textSize)
pOptions.getInt("GuiBuildNovel", "textSize", self.mainConf.textSize)
)
self.lineHeight = QDoubleSpinBox(self)
@@ -257,7 +257,7 @@ class GuiBuildNovel(QDialog):
self.lineHeight.setSingleStep(0.05)
self.lineHeight.setDecimals(2)
self.lineHeight.setValue(
self.optState.getFloat("GuiBuildNovel", "lineHeight", 1.15)
pOptions.getFloat("GuiBuildNovel", "lineHeight", 1.15)
)
# Wrapper box due to QGridView and QLineEdit expand bug
@@ -291,12 +291,12 @@ class GuiBuildNovel(QDialog):
self.justifyText = QSwitch(width=wS, height=hS)
self.justifyText.setChecked(
self.optState.getBool("GuiBuildNovel", "justifyText", False)
pOptions.getBool("GuiBuildNovel", "justifyText", False)
)
self.noStyling = QSwitch(width=wS, height=hS)
self.noStyling.setChecked(
self.optState.getBool("GuiBuildNovel", "noStyling", False)
pOptions.getBool("GuiBuildNovel", "noStyling", False)
)
self.styleForm.addWidget(justifyLabel, 1, 0, 1, 1, Qt.AlignLeft)
@@ -316,22 +316,22 @@ class GuiBuildNovel(QDialog):
self.includeSynopsis = QSwitch(width=wS, height=hS)
self.includeSynopsis.setChecked(
self.optState.getBool("GuiBuildNovel", "incSynopsis", False)
pOptions.getBool("GuiBuildNovel", "incSynopsis", False)
)
self.includeComments = QSwitch(width=wS, height=hS)
self.includeComments.setChecked(
self.optState.getBool("GuiBuildNovel", "incComments", False)
pOptions.getBool("GuiBuildNovel", "incComments", False)
)
self.includeKeywords = QSwitch(width=wS, height=hS)
self.includeKeywords.setChecked(
self.optState.getBool("GuiBuildNovel", "incKeywords", False)
pOptions.getBool("GuiBuildNovel", "incKeywords", False)
)
self.includeBody = QSwitch(width=wS, height=hS)
self.includeBody.setChecked(
self.optState.getBool("GuiBuildNovel", "incBodyText", True)
pOptions.getBool("GuiBuildNovel", "incBodyText", True)
)
synopsisLabel = QLabel(self.tr("Include synopsis"))
@@ -360,17 +360,17 @@ class GuiBuildNovel(QDialog):
self.novelFiles = QSwitch(width=wS, height=hS)
self.novelFiles.setChecked(
self.optState.getBool("GuiBuildNovel", "addNovel", True)
pOptions.getBool("GuiBuildNovel", "addNovel", True)
)
self.noteFiles = QSwitch(width=wS, height=hS)
self.noteFiles.setChecked(
self.optState.getBool("GuiBuildNovel", "addNotes", False)
pOptions.getBool("GuiBuildNovel", "addNotes", False)
)
self.ignoreFlag = QSwitch(width=wS, height=hS)
self.ignoreFlag.setChecked(
self.optState.getBool("GuiBuildNovel", "ignoreFlag", False)
pOptions.getBool("GuiBuildNovel", "ignoreFlag", False)
)
novelLabel = QLabel(self.tr("Include novel files"))
@@ -396,12 +396,12 @@ class GuiBuildNovel(QDialog):
self.replaceTabs = QSwitch(width=wS, height=hS)
self.replaceTabs.setChecked(
self.optState.getBool("GuiBuildNovel", "replaceTabs", False)
pOptions.getBool("GuiBuildNovel", "replaceTabs", False)
)
self.replaceUCode = QSwitch(width=wS, height=hS)
self.replaceUCode.setChecked(
self.optState.getBool("GuiBuildNovel", "replaceUCode", False)
pOptions.getBool("GuiBuildNovel", "replaceUCode", False)
)
tabsLabel = QLabel(self.tr("Replace tabs with spaces"))
@@ -493,9 +493,9 @@ class GuiBuildNovel(QDialog):
# Splitter Position
boxWidth = self.mainConf.pxInt(350)
boxWidth = self.optState.getInt("GuiBuildNovel", "boxWidth", boxWidth)
boxWidth = pOptions.getInt("GuiBuildNovel", "boxWidth", boxWidth)
docWidth = max(self.width() - boxWidth, 100)
docWidth = self.optState.getInt("GuiBuildNovel", "docWidth", docWidth)
docWidth = pOptions.getInt("GuiBuildNovel", "docWidth", docWidth)
# The Tool Box
self.toolsBox = QVBoxLayout()
@@ -712,10 +712,10 @@ class GuiBuildNovel(QDialog):
self.theParent.treeView.flushTreeOrder()
self.theParent.saveDocument()
self.buildProgress.setMaximum(len(self.theProject.projTree))
self.buildProgress.setMaximum(len(self.theProject.tree))
self.buildProgress.setValue(0)
for nItt, tItem in enumerate(self.theProject.projTree):
for nItt, tItem in enumerate(self.theProject.tree):
noteRoot = noteFiles
noteRoot &= tItem.itemType == nwItemType.ROOT
@@ -1153,28 +1153,28 @@ 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)
self.optState.setValue("GuiBuildNovel", "docWidth", docWidth)
self.optState.setValue("GuiBuildNovel", "justifyText", justifyText)
self.optState.setValue("GuiBuildNovel", "noStyling", noStyling)
self.optState.setValue("GuiBuildNovel", "textFont", textFont)
self.optState.setValue("GuiBuildNovel", "textSize", textSize)
self.optState.setValue("GuiBuildNovel", "lineHeight", lineHeight)
self.optState.setValue("GuiBuildNovel", "addNovel", novelFiles)
self.optState.setValue("GuiBuildNovel", "addNotes", noteFiles)
self.optState.setValue("GuiBuildNovel", "ignoreFlag", ignoreFlag)
self.optState.setValue("GuiBuildNovel", "incSynopsis", incSynopsis)
self.optState.setValue("GuiBuildNovel", "incComments", incComments)
self.optState.setValue("GuiBuildNovel", "incKeywords", incKeywords)
self.optState.setValue("GuiBuildNovel", "incBodyText", incBodyText)
self.optState.setValue("GuiBuildNovel", "replaceTabs", replaceTabs)
self.optState.setValue("GuiBuildNovel", "replaceUCode", replaceUCode)
self.optState.saveSettings()
pOptions = self.theProject.options
pOptions.setValue("GuiBuildNovel", "hideScene", hideScene)
pOptions.setValue("GuiBuildNovel", "hideSection", hideSection)
pOptions.setValue("GuiBuildNovel", "winWidth", winWidth)
pOptions.setValue("GuiBuildNovel", "winHeight", winHeight)
pOptions.setValue("GuiBuildNovel", "boxWidth", boxWidth)
pOptions.setValue("GuiBuildNovel", "docWidth", docWidth)
pOptions.setValue("GuiBuildNovel", "justifyText", justifyText)
pOptions.setValue("GuiBuildNovel", "noStyling", noStyling)
pOptions.setValue("GuiBuildNovel", "textFont", textFont)
pOptions.setValue("GuiBuildNovel", "textSize", textSize)
pOptions.setValue("GuiBuildNovel", "lineHeight", lineHeight)
pOptions.setValue("GuiBuildNovel", "addNovel", novelFiles)
pOptions.setValue("GuiBuildNovel", "addNotes", noteFiles)
pOptions.setValue("GuiBuildNovel", "ignoreFlag", ignoreFlag)
pOptions.setValue("GuiBuildNovel", "incSynopsis", incSynopsis)
pOptions.setValue("GuiBuildNovel", "incComments", incComments)
pOptions.setValue("GuiBuildNovel", "incKeywords", incKeywords)
pOptions.setValue("GuiBuildNovel", "incBodyText", incBodyText)
pOptions.setValue("GuiBuildNovel", "replaceTabs", replaceTabs)
pOptions.setValue("GuiBuildNovel", "replaceUCode", replaceUCode)
pOptions.saveSettings()
return