E5Gui/E5MessageBox.py

changeset 550
22b951013193
parent 549
fe99d46d56c8
child 553
5af61623ae3c
--- a/E5Gui/E5MessageBox.py	Fri Sep 03 13:39:08 2010 +0200
+++ b/E5Gui/E5MessageBox.py	Fri Sep 03 13:48:52 2010 +0200
@@ -151,6 +151,32 @@
                        yesDefault and QMessageBox.Yes or QMessageBox.No)
     return res == QMessageBox.Yes
 
+def retryAbort(parent, title, text, type_ = Question):
+    """
+    Function to show a model abort/retry message box.
+    
+    @param parent parent widget of the message box (QWidget)
+    @param title caption of the message box (string)
+    @param text text to be shown by the message box (string)
+    @keyparam type_ type of the dialog (Critical, Information, Question or Warning)
+    @return flag indicating the selection of the Retry button (boolean)
+    """
+    assert type_ in [Critical, Information, Question, Warning]
+    
+    if type_ == Question:
+        icon = QMessageBox.Question
+    elif type_ == Warning:
+        icon = QMessageBox.Warning
+    elif type_ == Critical:        
+        icon = QMessageBox.Critical
+    elif type_ == Information:
+        icon = QMessageBox.Information
+    
+    res = __messageBox(parent, title, text, icon, 
+                    QMessageBox.StandardButtons(QMessageBox.Retry | QMessageBox.Abort), 
+                    QMessageBox.Retry)
+    return res == QMessageBox.Retry
+
 def okToClearData(parent, title, text, saveFunc):
     """
     Function to show a model message box to ask for clearing the data.

eric ide

mercurial