src/eric7/EricWidgets/EricMessageBox.py

branch
eric7
changeset 9757
ab6e87f6f1c4
parent 9653
e67609152c5e
child 10060
b946699e9e79
diff -r 9854647c8c5c -r ab6e87f6f1c4 src/eric7/EricWidgets/EricMessageBox.py
--- a/src/eric7/EricWidgets/EricMessageBox.py	Mon Feb 13 17:49:52 2023 +0100
+++ b/src/eric7/EricWidgets/EricMessageBox.py	Mon Feb 13 17:51:03 2023 +0100
@@ -325,7 +325,7 @@
 
 def okToClearData(parent, title, text, saveFunc, textFormat=Qt.TextFormat.AutoText):
     """
-    Function to show a model message box to ask for clearing the data.
+    Function to show a modal message box to ask for clearing the data.
 
     @param parent parent widget of the message box (QWidget)
     @param title caption of the message box (string)
@@ -335,16 +335,15 @@
     @param textFormat format of the text (Qt.TextFormat)
     @return flag indicating that it is ok to clear the data (boolean)
     """
+    buttons = QMessageBox.StandardButton.Abort | QMessageBox.StandardButton.Discard
+    if saveFunc:
+        buttons |= QMessageBox.StandardButton.Save
     res = __messageBox(
         parent,
         title,
         text,
         QMessageBox.Icon.Warning,
-        (
-            QMessageBox.StandardButton.Abort
-            | QMessageBox.StandardButton.Discard
-            | QMessageBox.StandardButton.Save
-        ),
+        buttons,
         QMessageBox.StandardButton.Save,
         textFormat,
     )

eric ide

mercurial