From 3089c798dc3cf58d0d72a48306f1dd60663360b5 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 9 May 2020 19:26:28 +0200 Subject: [PATCH] Added the Build Project dialog and connected it to the GUI in place of the Export tool --- nw/gui/__init__.py | 14 ++++++----- nw/gui/build.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++ nw/gui/mainmenu.py | 10 ++++---- nw/guimain.py | 8 +++---- 4 files changed, 75 insertions(+), 15 deletions(-) create mode 100644 nw/gui/build.py diff --git a/nw/gui/__init__.py b/nw/gui/__init__.py index c59bfed9..7d4633b5 100644 --- a/nw/gui/__init__.py +++ b/nw/gui/__init__.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -# Qt Additions -from nw.gui.additions.qconfiglayout import QConfigLayout -from nw.gui.additions.qswitch import QSwitch - # Main Window Elements +from nw.gui.build import GuiBuildNovel from nw.gui.icons import GuiIcons from nw.gui.mainmenu import GuiMainMenu from nw.gui.statusbar import GuiMainStatus from nw.gui.theme import GuiTheme +# Qt Additions +from nw.gui.additions.qconfiglayout import QConfigLayout +from nw.gui.additions.qswitch import QSwitch + # Dialogs from nw.gui.dialogs.configeditor import GuiConfigEditor from nw.gui.dialogs.docmerge import GuiDocMerge @@ -37,12 +38,13 @@ from nw.gui.tools.optionstate import OptionState from nw.gui.tools.wordcounter import WordCounter __all__ = [ - "QConfigLayout", - "QSwitch", + "GuiBuildNovel", "GuiIcons", "GuiMainMenu", "GuiMainStatus", "GuiTheme", + "QConfigLayout", + "QSwitch", "GuiConfigEditor", "GuiDocMerge", "GuiDocSplit", diff --git a/nw/gui/build.py b/nw/gui/build.py new file mode 100644 index 00000000..f08ae287 --- /dev/null +++ b/nw/gui/build.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +"""novelWriter GUI Build Novel + + novelWriter – GUI Build Novel +=============================== + Class holding the build novel window + + File History: + Created: 2020-05-09 [0.5] + + This file is a part of novelWriter + Copyright 2020, Veronica Berglyd Olsen + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import logging +import nw + +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import ( + QDialog +) + +from nw.constants import nwConst, nwFiles, nwAlert + +logger = logging.getLogger(__name__) + +class GuiBuildNovel(QDialog): + + def __init__(self, theParent, theProject): + QDialog.__init__(self, theParent) + + logger.debug("Initialising GuiBuildNovel ...") + + self.mainConf = nw.CONFIG + self.theProject = theProject + self.theParent = theParent + self.optState = self.theProject.optState + + self.show() + + logger.debug("GuiBuildNovel initialisation complete") + + return + +# END Class GuiBuildNovel diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index a37ddf0c..ddc60daa 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -225,11 +225,11 @@ class GuiMainMenu(QMenuBar): self.projMenu.addAction(self.aProjectSettings) # Project > Export Project - self.aExportProject = QAction("Export Project", self) - self.aExportProject.setStatusTip("Export project") - self.aExportProject.setShortcut("F5") - self.aExportProject.triggered.connect(self.theParent.exportProjectDialog) - self.projMenu.addAction(self.aExportProject) + self.aBuildProject = QAction("Build Project", self) + self.aBuildProject.setStatusTip("Build project") + self.aBuildProject.setShortcut("F5") + self.aBuildProject.triggered.connect(self.theParent.buildProjectDialog) + self.projMenu.addAction(self.aBuildProject) # Project > Session Log self.aSessionLog = QAction("Session Log", self) diff --git a/nw/guimain.py b/nw/guimain.py index 2f1380bd..bbf047b0 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -40,10 +40,10 @@ from PyQt5.QtWidgets import ( ) from nw.gui import ( - GuiMainMenu, GuiMainStatus, GuiTheme, GuiDocTree, GuiDocEditor, GuiExport, + GuiMainMenu, GuiMainStatus, GuiTheme, GuiDocTree, GuiDocEditor, GuiDocViewer, GuiDocDetails, GuiSearchBar, GuiNoticeBar, GuiDocViewDetails, GuiConfigEditor, GuiProjectEditor, GuiItemEditor, GuiProjectOutline, - GuiSessionLogView, GuiDocMerge, GuiDocSplit, GuiProjectLoad + GuiSessionLogView, GuiDocMerge, GuiDocSplit, GuiProjectLoad, GuiBuildNovel ) from nw.core import NWProject, NWDoc, NWIndex, countWords from nw.constants import nwFiles, nwItemType, nwAlert @@ -755,9 +755,9 @@ class GuiMain(QMainWindow): self._setWindowTitle(self.theProject.projName) return True - def exportProjectDialog(self): + def buildProjectDialog(self): if self.hasProject: - dlgExport = GuiExport(self, self.theProject) + dlgExport = GuiBuildNovel(self, self.theProject) dlgExport.exec_() return True