GUI classes should only init with main GUI as parent

This commit is contained in:
Veronica K. B. Olsen
2021-04-25 17:50:11 +02:00
parent 48695651e1
commit 746268c3ef
11 changed files with 34 additions and 34 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ logger = logging.getLogger(__name__)
class GuiDocMerge(QDialog):
def __init__(self, theParent, theProject):
def __init__(self, theParent):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiDocMerge ...")
@@ -49,7 +49,7 @@ class GuiDocMerge(QDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.theProject = theParent.theProject
self.sourceItem = None
self.outerBox = QVBoxLayout()
+3 -3
View File
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
class GuiDocSplit(QDialog):
def __init__(self, theParent, theProject):
def __init__(self, theParent):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiDocSplit ...")
@@ -50,8 +50,8 @@ class GuiDocSplit(QDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.optState = self.theProject.optState
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.sourceItem = None
self.outerBox = QVBoxLayout()
+2 -2
View File
@@ -41,15 +41,15 @@ logger = logging.getLogger(__name__)
class GuiItemEditor(QDialog):
def __init__(self, theParent, theProject, tHandle):
def __init__(self, theParent, tHandle):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiItemEditor ...")
self.setObjectName("GuiItemEditor")
self.mainConf = nw.CONFIG
self.theProject = theProject
self.theParent = theParent
self.theProject = theParent.theProject
##
# Build GUI
+2 -2
View File
@@ -45,7 +45,7 @@ logger = logging.getLogger(__name__)
class GuiPreferences(PagedDialog):
def __init__(self, theParent, theProject):
def __init__(self, theParent):
PagedDialog.__init__(self, theParent)
logger.debug("Initialising GuiPreferences ...")
@@ -53,7 +53,7 @@ class GuiPreferences(PagedDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.theProject = theParent.theProject
self.setWindowTitle(self.tr("Preferences"))
+3 -3
View File
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
class GuiProjectSettings(PagedDialog):
def __init__(self, theParent, theProject):
def __init__(self, theParent):
PagedDialog.__init__(self, theParent)
logger.debug("Initialising GuiProjectSettings ...")
@@ -50,8 +50,8 @@ class GuiProjectSettings(PagedDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.optState = theProject.optState
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.theProject.countStatus()
self.setWindowTitle(self.tr("Project Settings"))
+1 -1
View File
@@ -42,7 +42,7 @@ class GuiQuoteSelect(QDialog):
selectedQuote = ""
def __init__(self, theParent=None, currentQuote="\""):
def __init__(self, theParent=None, currentQuote='"'):
QDialog.__init__(self, parent=theParent)
self.mainConf = nw.CONFIG
+3 -3
View File
@@ -41,7 +41,7 @@ logger = logging.getLogger(__name__)
class GuiWordList(QDialog):
def __init__(self, theParent, theProject):
def __init__(self, theParent):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiWordList ...")
@@ -50,8 +50,8 @@ class GuiWordList(QDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theTheme = theParent.theTheme
self.theProject = theProject
self.optState = theProject.optState
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.setWindowTitle(self.tr("Project Word List"))
+3 -3
View File
@@ -43,7 +43,7 @@ logger = logging.getLogger(__name__)
class GuiProjectDetails(PagedDialog):
def __init__(self, theParent, theProject):
def __init__(self, theParent):
PagedDialog.__init__(self, theParent)
logger.debug("Initialising GuiProjectDetails ...")
@@ -51,8 +51,8 @@ class GuiProjectDetails(PagedDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.optState = theProject.optState
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.setWindowTitle(self.tr("Project Details"))
+9 -9
View File
@@ -756,7 +756,7 @@ class GuiMain(QMainWindow):
logger.error("No project open")
return False
dlgMerge = GuiDocMerge(self, self.theProject)
dlgMerge = GuiDocMerge(self)
dlgMerge.exec_()
return True
@@ -768,7 +768,7 @@ class GuiMain(QMainWindow):
logger.error("No project open")
return False
dlgSplit = GuiDocSplit(self, self.theProject)
dlgSplit = GuiDocSplit(self)
dlgSplit.exec_()
return True
@@ -837,7 +837,7 @@ class GuiMain(QMainWindow):
return
logger.verbose("Requesting change to item %s" % tHandle)
dlgProj = GuiItemEditor(self, self.theProject, tHandle)
dlgProj = GuiItemEditor(self, tHandle)
dlgProj.exec_()
if dlgProj.result() == QDialog.Accepted:
self.treeView.setTreeItemValues(tHandle)
@@ -958,7 +958,7 @@ class GuiMain(QMainWindow):
def showPreferencesDialog(self):
"""Open the preferences dialog.
"""
dlgConf = GuiPreferences(self, self.theProject)
dlgConf = GuiPreferences(self)
dlgConf.exec_()
if dlgConf.result() == QDialog.Accepted:
@@ -982,7 +982,7 @@ class GuiMain(QMainWindow):
logger.error("No project open")
return
dlgProj = GuiProjectSettings(self, self.theProject)
dlgProj = GuiProjectSettings(self)
dlgProj.exec_()
if dlgProj.result() == QDialog.Accepted:
@@ -1001,7 +1001,7 @@ class GuiMain(QMainWindow):
self.treeView.flushTreeOrder()
dlgDetails = GuiProjectDetails(self, self.theProject)
dlgDetails = GuiProjectDetails(self)
dlgDetails.setModal(False)
dlgDetails.show()
@@ -1016,7 +1016,7 @@ class GuiMain(QMainWindow):
dlgBuild = getGuiItem("GuiBuildNovel")
if dlgBuild is None:
dlgBuild = GuiBuildNovel(self, self.theProject)
dlgBuild = GuiBuildNovel(self)
dlgBuild.setModal(False)
dlgBuild.show()
@@ -1032,7 +1032,7 @@ class GuiMain(QMainWindow):
logger.error("No project open")
return
dlgWords = GuiWordList(self, self.theProject)
dlgWords = GuiWordList(self)
dlgWords.exec_()
if dlgWords.result() == QDialog.Accepted:
@@ -1050,7 +1050,7 @@ class GuiMain(QMainWindow):
dlgStats = getGuiItem("GuiWritingStats")
if dlgStats is None:
dlgStats = GuiWritingStats(self, self.theProject)
dlgStats = GuiWritingStats(self)
dlgStats.setModal(False)
dlgStats.show()
+3 -3
View File
@@ -66,17 +66,17 @@ class GuiBuildNovel(QDialog):
FMT_JSON_H = 8 # HTML5 wrapped in JSON
FMT_JSON_M = 9 # nW Markdown wrapped in JSON
def __init__(self, theParent, theProject):
def __init__(self, theParent):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiBuildNovel ...")
self.setObjectName("GuiBuildNovel")
self.mainConf = nw.CONFIG
self.theProject = theProject
self.theParent = theParent
self.theTheme = theParent.theTheme
self.optState = self.theProject.optState
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.htmlText = [] # List of html documents
self.htmlStyle = [] # List of html styles
+3 -3
View File
@@ -56,7 +56,7 @@ class GuiWritingStats(QDialog):
FMT_JSON = 0
FMT_CSV = 1
def __init__(self, theParent, theProject):
def __init__(self, theParent):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiWritingStats ...")
@@ -64,9 +64,9 @@ class GuiWritingStats(QDialog):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.theTheme = theParent.theTheme
self.optState = theProject.optState
self.theProject = theParent.theProject
self.optState = theParent.theProject.optState
self.logData = []
self.filterData = []