Clean up the Build dialog and connect new options
This commit is contained in:
@@ -80,6 +80,7 @@ class OptionState():
|
|||||||
"incKeywords",
|
"incKeywords",
|
||||||
"incBodyText",
|
"incBodyText",
|
||||||
"replaceTabs",
|
"replaceTabs",
|
||||||
|
"replaceUCode",
|
||||||
},
|
},
|
||||||
"GuiOutline": {
|
"GuiOutline": {
|
||||||
"headerOrder",
|
"headerOrder",
|
||||||
|
|||||||
+25
-14
@@ -55,15 +55,17 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class GuiBuildNovel(QDialog):
|
class GuiBuildNovel(QDialog):
|
||||||
|
|
||||||
FMT_ODT = 1
|
FMT_PDF = 1 # Print to PDF
|
||||||
FMT_FODT = 2
|
|
||||||
FMT_PDF = 3
|
FMT_ODT = 2 # Open Document file
|
||||||
FMT_HTM = 4
|
FMT_FODT = 3 # Flat Open Document file
|
||||||
FMT_MD = 5
|
FMT_HTM = 4 # HTML5
|
||||||
FMT_GH = 6
|
FMT_NWD = 5 # nW Markdown
|
||||||
FMT_NWD = 7
|
FMT_MD = 6 # Standard Markdown
|
||||||
FMT_JSON_H = 8
|
FMT_GH = 7 # GitHub Markdown
|
||||||
FMT_JSON_M = 9
|
|
||||||
|
FMT_JSON_H = 8 # HTML5 wrapped in JSON
|
||||||
|
FMT_JSON_M = 9 # nW Markdown wrapped in JSON
|
||||||
|
|
||||||
def __init__(self, theParent, theProject):
|
def __init__(self, theParent, theProject):
|
||||||
QDialog.__init__(self, theParent)
|
QDialog.__init__(self, theParent)
|
||||||
@@ -379,10 +381,18 @@ class GuiBuildNovel(QDialog):
|
|||||||
self.optState.getBool("GuiBuildNovel", "replaceTabs", False)
|
self.optState.getBool("GuiBuildNovel", "replaceTabs", False)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.replaceUCode = QSwitch(width=wS, height=hS)
|
||||||
|
self.replaceUCode.setChecked(
|
||||||
|
self.optState.getBool("GuiBuildNovel", "replaceUCode", False)
|
||||||
|
)
|
||||||
|
|
||||||
tabsLabel = QLabel("Replace tabs with spaces")
|
tabsLabel = QLabel("Replace tabs with spaces")
|
||||||
|
uCodeLabel = QLabel("Replace Unicode in HTML")
|
||||||
|
|
||||||
self.exportForm.addWidget(tabsLabel, 0, 0, 1, 1, Qt.AlignLeft)
|
self.exportForm.addWidget(tabsLabel, 0, 0, 1, 1, Qt.AlignLeft)
|
||||||
self.exportForm.addWidget(self.replaceTabs, 0, 1, 1, 1, Qt.AlignRight)
|
self.exportForm.addWidget(self.replaceTabs, 0, 1, 1, 1, Qt.AlignRight)
|
||||||
|
self.exportForm.addWidget(uCodeLabel, 1, 0, 1, 1, Qt.AlignLeft)
|
||||||
|
self.exportForm.addWidget(self.replaceUCode, 1, 1, 1, 1, Qt.AlignRight)
|
||||||
|
|
||||||
self.exportForm.setColumnStretch(0, 1)
|
self.exportForm.setColumnStretch(0, 1)
|
||||||
self.exportForm.setColumnStretch(1, 0)
|
self.exportForm.setColumnStretch(1, 0)
|
||||||
@@ -643,6 +653,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
noteFiles = self.noteFiles.isChecked()
|
noteFiles = self.noteFiles.isChecked()
|
||||||
ignoreFlag = self.ignoreFlag.isChecked()
|
ignoreFlag = self.ignoreFlag.isChecked()
|
||||||
includeBody = self.includeBody.isChecked()
|
includeBody = self.includeBody.isChecked()
|
||||||
|
replaceUCode = self.replaceUCode.isChecked()
|
||||||
|
|
||||||
# Get font information
|
# Get font information
|
||||||
fontInfo = QFontInfo(QFont(textFont, textSize))
|
fontInfo = QFontInfo(QFont(textFont, textSize))
|
||||||
@@ -668,6 +679,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
|
|
||||||
if isHtml:
|
if isHtml:
|
||||||
bldObj.setStyles(not noStyling)
|
bldObj.setStyles(not noStyling)
|
||||||
|
bldObj.setReplaceUnicode(replaceUCode)
|
||||||
|
|
||||||
if isOdt:
|
if isOdt:
|
||||||
bldObj.setColourHeaders(not noStyling)
|
bldObj.setColourHeaders(not noStyling)
|
||||||
@@ -696,7 +708,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
|
|
||||||
elif self._checkInclude(tItem, noteFiles, novelFiles, ignoreFlag):
|
elif self._checkInclude(tItem, noteFiles, novelFiles, ignoreFlag):
|
||||||
bldObj.setText(tItem.itemHandle)
|
bldObj.setText(tItem.itemHandle)
|
||||||
bldObj.doAutoReplace()
|
bldObj.doPreProcessing()
|
||||||
bldObj.tokenizeText()
|
bldObj.tokenizeText()
|
||||||
bldObj.doHeaders()
|
bldObj.doHeaders()
|
||||||
if doConvert:
|
if doConvert:
|
||||||
@@ -1122,14 +1134,11 @@ class GuiBuildNovel(QDialog):
|
|||||||
incKeywords = self.includeKeywords.isChecked()
|
incKeywords = self.includeKeywords.isChecked()
|
||||||
incBodyText = self.includeBody.isChecked()
|
incBodyText = self.includeBody.isChecked()
|
||||||
replaceTabs = self.replaceTabs.isChecked()
|
replaceTabs = self.replaceTabs.isChecked()
|
||||||
|
replaceUCode = self.replaceUCode.isChecked()
|
||||||
|
|
||||||
mainSplit = self.mainSplit.sizes()
|
mainSplit = self.mainSplit.sizes()
|
||||||
if len(mainSplit) == 2:
|
|
||||||
boxWidth = self.mainConf.rpxInt(mainSplit[0])
|
boxWidth = self.mainConf.rpxInt(mainSplit[0])
|
||||||
docWidth = self.mainConf.rpxInt(mainSplit[1])
|
docWidth = self.mainConf.rpxInt(mainSplit[1])
|
||||||
else:
|
|
||||||
boxWidth = 100
|
|
||||||
docWidth = 100
|
|
||||||
|
|
||||||
# GUI Settings
|
# GUI Settings
|
||||||
self.optState.setValue("GuiBuildNovel", "winWidth", winWidth)
|
self.optState.setValue("GuiBuildNovel", "winWidth", winWidth)
|
||||||
@@ -1149,6 +1158,8 @@ class GuiBuildNovel(QDialog):
|
|||||||
self.optState.setValue("GuiBuildNovel", "incKeywords", incKeywords)
|
self.optState.setValue("GuiBuildNovel", "incKeywords", incKeywords)
|
||||||
self.optState.setValue("GuiBuildNovel", "incBodyText", incBodyText)
|
self.optState.setValue("GuiBuildNovel", "incBodyText", incBodyText)
|
||||||
self.optState.setValue("GuiBuildNovel", "replaceTabs", replaceTabs)
|
self.optState.setValue("GuiBuildNovel", "replaceTabs", replaceTabs)
|
||||||
|
self.optState.setValue("GuiBuildNovel", "replaceUCode", replaceUCode)
|
||||||
|
|
||||||
self.optState.saveSettings()
|
self.optState.saveSettings()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user