From bc06bde05c0932fc9d0090ca4a16a2525c98920d Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 13 Oct 2019 15:36:57 +0200 Subject: [PATCH] Added more options to export GUI --- nw/gui/configeditor.py | 8 ++--- nw/gui/export.py | 69 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 8 deletions(-) diff --git a/nw/gui/configeditor.py b/nw/gui/configeditor.py index 016040c6..3a7406ff 100644 --- a/nw/gui/configeditor.py +++ b/nw/gui/configeditor.py @@ -111,10 +111,10 @@ class GuiConfigEditGeneral(QWidget): def __init__(self, theParent): QWidget.__init__(self, theParent) - self.mainConf = nw.CONFIG - self.theParent = theParent - self.theTheme = theParent.theTheme - self.outerBox = QGridLayout() + self.mainConf = nw.CONFIG + self.theParent = theParent + self.theTheme = theParent.theTheme + self.outerBox = QGridLayout() # User Interface self.guiLook = QGroupBox("User Interface", self) diff --git a/nw/gui/export.py b/nw/gui/export.py index 86b249ab..41a7e122 100644 --- a/nw/gui/export.py +++ b/nw/gui/export.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """novelWriter GUI Export Tools - novelWriter – GUI Export Tool + novelWriter – GUI Export Tools ================================ Tool for exporting project files to other formats @@ -18,9 +18,12 @@ from os import path from PyQt5.QtCore import Qt, QSize from PyQt5.QtSvg import QSvgWidget from PyQt5.QtWidgets import ( - QDialog, QHBoxLayout, QVBoxLayout, QWidget, QTabWidget, QDialogButtonBox + QDialog, QHBoxLayout, QVBoxLayout, QWidget, QTabWidget, QDialogButtonBox, QGridLayout, + QGroupBox, QCheckBox, QLabel, QComboBox, QLineEdit ) +from nw.tools.translate import numberToWord + logger = logging.getLogger(__name__) class GuiExport(QDialog): @@ -61,6 +64,9 @@ class GuiExport(QDialog): self.show() + for n in range(1000): + numberToWord(n,"EN") + logger.debug("GuiExport initialisation complete") return @@ -69,11 +75,66 @@ class GuiExport(QDialog): class GuiExportMain(QWidget): + CHFMT_NUM = 1 + CHFMT_NUMWORD = 2 + CHFMT_TITLE = 3 + CHFMT_LABEL = 4 + CHFMT_NUMTITLE = 5 + CHFMT_NUMLABEL = 6 + CHFMT_CUSTOM = 7 + def __init__(self, theParent, theProject): QWidget.__init__(self, theParent) - self.theParent = theParent - self.theProject = theProject + self.theParent = theParent + self.theProject = theProject + self.outerBox = QGridLayout() + + # Select Files + self.guiFiles = QGroupBox("Export Files", self) + self.guiFilesForm = QGridLayout(self) + self.guiFiles.setLayout(self.guiFilesForm) + + self.expNovel = QCheckBox(self) + self.expNovel.setToolTip("Include all novel files in the exported document") + self.expNotes = QCheckBox(self) + self.expNotes.setToolTip("Include all note files in the exported document") + + self.guiFilesForm.addWidget(QLabel("Novel files"), 0, 0) + self.guiFilesForm.addWidget(self.expNovel, 0, 1) + self.guiFilesForm.addWidget(QLabel("Note files"), 1, 0) + self.guiFilesForm.addWidget(self.expNotes, 1, 1) + + # Chapter Settings + self.guiChapters = QGroupBox("Chapters", self) + self.guiChaptersForm = QGridLayout(self) + self.guiChapters.setLayout(self.guiChaptersForm) + + self.chapterFormat = QComboBox(self) + self.chapterFormat.addItem("Chapter 1", self.CHFMT_NUM) + self.chapterFormat.addItem("Chapter One", self.CHFMT_NUMWORD) + self.chapterFormat.addItem("[Title]", self.CHFMT_TITLE) + self.chapterFormat.addItem("[Label]", self.CHFMT_LABEL) + self.chapterFormat.addItem("1. [Title]", self.CHFMT_NUMTITLE) + self.chapterFormat.addItem("1. [Label]", self.CHFMT_NUMLABEL) + self.chapterFormat.addItem("Custom", self.CHFMT_CUSTOM) + + self.chapterCustom = QLineEdit() + self.chapterCustom.setText("%num%. %title%") + self.chapterCustom.setToolTip("Available options: %num%, %numword%, %title%, %label%") + self.chapterCustom.setMinimumWidth(200) + + self.guiChaptersForm.addWidget(QLabel("Name format"), 0, 0) + self.guiChaptersForm.addWidget(self.chapterFormat, 0, 1) + self.guiChaptersForm.addWidget(QLabel("Custom format"), 1, 0) + self.guiChaptersForm.addWidget(self.chapterCustom, 1, 1) + + # Assemble + self.outerBox.addWidget(self.guiFiles, 0, 0) + self.outerBox.addWidget(self.guiChapters, 1, 0) + self.outerBox.setColumnStretch(2, 1) + self.outerBox.setRowStretch(4, 1) + self.setLayout(self.outerBox) return