From 16f1b03781239d2dc4878ccd7aa508a7d8fdd8da Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 19 Oct 2019 12:05:04 +0200 Subject: [PATCH] Export icon and a few GUI changes --- nw/graphics/export.svg | 44 ++++++++++++++++++++++++++++++++++++++++++ nw/graphics/export.txt | 3 +++ nw/gui/export.py | 43 ++++++++++++++++++++++++++++++----------- 3 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 nw/graphics/export.svg create mode 100644 nw/graphics/export.txt diff --git a/nw/graphics/export.svg b/nw/graphics/export.svg new file mode 100644 index 00000000..9594a980 --- /dev/null +++ b/nw/graphics/export.svg @@ -0,0 +1,44 @@ + +image/svg+xml \ No newline at end of file diff --git a/nw/graphics/export.txt b/nw/graphics/export.txt new file mode 100644 index 00000000..1a65e8da --- /dev/null +++ b/nw/graphics/export.txt @@ -0,0 +1,3 @@ +FROM ICON SET: Typicons +LICENSE: Creative Commons (Attribution-Share Alike 3.0 Unported) +https://creativecommons.org/licenses/by-sa/3.0/ diff --git a/nw/gui/export.py b/nw/gui/export.py index c7dcf7d5..566a6a9f 100644 --- a/nw/gui/export.py +++ b/nw/gui/export.py @@ -50,7 +50,7 @@ class GuiExport(QDialog): self.setWindowTitle("Export Project") self.setLayout(self.outerBox) - self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg")) + self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","export.svg")) self.svgGradient = QSvgWidget(self.gradPath) self.svgGradient.setFixedSize(QSize(64,64)) @@ -162,7 +162,9 @@ class GuiExport(QDialog): eFormat = self.tabMain.outputFormat.currentData() wComments = self.tabMain.outputComments.isChecked() chFormat = self.tabMain.chapterFormat.text() + unFormat = self.tabMain.unnumFormat.text() scFormat = self.tabMain.sceneFormat.text() + seFormat = self.tabMain.sectionFormat.text() saveTo = self.tabMain.exportPath.text() self.optState.setSetting("wNovel", wNovel) @@ -171,7 +173,9 @@ class GuiExport(QDialog): self.optState.setSetting("eFormat", eFormat) self.optState.setSetting("wComments",wComments) self.optState.setSetting("chFormat", chFormat) + self.optState.setSetting("unFormat", unFormat) self.optState.setSetting("scFormat", scFormat) + self.optState.setSetting("seFormat", seFormat) self.optState.setSetting("saveTo", saveTo) self.optState.saveSettings() @@ -248,17 +252,24 @@ class GuiExportMain(QWidget): self.guiFilesForm.addWidget(self.expTOC, 2, 1) # Chapter Settings - self.guiChapters = QGroupBox("Chapter Heading", self) + self.guiChapters = QGroupBox("Chapter Headings", self) self.guiChaptersForm = QGridLayout(self) self.guiChapters.setLayout(self.guiChaptersForm) self.chapterFormat = QLineEdit() self.chapterFormat.setText(self.optState.getSetting("chFormat")) - self.chapterFormat.setToolTip("Available formats: %num%, %numword%, %title%, %label%") + self.chapterFormat.setToolTip("Available formats: %num%, %numword%, %title%") self.chapterFormat.setMinimumWidth(250) - self.guiChaptersForm.addWidget(QLabel("Numbered"), 0, 0) - self.guiChaptersForm.addWidget(self.chapterFormat, 0, 1) + self.unnumFormat = QLineEdit() + self.unnumFormat.setText(self.optState.getSetting("unFormat")) + self.unnumFormat.setToolTip("Available formats: %title%") + self.unnumFormat.setMinimumWidth(250) + + self.guiChaptersForm.addWidget(QLabel("Numbered"), 0, 0) + self.guiChaptersForm.addWidget(self.chapterFormat, 0, 1) + self.guiChaptersForm.addWidget(QLabel("Unnumbered"), 1, 0) + self.guiChaptersForm.addWidget(self.unnumFormat, 1, 1) # Output Format self.guiOutput = QGroupBox("Output", self) @@ -293,8 +304,8 @@ class GuiExportMain(QWidget): self.guiOutputForm.addWidget(self.outputHelp, 1, 0, 1, 3) self.guiOutputForm.setColumnStretch(2, 1) - # Scene Settings - self.guiScenes = QGroupBox("Scenes", self) + # Scene and Section Settings + self.guiScenes = QGroupBox("Other Headings", self) self.guiScenesForm = QGridLayout(self) self.guiScenes.setLayout(self.guiScenesForm) @@ -303,11 +314,18 @@ class GuiExportMain(QWidget): self.sceneFormat.setToolTip("Available formats: %title%") self.sceneFormat.setMinimumWidth(100) - self.guiScenesForm.addWidget(QLabel("Format"), 0, 0) - self.guiScenesForm.addWidget(self.sceneFormat, 0, 1) + self.sectionFormat = QLineEdit() + self.sectionFormat.setText(self.optState.getSetting("seFormat")) + self.sectionFormat.setToolTip("Available formats: %title%") + self.sectionFormat.setMinimumWidth(100) + + self.guiScenesForm.addWidget(QLabel("Scenes"), 0, 0) + self.guiScenesForm.addWidget(self.sceneFormat, 0, 1) + self.guiScenesForm.addWidget(QLabel("Sections"), 1, 0) + self.guiScenesForm.addWidget(self.sectionFormat, 1, 1) # Output Path - self.exportTo = QGroupBox("Backup", self) + self.exportTo = QGroupBox("Export Folder", self) self.exportToForm = QGridLayout(self) self.exportTo.setLayout(self.exportToForm) @@ -392,16 +410,19 @@ class ExportLastState(): def loadSettings(self): stateFile = path.join(self.theProject.projMeta, nwFiles.EXPORT_OPT) + theState = {} if path.isfile(stateFile): logger.debug("Loading export options file") try: with open(stateFile,mode="r") as inFile: theJson = inFile.read() - self.theState = json.loads(theJson) + theState = json.loads(theJson) except Exception as e: logger.error("Failed to load export options file") logger.error(str(e)) return False + for anOpt in theState: + self.theState[anOpt] = theState[anOpt] return True def saveSettings(self):