From 7451ac45854b0a19692f8833c5ad7c9487914637 Mon Sep 17 00:00:00 2001
From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com>
Date: Sat, 30 May 2020 11:42:49 +0200
Subject: [PATCH] Added a couple of flags to allow the build tool to be run
without user interaction
---
nw/gui/build.py | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/nw/gui/build.py b/nw/gui/build.py
index f191d063..0c539f35 100644
--- a/nw/gui/build.py
+++ b/nw/gui/build.py
@@ -552,15 +552,16 @@ class GuiBuildNovel(QDialog):
if not path.isdir(saveDir):
saveDir = self.mainConf.homePath
- dlgOpt = QFileDialog.Options()
- dlgOpt |= QFileDialog.DontUseNativeDialog
- saveTo = QFileDialog.getSaveFileName(
- self, "Save Document As", savePath, options=dlgOpt
- )
- if saveTo[0]:
- savePath = saveTo[0]
- else:
- return False
+ if self.mainConf.showGUI:
+ dlgOpt = QFileDialog.Options()
+ dlgOpt |= QFileDialog.DontUseNativeDialog
+ saveTo = QFileDialog.getSaveFileName(
+ self, "Save Document As", savePath, options=dlgOpt
+ )
+ if saveTo[0]:
+ savePath = saveTo[0]
+ else:
+ return False
self.mainConf.setLastPath(savePath)
@@ -635,18 +636,19 @@ class GuiBuildNovel(QDialog):
errMsg = "Unknown format"
# Report to user
- if wSuccess:
- self.theParent.makeAlert(
- "%s file successfully written to:
%s" % (
- textFmt, savePath
- ), nwAlert.INFO
- )
- else:
- self.theParent.makeAlert(
- "Failed to write %s file. %s" % (
- textFmt, errMsg
- ), nwAlert.ERROR
- )
+ if self.mainConf.showGUI:
+ if wSuccess:
+ self.theParent.makeAlert(
+ "%s file successfully written to:
%s" % (
+ textFmt, savePath
+ ), nwAlert.INFO
+ )
+ else:
+ self.theParent.makeAlert(
+ "Failed to write %s file. %s" % (
+ textFmt, errMsg
+ ), nwAlert.ERROR
+ )
return wSuccess