Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog Modality #389

Merged
merged 3 commits into from Aug 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions nw/gui/build.py
Expand Up @@ -401,8 +401,6 @@ def __init__(self, theParent, theProject):
self.setLayout(self.outerBox)
self.buildNovel.setFocus()

self.show()

logger.debug("GuiBuildNovel initialisation complete")

# Load from Cache
Expand Down
1 change: 0 additions & 1 deletion nw/gui/docmerge.py
Expand Up @@ -79,7 +79,6 @@ def __init__(self, theParent, theProject):
self.setLayout(self.outerBox)

self.rejected.connect(self._doClose)
self.show()

self._populateList()

Expand Down
1 change: 0 additions & 1 deletion nw/gui/docsplit.py
Expand Up @@ -92,7 +92,6 @@ def __init__(self, theParent, theProject):
self.setLayout(self.outerBox)

self.rejected.connect(self._doClose)
self.show()

self._populateList()

Expand Down
24 changes: 3 additions & 21 deletions nw/gui/mainmenu.py
Expand Up @@ -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__)
Expand Down Expand Up @@ -150,21 +147,6 @@ def _toggleAutoOutline(self, theMode):
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.
"""
Expand Down Expand Up @@ -853,13 +835,13 @@ def _buildHelpMenu(self):
# 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
Expand Down
2 changes: 0 additions & 2 deletions nw/gui/preferences.py
Expand Up @@ -71,8 +71,6 @@ def __init__(self, theParent, theProject):
self.buttonBox.rejected.connect(self._doClose)
self.addControls(self.buttonBox)

self.show()

logger.debug("GuiPreferences initialisation complete")

return
Expand Down
28 changes: 23 additions & 5 deletions nw/guimain.py
Expand Up @@ -43,7 +43,7 @@
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
Expand Down Expand Up @@ -803,16 +803,34 @@ def buildProjectDialog(self):
"""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 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):
Expand Down