From 76fcc7434251f10164bbe964c8641e83f164bf33 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 8 Aug 2020 18:27:16 +0200 Subject: [PATCH 1/3] Make writing stats and buid dialogs non-modal --- nw/guimain.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nw/guimain.py b/nw/guimain.py index f4dc33d8..3768fc3c 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -803,16 +803,18 @@ class GuiMain(QMainWindow): """Open the build project dialog. """ if self.hasProject: - dlgExport = GuiBuildNovel(self, self.theProject) - dlgExport.exec_() + dlgBuild = GuiBuildNovel(self, self.theProject) + dlgBuild.setModal(False) + dlgBuild.show() return True def showWritingStatsDialog(self): """Open the session log dialog. """ if self.hasProject: - dlgTLine = GuiWritingStats(self, self.theProject) - dlgTLine.exec_() + dlgStats = GuiWritingStats(self, self.theProject) + dlgStats.setModal(False) + dlgStats.show() return True def makeAlert(self, theMessage, theLevel=nwAlert.INFO): From d1982c0abbbcd03840ec0c0d95ab539027c25449 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 8 Aug 2020 18:37:25 +0200 Subject: [PATCH 2/3] Moved the about dialog functions to main gui class --- nw/gui/build.py | 2 -- nw/gui/mainmenu.py | 24 +++--------------------- nw/guimain.py | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/nw/gui/build.py b/nw/gui/build.py index 93aa8271..58b152f8 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -401,8 +401,6 @@ class GuiBuildNovel(QDialog): self.setLayout(self.outerBox) self.buildNovel.setFocus() - self.show() - logger.debug("GuiBuildNovel initialisation complete") # Load from Cache diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index 7f996dda..2ac66e33 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -28,13 +28,10 @@ import logging import nw -from os import path - from PyQt5.QtCore import QUrl, QProcess from PyQt5.QtGui import QDesktopServices -from PyQt5.QtWidgets import QMenuBar, QAction, QMessageBox +from PyQt5.QtWidgets import QMenuBar, QAction -from nw.gui.about import GuiAbout from nw.constants import nwItemType, nwItemClass, nwDocAction, nwDocInsert logger = logging.getLogger(__name__) @@ -150,21 +147,6 @@ class GuiMainMenu(QMenuBar): self.theProject.setAutoOutline(theMode) return True - def _showAbout(self): - """Show the about dialog. - """ - if self.mainConf.showGUI: - msgAbout = GuiAbout(self.theParent) - msgAbout.exec_() - return True - - def _showAboutQt(self): - """Show Qt's own About dialog. - """ - msgBox = QMessageBox() - msgBox.aboutQt(self.theParent,"About Qt") - return True - def _openAssistant(self): """Open the documentation in Qt Assistant. """ @@ -853,13 +835,13 @@ class GuiMainMenu(QMenuBar): # Help > About self.aAboutNW = QAction("About %s" % self.mainConf.appName, self) self.aAboutNW.setStatusTip("About %s" % self.mainConf.appName) - self.aAboutNW.triggered.connect(self._showAbout) + self.aAboutNW.triggered.connect(self.theParent.showAboutNWDialog) self.helpMenu.addAction(self.aAboutNW) # Help > About Qt5 self.aAboutQt = QAction("About Qt5", self) self.aAboutQt.setStatusTip("About Qt5") - self.aAboutQt.triggered.connect(self._showAboutQt) + self.aAboutQt.triggered.connect(self.theParent.showAboutQtDialog) self.helpMenu.addAction(self.aAboutQt) # Help > Separator diff --git a/nw/guimain.py b/nw/guimain.py index 3768fc3c..09571d61 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -43,7 +43,7 @@ from nw.gui import ( GuiBuildNovel, GuiDocEditor, GuiDocMerge, GuiDocSplit, GuiDocViewDetails, GuiDocViewer, GuiItemDetails, GuiItemEditor, GuiMainMenu, GuiMainStatus, GuiOutline, GuiOutlineDetails, GuiPreferences, GuiProjectLoad, GuiTheme, - GuiProjectSettings, GuiProjectTree, GuiWritingStats + GuiProjectSettings, GuiProjectTree, GuiWritingStats, GuiAbout ) from nw.core import NWProject, NWDoc, NWIndex from nw.constants import nwFiles, nwItemType, nwAlert @@ -817,6 +817,22 @@ class GuiMain(QMainWindow): dlgStats.show() return True + def showAboutNWDialog(self): + """Show the about dialog for novelWriter. + """ + if self.mainConf.showGUI: + dlgAbout = GuiAbout(self) + dlgAbout.exec_() + return True + + def showAboutQtDialog(self): + """Show the about dialog for Qt. + """ + if self.mainConf.showGUI: + msgBox = QMessageBox() + msgBox.aboutQt(self, "About Qt") + return True + def makeAlert(self, theMessage, theLevel=nwAlert.INFO): """Alert both the user and the logger at the same time. Message can be either a string or an array of strings. Severity level is From 16cfa13abbe3c186955d76818a4e0b11a54483af Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 8 Aug 2020 18:39:03 +0200 Subject: [PATCH 3/3] Removed show() from a few dialogs --- nw/gui/docmerge.py | 1 - nw/gui/docsplit.py | 1 - nw/gui/preferences.py | 2 -- 3 files changed, 4 deletions(-) diff --git a/nw/gui/docmerge.py b/nw/gui/docmerge.py index 6b16102d..f6a565d1 100644 --- a/nw/gui/docmerge.py +++ b/nw/gui/docmerge.py @@ -79,7 +79,6 @@ class GuiDocMerge(QDialog): self.setLayout(self.outerBox) self.rejected.connect(self._doClose) - self.show() self._populateList() diff --git a/nw/gui/docsplit.py b/nw/gui/docsplit.py index 98ef95d7..d143a056 100644 --- a/nw/gui/docsplit.py +++ b/nw/gui/docsplit.py @@ -92,7 +92,6 @@ class GuiDocSplit(QDialog): self.setLayout(self.outerBox) self.rejected.connect(self._doClose) - self.show() self._populateList() diff --git a/nw/gui/preferences.py b/nw/gui/preferences.py index 999464b3..31986546 100644 --- a/nw/gui/preferences.py +++ b/nw/gui/preferences.py @@ -71,8 +71,6 @@ class GuiPreferences(PagedDialog): self.buttonBox.rejected.connect(self._doClose) self.addControls(self.buttonBox) - self.show() - logger.debug("GuiPreferences initialisation complete") return