diff --git a/nw/config.py b/nw/config.py index 9af86619..9cb62e28 100644 --- a/nw/config.py +++ b/nw/config.py @@ -54,7 +54,6 @@ class Config: # Set Application Variables self.appName = "novelWriter" self.appHandle = self.appName.lower() - self.cmdOpen = None # Debug Settings self.blockGUI = True # Allow blocking the GUI (disabled for testing) @@ -65,6 +64,7 @@ class Config: self.errData = [] # List of error messages # Set Paths + self.cmdOpen = None # Path from command line for project to be opened on launch self.confPath = None # Folder where the config is saved self.confFile = None # The config file name self.dataPath = None # Folder where app data is stored @@ -87,11 +87,11 @@ class Config: self.guiTheme = "default" self.guiSyntax = "default_light" self.guiIcons = "typicons_colour_light" - self.guiDark = False - self.guiLang = "en" # Hardcoded for now since the GUI is only in English - self.guiFont = "" + self.guiDark = False # Load icons for dark backgrounds, if available + self.guiLang = "en" # Hardcoded for now since the GUI is only in English + self.guiFont = "" # Defaults to system defualt font self.guiFontSize = 11 - self.guiScale = 1.0 # Set automatically by Theme class + self.guiScale = 1.0 # Set automatically by Theme class ## Sizes self.winGeometry = [1100, 650] diff --git a/nw/gui/about.py b/nw/gui/about.py index 6a25af89..4c1e5539 100644 --- a/nw/gui/about.py +++ b/nw/gui/about.py @@ -45,6 +45,7 @@ class GuiAbout(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiAbout ...") + self.setObjectName("GuiAbout") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/build.py b/nw/gui/build.py index 155c6596..6c9f5f0e 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -68,6 +68,7 @@ class GuiBuildNovel(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiBuildNovel ...") + self.setObjectName("GuiBuildNovel") self.mainConf = nw.CONFIG self.theProject = theProject diff --git a/nw/gui/docmerge.py b/nw/gui/docmerge.py index d8650ecb..95c4b9de 100644 --- a/nw/gui/docmerge.py +++ b/nw/gui/docmerge.py @@ -46,6 +46,7 @@ class GuiDocMerge(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiDocMerge ...") + self.setObjectName("GuiDocMerge") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/docsplit.py b/nw/gui/docsplit.py index 8c3c4897..6a7ef7b3 100644 --- a/nw/gui/docsplit.py +++ b/nw/gui/docsplit.py @@ -46,6 +46,7 @@ class GuiDocSplit(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiDocSplit ...") + self.setObjectName("GuiDocSplit") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/itemeditor.py b/nw/gui/itemeditor.py index 13024641..d2a0c741 100644 --- a/nw/gui/itemeditor.py +++ b/nw/gui/itemeditor.py @@ -44,6 +44,7 @@ class GuiItemEditor(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiItemEditor ...") + self.setObjectName("GuiItemEditor") self.mainConf = nw.CONFIG self.theProject = theProject diff --git a/nw/gui/preferences.py b/nw/gui/preferences.py index eca12735..6b9af4b3 100644 --- a/nw/gui/preferences.py +++ b/nw/gui/preferences.py @@ -48,6 +48,7 @@ class GuiPreferences(PagedDialog): PagedDialog.__init__(self, theParent) logger.debug("Initialising GuiPreferences ...") + self.setObjectName("GuiPreferences") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/projload.py b/nw/gui/projload.py index c21fc84c..29cafe10 100644 --- a/nw/gui/projload.py +++ b/nw/gui/projload.py @@ -58,6 +58,7 @@ class GuiProjectLoad(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiProjectLoad ...") + self.setObjectName("GuiProjectLoad") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/projsettings.py b/nw/gui/projsettings.py index a00d345e..f3ea6a7e 100644 --- a/nw/gui/projsettings.py +++ b/nw/gui/projsettings.py @@ -47,6 +47,7 @@ class GuiProjectSettings(PagedDialog): PagedDialog.__init__(self, theParent) logger.debug("Initialising GuiProjectSettings ...") + self.setObjectName("GuiProjectSettings") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/projwizard.py b/nw/gui/projwizard.py index bfadbcea..22a0ef77 100644 --- a/nw/gui/projwizard.py +++ b/nw/gui/projwizard.py @@ -55,6 +55,7 @@ class GuiProjectWizard(QWizard): QWizard.__init__(self, theParent) logger.debug("Initialising GuiProjectWizard ...") + self.setObjectName("GuiProjectWizard") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/gui/writingstats.py b/nw/gui/writingstats.py index 91391ee3..ad4f8879 100644 --- a/nw/gui/writingstats.py +++ b/nw/gui/writingstats.py @@ -58,6 +58,7 @@ class GuiWritingStats(QDialog): QDialog.__init__(self, theParent) logger.debug("Initialising GuiWritingStats ...") + self.setObjectName("GuiWritingStats") self.mainConf = nw.CONFIG self.theParent = theParent diff --git a/nw/guimain.py b/nw/guimain.py index 2182ab9c..be0a1c81 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -686,7 +686,8 @@ class GuiMain(QMainWindow): logger.verbose("Requesting change to item %s" % tHandle) if self.mainConf.blockGUI: dlgProj = GuiItemEditor(self, self.theProject, tHandle) - if dlgProj.exec_(): + dlgProj.exec_() + if dlgProj.result() == QDialog.Accepted: self.treeView.setTreeItemValues(tHandle) self.treeMeta.updateViewBox(tHandle) self.docEditor.updateDocInfo(tHandle) diff --git a/tests/test_dialogs.py b/tests/test_dialogs.py index 8acb3a9c..55ba5bf1 100644 --- a/tests/test_dialogs.py +++ b/tests/test_dialogs.py @@ -5,10 +5,12 @@ import nw import pytest import json + from shutil import copyfile from nwtools import cmpFiles from os import path + from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDialogButtonBox, QTreeWidgetItem @@ -891,7 +893,6 @@ def testPreferences(qtbot, nwMinimal, nwTemp, nwRef, tmpConf): assert not tabAutoRep.autoReplaceDots.isEnabled() # Save and Check Config - # qtbot.stopForInteraction() qtbot.mouseClick(nwPrefs.buttonBox.button(QDialogButtonBox.Ok), Qt.LeftButton) assert tmpConf.confChanged @@ -901,6 +902,7 @@ def testPreferences(qtbot, nwMinimal, nwTemp, nwRef, tmpConf): assert nwGUI.mainConf.saveConfig() + # qtbot.stopForInteraction() nwGUI.closeMain() refConf = path.join(nwRef, "novelwriter_prefs.conf")