From ef142025ec07702be3b304362d91da0d6f577756 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 30 Oct 2019 17:53:30 +0100 Subject: [PATCH] Added handling of gui styles forwarded to Qt5 which fixes theme issues on Windows --- nw/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nw/__init__.py b/nw/__init__.py index 91348d7e..809aeb18 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -85,6 +85,7 @@ def main(sysArgs): "config=", "testmode", "spell=", + "style=", ] helpMsg = ( @@ -99,8 +100,9 @@ def main(sysArgs): " -D, --debuggui Shows additional debug GUI elements. Includes -d.\n" " -q, --quiet Disable output to command line. Does not affect log file.\n" " -t, --time Shows time stamp in logging output. Adds milliseconds when --verbose.\n" - " -l, --logfile Specify log file.\n" - " --config Alternative config file.\n" + " -l, --logfile= Specify log file.\n" + " --style= Set Qt5 style flag. Defaults to Fusion.\n" + " --config= Alternative config file.\n" " --headless Do not display GUI. Useful for testing scripts.\n" ).format( appname = __package__, @@ -121,6 +123,7 @@ def main(sysArgs): testMode = False debugGUI = False spellTool = None + qtStyle = "Fusion" # Parse Options try: @@ -149,6 +152,8 @@ def main(sysArgs): timeStr = "[{asctime:}.{msecs:03.0f}] " elif inOpt in ("-t","--time"): showTime = True + elif inOpt in ("--style"): + qtStyle = inArg elif inOpt in ("--config"): confPath = inArg elif inOpt in ("--testmode"): @@ -195,7 +200,7 @@ def main(sysArgs): nwGUI = GuiMain() return nwGUI else: - nwApp = QApplication([__package__]) + nwApp = QApplication([__package__,("-style=%s" % qtStyle)]) nwGUI = GuiMain() sys.exit(nwApp.exec_())