All message box questions are now handled in test suite, so no need to check for showGUI
This commit is contained in:
+10
-11
@@ -163,17 +163,16 @@ class GuiDocSplit(QDialog):
|
||||
), nwAlert.ERROR)
|
||||
return
|
||||
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Split Document", (
|
||||
"The document will be split into %d file(s) in a new folder. "
|
||||
"The original document will remain intact.<br><br>"
|
||||
"Continue with the splitting process?"
|
||||
) % nFiles
|
||||
)
|
||||
if msgRes != QMessageBox.Yes:
|
||||
return
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Split Document", (
|
||||
"The document will be split into %d file(s) in a new folder. "
|
||||
"The original document will remain intact.<br><br>"
|
||||
"Continue with the splitting process?"
|
||||
) % nFiles
|
||||
)
|
||||
if msgRes != QMessageBox.Yes:
|
||||
return
|
||||
|
||||
# Create the folder
|
||||
fHandle = self.theProject.newFolder(
|
||||
|
||||
+6
-12
@@ -218,18 +218,12 @@ class GuiProjectLoad(QDialog):
|
||||
"""
|
||||
selList = self.listBox.selectedItems()
|
||||
if selList:
|
||||
doRemove = False
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Remove Entry",
|
||||
"Remove the selected entry from the recent projects list?"
|
||||
)
|
||||
doRemove = (msgRes == QMessageBox.Yes)
|
||||
else:
|
||||
doRemove = True
|
||||
|
||||
if doRemove:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Remove Entry",
|
||||
"Remove the selected entry from the recent projects list?"
|
||||
)
|
||||
if msgRes == QMessageBox.Yes:
|
||||
self.mainConf.removeFromRecentCache(
|
||||
selList[0].data(self.C_NAME, Qt.UserRole)
|
||||
)
|
||||
|
||||
+9
-10
@@ -362,15 +362,14 @@ class GuiProjectTree(QTreeWidget):
|
||||
self.makeAlert("The Trash folder is already empty.", nwAlert.INFO)
|
||||
return False
|
||||
|
||||
if self.mainConf.showGUI:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Empty Trash", "Permanently delete %d file%s from Trash?" % (
|
||||
nTrash, "s" if nTrash > 1 else ""
|
||||
)
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Empty Trash", "Permanently delete %d file%s from Trash?" % (
|
||||
nTrash, "s" if nTrash > 1 else ""
|
||||
)
|
||||
if msgRes != QMessageBox.Yes:
|
||||
return False
|
||||
)
|
||||
if msgRes != QMessageBox.Yes:
|
||||
return False
|
||||
|
||||
logger.verbose("Deleting %d files from Trash" % nTrash)
|
||||
for tHandle in self.getTreeFromHandle(trashHandle):
|
||||
@@ -416,7 +415,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.showGUI and not alreadyAsked:
|
||||
if not alreadyAsked:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Delete File", "Permanently delete file '%s'?" % nwItemS.itemName
|
||||
@@ -445,7 +444,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
# The file is not already in the trash folder, so we
|
||||
# move it there.
|
||||
doTrash = False
|
||||
if self.mainConf.showGUI and askForTrash:
|
||||
if askForTrash:
|
||||
msgBox = QMessageBox()
|
||||
msgRes = msgBox.question(
|
||||
self, "Delete File", "Move file '%s' to Trash?" % nwItemS.itemName
|
||||
|
||||
+12
-13
@@ -380,19 +380,18 @@ class GuiWritingStats(QDialog):
|
||||
errMsg = str(e)
|
||||
|
||||
# Report to user
|
||||
if self.mainConf.showGUI:
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s file successfully written to:<br> %s" % (
|
||||
textFmt, savePath
|
||||
), nwAlert.INFO
|
||||
)
|
||||
else:
|
||||
self.theParent.makeAlert(
|
||||
"Failed to write %s file. %s" % (
|
||||
textFmt, errMsg
|
||||
), nwAlert.ERROR
|
||||
)
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s file successfully written to:<br> %s" % (
|
||||
textFmt, savePath
|
||||
), nwAlert.INFO
|
||||
)
|
||||
else:
|
||||
self.theParent.makeAlert(
|
||||
"Failed to write %s file. %s" % (
|
||||
textFmt, errMsg
|
||||
), nwAlert.ERROR
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user