Significant improvements to dialog tests
This commit is contained in:
+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" % (
|
||||
|
||||
Reference in New Issue
Block a user