Significant improvements to dialog tests
This commit is contained in:
+1
-1
@@ -195,7 +195,7 @@ def main(sysArgs=None):
|
||||
testMode = True
|
||||
|
||||
# Set Config Options
|
||||
CONFIG.blockGUI = not testMode
|
||||
CONFIG.showGUI = not testMode
|
||||
CONFIG.debugInfo = debugLevel < logging.INFO
|
||||
CONFIG.cmdOpen = cmdOpen
|
||||
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ class Config:
|
||||
self.appHandle = self.appName.lower()
|
||||
|
||||
# Debug Settings
|
||||
self.blockGUI = True # Allow blocking the GUI (disabled for testing)
|
||||
self.showGUI = True # Allow blocking the GUI (disabled for testing)
|
||||
self.debugInfo = False # True if log level is DEBUG or VERBOSE
|
||||
|
||||
# Config Error Handling
|
||||
|
||||
+9
-4
@@ -382,6 +382,7 @@ class NWProject():
|
||||
# ==========================
|
||||
|
||||
if not self.ensureFolderStructure():
|
||||
self.clearProject()
|
||||
return False
|
||||
|
||||
self.projDict = path.join(self.projMeta, nwFiles.PROJ_DICT)
|
||||
@@ -475,6 +476,7 @@ class NWProject():
|
||||
"Project file does not appear to be a novelWriterXML file.",
|
||||
nwAlert.ERROR
|
||||
)
|
||||
self.clearProject()
|
||||
return False
|
||||
|
||||
# Check Project Storage Version
|
||||
@@ -489,7 +491,7 @@ class NWProject():
|
||||
# parser will lose the autoReplace settings if allowed to
|
||||
# read the file. Introduced in version 0.10.
|
||||
|
||||
if fileVersion == "1.0" and self.mainConf.blockGUI:
|
||||
if fileVersion == "1.0" and self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(self.theParent, "Old Project Version", (
|
||||
"The project file and data is created by a novelWriter version "
|
||||
@@ -499,9 +501,10 @@ class NWProject():
|
||||
"any more, so make sure you have a recent backup."
|
||||
))
|
||||
if msgRes != QMessageBox.Yes:
|
||||
self.clearProject()
|
||||
return False
|
||||
|
||||
elif fileVersion != "1.1" and fileVersion != "1.2" and self.mainConf.blockGUI:
|
||||
elif fileVersion != "1.1" and fileVersion != "1.2" and self.mainConf.showGUI:
|
||||
self.makeAlert((
|
||||
"Unknown or unsupported novelWriter project file format. "
|
||||
"The project cannot be opened by this version of novelWriter. "
|
||||
@@ -509,12 +512,13 @@ class NWProject():
|
||||
).format(
|
||||
vers = appVersion,
|
||||
), nwAlert.ERROR)
|
||||
self.clearProject()
|
||||
return False
|
||||
|
||||
# Check novelWriter Version
|
||||
# =========================
|
||||
|
||||
if int(hexVersion, 16) > int(nw.__hexversion__, 16) and self.mainConf.blockGUI:
|
||||
if int(hexVersion, 16) > int(nw.__hexversion__, 16) and self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(self.theParent, "Version Conflict", (
|
||||
"This project was saved by a newer version of novelWriter, version %s. "
|
||||
@@ -525,6 +529,7 @@ class NWProject():
|
||||
appVersion, nw.__version__
|
||||
))
|
||||
if msgRes != QMessageBox.Yes:
|
||||
self.clearProject()
|
||||
return False
|
||||
|
||||
# Start Parsing the XML
|
||||
@@ -927,7 +932,7 @@ class NWProject():
|
||||
return False
|
||||
|
||||
if path.isdir(projPath):
|
||||
if self.mainConf.blockGUI and listdir(self.projPath):
|
||||
if self.mainConf.showGUI and listdir(self.projPath):
|
||||
self.theParent.makeAlert((
|
||||
"New project folder is not empty. "
|
||||
"Each project requires a dedicated project folder."
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ def exceptionHandler(exType, exValue, exTrace, testMode=False):
|
||||
|
||||
errMsg = NWErrorMessage(nwGUI)
|
||||
errMsg.setMessage(exType, exValue, exTrace)
|
||||
if nw.CONFIG.blockGUI:
|
||||
if nw.CONFIG.showGUI:
|
||||
errMsg.exec_()
|
||||
|
||||
try:
|
||||
|
||||
+2
-2
@@ -634,7 +634,7 @@ class GuiBuildNovel(QDialog):
|
||||
if not path.isdir(saveDir):
|
||||
saveDir = self.mainConf.homePath
|
||||
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
saveTo = QFileDialog.getSaveFileName(
|
||||
@@ -746,7 +746,7 @@ class GuiBuildNovel(QDialog):
|
||||
errMsg = "Unknown format"
|
||||
|
||||
# Report to user
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s file successfully written to:<br> %s" % (
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ class GuiDocSplit(QDialog):
|
||||
), nwAlert.ERROR)
|
||||
return
|
||||
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Split Document", (
|
||||
|
||||
+4
-4
@@ -192,7 +192,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aOpenProject = QAction("Open Project", self)
|
||||
self.aOpenProject.setStatusTip("Open project")
|
||||
self.aOpenProject.setShortcut("Ctrl+Shift+O")
|
||||
self.aOpenProject.triggered.connect(lambda: self.theParent.manageProjects())
|
||||
self.aOpenProject.triggered.connect(lambda: self.theParent.showProjectLoadDialog())
|
||||
self.projMenu.addAction(self.aOpenProject)
|
||||
|
||||
# Project > Save Project
|
||||
@@ -213,7 +213,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aProjectSettings = QAction("Project Settings", self)
|
||||
self.aProjectSettings.setStatusTip("Project settings")
|
||||
self.aProjectSettings.setShortcut("Ctrl+Shift+,")
|
||||
self.aProjectSettings.triggered.connect(lambda: self.theParent.editProjectDialog())
|
||||
self.aProjectSettings.triggered.connect(lambda: self.theParent.showProjectSettingsDialog())
|
||||
self.projMenu.addAction(self.aProjectSettings)
|
||||
|
||||
# Project > Separator
|
||||
@@ -829,7 +829,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aBuildProject = QAction("Build Novel Project", self)
|
||||
self.aBuildProject.setStatusTip("Launch the Build novel project tool")
|
||||
self.aBuildProject.setShortcut("F5")
|
||||
self.aBuildProject.triggered.connect(lambda: self.theParent.buildProjectDialog())
|
||||
self.aBuildProject.triggered.connect(lambda: self.theParent.showBuildProjectDialog())
|
||||
self.toolsMenu.addAction(self.aBuildProject)
|
||||
|
||||
# Tools > Writing Stats
|
||||
@@ -843,7 +843,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aPreferences = QAction("Preferences", self)
|
||||
self.aPreferences.setStatusTip("Preferences")
|
||||
self.aPreferences.setShortcut("Ctrl+,")
|
||||
self.aPreferences.triggered.connect(lambda: self.theParent.editConfigDialog())
|
||||
self.aPreferences.triggered.connect(lambda: self.theParent.showPreferencesDialog())
|
||||
self.toolsMenu.addAction(self.aPreferences)
|
||||
|
||||
return
|
||||
|
||||
@@ -104,7 +104,7 @@ class GuiPreferences(PagedDialog):
|
||||
validEntries &= retA
|
||||
needsRestart |= retB
|
||||
|
||||
if needsRestart and self.mainConf.blockGUI:
|
||||
if needsRestart:
|
||||
msgBox = QMessageBox()
|
||||
msgBox.information(
|
||||
self, "Preferences",
|
||||
@@ -120,7 +120,7 @@ class GuiPreferences(PagedDialog):
|
||||
"""Close the preferences without saving the changes.
|
||||
"""
|
||||
logger.verbose("ConfigEditor close button clicked")
|
||||
self.close()
|
||||
self.reject()
|
||||
return
|
||||
|
||||
# END Class GuiPreferences
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ class GuiProjectLoad(QDialog):
|
||||
"""Browse for a folder path.
|
||||
"""
|
||||
logger.verbose("GuiProjectLoad browse button clicked")
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
projFile, _ = QFileDialog.getOpenFileName(
|
||||
@@ -219,7 +219,7 @@ class GuiProjectLoad(QDialog):
|
||||
selList = self.listBox.selectedItems()
|
||||
if selList:
|
||||
doRemove = False
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Remove Entry",
|
||||
|
||||
+13
-3
@@ -124,13 +124,25 @@ class GuiProjectSettings(PagedDialog):
|
||||
newList = self.tabReplace.getNewList()
|
||||
self.theProject.setAutoReplace(newList)
|
||||
|
||||
self._doClose()
|
||||
self._saveGuiSettings()
|
||||
self.accept()
|
||||
|
||||
return
|
||||
|
||||
def _doClose(self):
|
||||
"""Save settings and close the dialog.
|
||||
"""
|
||||
self._saveGuiSettings()
|
||||
self.reject()
|
||||
return
|
||||
|
||||
##
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _saveGuiSettings(self):
|
||||
"""Save GUI settings.
|
||||
"""
|
||||
winWidth = self.mainConf.rpxInt(self.width())
|
||||
winHeight = self.mainConf.rpxInt(self.height())
|
||||
replaceColW = self.mainConf.rpxInt(self.tabReplace.listBox.columnWidth(0))
|
||||
@@ -139,8 +151,6 @@ class GuiProjectSettings(PagedDialog):
|
||||
self.optState.setValue("GuiProjectSettings", "winHeight", winHeight)
|
||||
self.optState.setValue("GuiProjectSettings", "replaceColW", replaceColW)
|
||||
|
||||
self.close()
|
||||
|
||||
return
|
||||
|
||||
# END Class GuiProjectSettings
|
||||
|
||||
+4
-4
@@ -261,7 +261,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
"""Move an item up or down in the tree, but only if the treeView
|
||||
has focus. This also applies when the menu is used.
|
||||
"""
|
||||
hasFocus = qApp.focusWidget() == self or not self.mainConf.blockGUI
|
||||
hasFocus = qApp.focusWidget() == self or not self.mainConf.showGUI
|
||||
if hasFocus and self.theParent.hasProject:
|
||||
|
||||
tHandle = self.getSelectedHandle()
|
||||
@@ -362,7 +362,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
self.makeAlert("The Trash folder is already empty.", nwAlert.INFO)
|
||||
return False
|
||||
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Empty Trash", "Permanently delete %d file%s from Trash?" % (
|
||||
@@ -416,7 +416,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
# If the file is in the trash folder already, as the
|
||||
# user if they want to permanently delete the file.
|
||||
doPermanent = False
|
||||
if self.mainConf.blockGUI and not alreadyAsked:
|
||||
if self.mainConf.showGUI and not alreadyAsked:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Delete File", "Permanently delete file '%s'?" % nwItemS.itemName
|
||||
@@ -445,7 +445,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
# The file is not already in the trash folder, so we
|
||||
# move it there.
|
||||
doTrash = False
|
||||
if self.mainConf.blockGUI and askForTrash:
|
||||
if self.mainConf.showGUI and askForTrash:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Delete File", "Move file '%s' to Trash?" % nwItemS.itemName
|
||||
|
||||
@@ -326,7 +326,7 @@ class GuiWritingStats(QDialog):
|
||||
if not path.isdir(saveDir):
|
||||
saveDir = self.mainConf.homePath
|
||||
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
saveTo = QFileDialog.getSaveFileName(
|
||||
@@ -380,7 +380,7 @@ class GuiWritingStats(QDialog):
|
||||
errMsg = str(e)
|
||||
|
||||
# Report to user
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s file successfully written to:<br> %s" % (
|
||||
|
||||
+75
-63
@@ -195,8 +195,8 @@ class GuiMain(QMainWindow):
|
||||
self.setStatus = self.statusBar.setStatus
|
||||
self.setProjectStatus = self.statusBar.setProjectStatus
|
||||
|
||||
if self.mainConf.blockGUI:
|
||||
self.show()
|
||||
# Force a show of the GUI
|
||||
self.show()
|
||||
|
||||
# Check that config loaded fine
|
||||
self.reportConfErr()
|
||||
@@ -218,7 +218,8 @@ class GuiMain(QMainWindow):
|
||||
logger.debug("Opening project from additional command line option")
|
||||
self.openProject(self.mainConf.cmdOpen)
|
||||
else:
|
||||
self.manageProjects()
|
||||
if self.mainConf.showGUI:
|
||||
self.showProjectLoadDialog()
|
||||
|
||||
logger.debug("novelWriter is ready ...")
|
||||
self.statusBar.setStatus("novelWriter is ready ...")
|
||||
@@ -245,24 +246,6 @@ class GuiMain(QMainWindow):
|
||||
# Project Actions
|
||||
##
|
||||
|
||||
def manageProjects(self):
|
||||
"""Opens the projects dialog for selecting either existing
|
||||
projects from a cache of recently opened projects, or provide a
|
||||
browse button for projects not yet cached.
|
||||
"""
|
||||
if not self.mainConf.blockGUI:
|
||||
return False
|
||||
|
||||
dlgProj = GuiProjectLoad(self)
|
||||
dlgProj.exec_()
|
||||
if dlgProj.result() == QDialog.Accepted:
|
||||
if dlgProj.openState == GuiProjectLoad.OPEN_STATE:
|
||||
self.openProject(dlgProj.openPath)
|
||||
elif dlgProj.openState == GuiProjectLoad.NEW_STATE:
|
||||
self.newProject()
|
||||
|
||||
return True
|
||||
|
||||
def newProject(self, projData=None, forceNew=False):
|
||||
"""Create new project with a few default files and folders.
|
||||
The variable forceNew is used for testing.
|
||||
@@ -275,8 +258,8 @@ class GuiMain(QMainWindow):
|
||||
)
|
||||
return False
|
||||
|
||||
if projData is None and self.mainConf.blockGUI:
|
||||
projData = self.newProjectDialog()
|
||||
if projData is None and self.mainConf.showGUI:
|
||||
projData = self.showNewProjectDialog()
|
||||
|
||||
if projData is None:
|
||||
return False
|
||||
@@ -316,7 +299,7 @@ class GuiMain(QMainWindow):
|
||||
# There is no project loaded, everything OK
|
||||
return True
|
||||
|
||||
if self.mainConf.blockGUI and not isYes:
|
||||
if self.mainConf.showGUI and not isYes:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Close Project", "Save changes and close current project?"
|
||||
@@ -332,7 +315,7 @@ class GuiMain(QMainWindow):
|
||||
doBackup = False
|
||||
if self.theProject.doBackup and self.mainConf.backupOnClose:
|
||||
doBackup = True
|
||||
if self.mainConf.blockGUI and self.mainConf.askBeforeBackup:
|
||||
if self.mainConf.showGUI and self.mainConf.askBeforeBackup:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Backup Project", "Backup current project?"
|
||||
@@ -379,7 +362,7 @@ class GuiMain(QMainWindow):
|
||||
# reason handled by the project class.
|
||||
return False
|
||||
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
try:
|
||||
lockDetails = (
|
||||
"<br><br>The project was locked by the computer "
|
||||
@@ -449,7 +432,7 @@ class GuiMain(QMainWindow):
|
||||
|
||||
# If the project is new, it may not have a path, so we need one
|
||||
if self.theProject.projPath is None:
|
||||
projPath = self.saveProjectDialog()
|
||||
projPath = self.selectProjectPath()
|
||||
self.theProject.setProjectPath(projPath)
|
||||
if self.theProject.projPath is None:
|
||||
return False
|
||||
@@ -611,7 +594,7 @@ class GuiMain(QMainWindow):
|
||||
return False
|
||||
|
||||
if not self.docEditor.isEmpty():
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(self, "Import Document", (
|
||||
"Importing the file will overwrite the current content of the document. "
|
||||
@@ -629,7 +612,7 @@ class GuiMain(QMainWindow):
|
||||
def mergeDocuments(self):
|
||||
"""Merge multiple documents to one single new document.
|
||||
"""
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
dlgMerge = GuiDocMerge(self, self.theProject)
|
||||
dlgMerge.exec_()
|
||||
return True
|
||||
@@ -637,7 +620,7 @@ class GuiMain(QMainWindow):
|
||||
def splitDocument(self):
|
||||
"""Split a single document into multiple documents.
|
||||
"""
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
dlgSplit = GuiDocSplit(self, self.theProject)
|
||||
dlgSplit.exec_()
|
||||
return True
|
||||
@@ -684,7 +667,7 @@ class GuiMain(QMainWindow):
|
||||
return
|
||||
|
||||
logger.verbose("Requesting change to item %s" % tHandle)
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
dlgProj = GuiItemEditor(self, self.theProject, tHandle)
|
||||
dlgProj.exec_()
|
||||
if dlgProj.result() == QDialog.Accepted:
|
||||
@@ -746,7 +729,7 @@ class GuiMain(QMainWindow):
|
||||
|
||||
qApp.restoreOverrideCursor()
|
||||
|
||||
if self.mainConf.blockGUI and not beQuiet:
|
||||
if self.mainConf.showGUI and not beQuiet:
|
||||
self.makeAlert("The project index has been successfully rebuilt.", nwAlert.INFO)
|
||||
|
||||
return True
|
||||
@@ -763,7 +746,7 @@ class GuiMain(QMainWindow):
|
||||
# Main Dialogs
|
||||
##
|
||||
|
||||
def saveProjectDialog(self):
|
||||
def selectProjectPath(self):
|
||||
"""Select where to save project.
|
||||
"""
|
||||
dlgOpt = QFileDialog.Options()
|
||||
@@ -776,7 +759,22 @@ class GuiMain(QMainWindow):
|
||||
return projPath
|
||||
return None
|
||||
|
||||
def newProjectDialog(self):
|
||||
def showProjectLoadDialog(self):
|
||||
"""Opens the projects dialog for selecting either existing
|
||||
projects from a cache of recently opened projects, or provide a
|
||||
browse button for projects not yet cached.
|
||||
"""
|
||||
dlgProj = GuiProjectLoad(self)
|
||||
dlgProj.exec_()
|
||||
if dlgProj.result() == QDialog.Accepted:
|
||||
if dlgProj.openState == GuiProjectLoad.OPEN_STATE:
|
||||
self.openProject(dlgProj.openPath)
|
||||
elif dlgProj.openState == GuiProjectLoad.NEW_STATE:
|
||||
self.newProject()
|
||||
|
||||
return True
|
||||
|
||||
def showNewProjectDialog(self):
|
||||
"""Open the wizard and assemble the project options dict.
|
||||
"""
|
||||
newProj = GuiProjectWizard(self)
|
||||
@@ -787,62 +785,76 @@ class GuiMain(QMainWindow):
|
||||
|
||||
return None
|
||||
|
||||
def editConfigDialog(self):
|
||||
def showPreferencesDialog(self):
|
||||
"""Open the preferences dialog.
|
||||
"""
|
||||
dlgConf = GuiPreferences(self, self.theProject)
|
||||
if dlgConf.exec_() == QDialog.Accepted:
|
||||
dlgConf.exec_()
|
||||
|
||||
if dlgConf.result() == QDialog.Accepted:
|
||||
logger.debug("Applying new preferences")
|
||||
self.initMain()
|
||||
self.theTheme.updateTheme()
|
||||
self.saveDocument()
|
||||
self.docEditor.initEditor()
|
||||
self.docViewer.initViewer()
|
||||
return True
|
||||
|
||||
def editProjectDialog(self):
|
||||
return
|
||||
|
||||
def showProjectSettingsDialog(self):
|
||||
"""Open the project settings dialog.
|
||||
"""
|
||||
if self.hasProject:
|
||||
dlgProj = GuiProjectSettings(self, self.theProject)
|
||||
dlgProj.exec_()
|
||||
if not self.hasProject:
|
||||
logger.error("No project open")
|
||||
return
|
||||
|
||||
dlgProj = GuiProjectSettings(self, self.theProject)
|
||||
dlgProj.exec_()
|
||||
|
||||
if dlgProj.result() == QDialog.Accepted:
|
||||
logger.debug("Applying new project settings")
|
||||
self.docEditor.setDictionaries()
|
||||
self._setWindowTitle(self.theProject.projName)
|
||||
return True
|
||||
|
||||
def buildProjectDialog(self):
|
||||
return
|
||||
|
||||
def showBuildProjectDialog(self):
|
||||
"""Open the build project dialog.
|
||||
"""
|
||||
if self.hasProject:
|
||||
dlgBuild = GuiBuildNovel(self, self.theProject)
|
||||
dlgBuild.setModal(False)
|
||||
dlgBuild.show()
|
||||
return True
|
||||
if not self.hasProject:
|
||||
logger.error("No project open")
|
||||
return
|
||||
|
||||
dlgBuild = GuiBuildNovel(self, self.theProject)
|
||||
dlgBuild.setModal(False)
|
||||
dlgBuild.show()
|
||||
return
|
||||
|
||||
def showWritingStatsDialog(self):
|
||||
"""Open the session log dialog.
|
||||
"""
|
||||
if self.hasProject:
|
||||
dlgStats = GuiWritingStats(self, self.theProject)
|
||||
dlgStats.setModal(False)
|
||||
dlgStats.show()
|
||||
return True
|
||||
if not self.hasProject:
|
||||
logger.error("No project open")
|
||||
return
|
||||
|
||||
dlgStats = GuiWritingStats(self, self.theProject)
|
||||
dlgStats.setModal(False)
|
||||
dlgStats.show()
|
||||
return
|
||||
|
||||
def showAboutNWDialog(self):
|
||||
"""Show the about dialog for novelWriter.
|
||||
"""
|
||||
if self.mainConf.blockGUI:
|
||||
dlgAbout = GuiAbout(self)
|
||||
dlgAbout.exec_()
|
||||
return True
|
||||
dlgAbout = GuiAbout(self)
|
||||
dlgAbout.exec_()
|
||||
return
|
||||
|
||||
def showAboutQtDialog(self):
|
||||
"""Show the about dialog for Qt.
|
||||
"""
|
||||
if self.mainConf.blockGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgBox.aboutQt(self, "About Qt")
|
||||
return True
|
||||
msgBox = QMessageBox()
|
||||
msgBox.aboutQt(self, "About Qt")
|
||||
return
|
||||
|
||||
def makeAlert(self, theMessage, theLevel=nwAlert.INFO):
|
||||
"""Alert both the user and the logger at the same time. Message
|
||||
@@ -871,7 +883,7 @@ class GuiMain(QMainWindow):
|
||||
logger.error(msgLine)
|
||||
|
||||
# Popup
|
||||
if self.mainConf.blockGUI:
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
if theLevel == nwAlert.INFO:
|
||||
msgBox.information(self, "Information", popMsg)
|
||||
@@ -902,7 +914,7 @@ class GuiMain(QMainWindow):
|
||||
def closeMain(self):
|
||||
"""Save everything, and close novelWriter.
|
||||
"""
|
||||
if self.mainConf.blockGUI and self.hasProject:
|
||||
if self.mainConf.showGUI and self.hasProject:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Exit", "Do you want to save changes and exit?"
|
||||
|
||||
Reference in New Issue
Block a user