Some minor cleanup in main window code

This commit is contained in:
Veronica K. B. Olsen
2020-05-24 19:41:43 +02:00
parent 1252d9728a
commit c107a86e25
+10 -5
View File
@@ -272,7 +272,6 @@ class GuiMain(QMainWindow):
def newProject(self, projPath=None, forceNew=False): def newProject(self, projPath=None, forceNew=False):
"""Create new project with a few default files and folders. """Create new project with a few default files and folders.
""" """
if self.hasProject: if self.hasProject:
msgBox = QMessageBox() msgBox = QMessageBox()
msgRes = msgBox.warning( msgRes = msgBox.warning(
@@ -734,6 +733,8 @@ class GuiMain(QMainWindow):
return None return None
def editConfigDialog(self): def editConfigDialog(self):
"""Open the preferences dialog.
"""
dlgConf = GuiConfigEditor(self, self.theProject) dlgConf = GuiConfigEditor(self, self.theProject)
if dlgConf.exec_() == QDialog.Accepted: if dlgConf.exec_() == QDialog.Accepted:
logger.debug("Applying new preferences") logger.debug("Applying new preferences")
@@ -745,6 +746,8 @@ class GuiMain(QMainWindow):
return True return True
def editProjectDialog(self): def editProjectDialog(self):
"""Open the project settings dialog.
"""
if self.hasProject: if self.hasProject:
dlgProj = GuiProjectEditor(self, self.theProject) dlgProj = GuiProjectEditor(self, self.theProject)
dlgProj.exec_() dlgProj.exec_()
@@ -752,12 +755,16 @@ class GuiMain(QMainWindow):
return True return True
def buildProjectDialog(self): def buildProjectDialog(self):
"""Open the build project dialog.
"""
if self.hasProject: if self.hasProject:
dlgExport = GuiBuildNovel(self, self.theProject) dlgExport = GuiBuildNovel(self, self.theProject)
dlgExport.exec_() dlgExport.exec_()
return True return True
def showSessionLogDialog(self): def showSessionLogDialog(self):
"""Open the session log dialog.
"""
if self.hasProject: if self.hasProject:
dlgTLine = GuiSessionLogView(self, self.theProject) dlgTLine = GuiSessionLogView(self, self.theProject)
dlgTLine.exec_() dlgTLine.exec_()
@@ -768,7 +775,6 @@ class GuiMain(QMainWindow):
can be either a string or an array of strings. Severity level is can be either a string or an array of strings. Severity level is
0 = info, 1 = warning, and 2 = error. 0 = info, 1 = warning, and 2 = error.
""" """
if isinstance(theMessage, list): if isinstance(theMessage, list):
popMsg = " ".join(theMessage) popMsg = " ".join(theMessage)
logMsg = theMessage logMsg = theMessage
@@ -812,7 +818,8 @@ class GuiMain(QMainWindow):
## ##
def closeMain(self): def closeMain(self):
"""Save everything, and close novelWriter.
"""
if self.mainConf.showGUI and self.hasProject: if self.mainConf.showGUI and self.hasProject:
msgBox = QMessageBox() msgBox = QMessageBox()
msgRes = msgBox.question( msgRes = msgBox.question(
@@ -865,7 +872,6 @@ class GuiMain(QMainWindow):
"""Main GUI Zen Mode hides tree, view pane and optionally also """Main GUI Zen Mode hides tree, view pane and optionally also
statusbar and menu. statusbar and menu.
""" """
if self.docEditor.theHandle is None: if self.docEditor.theHandle is None:
logger.error("No document open, so not activating Zen Mode") logger.error("No document open, so not activating Zen Mode")
return False return False
@@ -897,7 +903,6 @@ class GuiMain(QMainWindow):
if the user uses the system window manager. Currently, Qt if the user uses the system window manager. Currently, Qt
doesn't have access to the exact state of the window. doesn't have access to the exact state of the window.
""" """
self.setWindowState(self.windowState() ^ Qt.WindowFullScreen) self.setWindowState(self.windowState() ^ Qt.WindowFullScreen)
winState = self.windowState() & Qt.WindowFullScreen == Qt.WindowFullScreen winState = self.windowState() & Qt.WindowFullScreen == Qt.WindowFullScreen