Finished heading formats and file name in export
This commit is contained in:
+24
-8
@@ -73,21 +73,37 @@ class TextFile():
|
||||
self.theConv.setWordWrap(0)
|
||||
return
|
||||
|
||||
def setTitleFormat(self, fmtTitle):
|
||||
self.theConv.setTitleFormat(fmtTitle)
|
||||
return
|
||||
|
||||
def setChapterFormat(self, fmtChapter):
|
||||
self.theConv.setChapterFormat(fmtChapter)
|
||||
return
|
||||
|
||||
def setUnNumberedFormat(self, fmtUnNum):
|
||||
self.theConv.setUnNumberedFormat(fmtUnNum)
|
||||
return
|
||||
|
||||
def setSceneFormat(self, fmtScene):
|
||||
self.theConv.setSceneFormat(fmtScene)
|
||||
return
|
||||
|
||||
def setSectionFormat(self, fmtSection):
|
||||
self.theConv.setSectionFormat(fmtSection)
|
||||
return
|
||||
|
||||
##
|
||||
# Core Methods
|
||||
##
|
||||
|
||||
def openFile(self, saveTo, baseName):
|
||||
def openFile(self, filePath):
|
||||
|
||||
fileName = "%s.%s" % (baseName.strip(),self.fileExt)
|
||||
filePath = path.join(saveTo,fileName)
|
||||
|
||||
self.fileName = fileName
|
||||
|
||||
if path.isfile(filePath)and self.mainConf.showGUI:
|
||||
self.fileName = path.basename(filePath)
|
||||
if path.isfile(filePath) and self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self.theParent, "Overwrite", ("File '%s' already exists.<br>Do you want to overwrite it?" % fileName)
|
||||
self.theParent, "Overwrite", ("File '%s' already exists.<br>Do you want to overwrite it?" % self.fileName)
|
||||
)
|
||||
if msgRes != QMessageBox.Yes:
|
||||
return False
|
||||
|
||||
+24
-2
@@ -65,8 +65,8 @@ class Tokenizer():
|
||||
self.doCommands = False
|
||||
|
||||
self.fmtTitle = "%title%"
|
||||
self.fmtUnNum = "%title%"
|
||||
self.fmtChapter = "Chapter %numword%: %title%"
|
||||
self.fmtUnNum = "%title%"
|
||||
self.fmtScene = "* * *"
|
||||
self.fmtSection = "%title%"
|
||||
|
||||
@@ -96,6 +96,26 @@ class Tokenizer():
|
||||
self.wordWrap = 0
|
||||
return
|
||||
|
||||
def setTitleFormat(self, fmtTitle):
|
||||
self.fmtTitle = fmtTitle
|
||||
return
|
||||
|
||||
def setChapterFormat(self, fmtChapter):
|
||||
self.fmtChapter = fmtChapter
|
||||
return
|
||||
|
||||
def setUnNumberedFormat(self, fmtUnNum):
|
||||
self.fmtUnNum = fmtUnNum
|
||||
return
|
||||
|
||||
def setSceneFormat(self, fmtScene):
|
||||
self.fmtScene = fmtScene
|
||||
return
|
||||
|
||||
def setSectionFormat(self, fmtSection):
|
||||
self.fmtSection = fmtSection
|
||||
return
|
||||
|
||||
##
|
||||
# Class Methods
|
||||
##
|
||||
@@ -236,8 +256,10 @@ class Tokenizer():
|
||||
tTemp = self._doFormatSection(tText)
|
||||
if tTemp == "":
|
||||
self.theTokens[n] = (self.T_EMPTY,"",None,self.A_LEFT)
|
||||
else:
|
||||
elif tTemp == self.fmtSection:
|
||||
self.theTokens[n] = (self.T_SEP,tTemp,None,self.A_LEFT)
|
||||
else:
|
||||
self.theTokens[n] = (tType,tTemp,None,self.A_LEFT)
|
||||
|
||||
# For title page and partitions, we need to centre all text
|
||||
if isTitle or isPart:
|
||||
|
||||
Reference in New Issue
Block a user