Add objectName to all dialogs and made some other minor fixes

This commit is contained in:
Veronica K. B. Olsen
2020-09-22 23:01:09 +02:00
parent 9a9cfe1ce5
commit 3f30923d12
13 changed files with 20 additions and 7 deletions
+5 -5
View File
@@ -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]
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
+2 -1
View File
@@ -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)
+3 -1
View File
@@ -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")