148 |
148 |
149 res = __messageBox(parent, title, text, icon, |
149 res = __messageBox(parent, title, text, icon, |
150 QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), |
150 QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), |
151 yesDefault and QMessageBox.Yes or QMessageBox.No) |
151 yesDefault and QMessageBox.Yes or QMessageBox.No) |
152 return res == QMessageBox.Yes |
152 return res == QMessageBox.Yes |
|
153 |
|
154 def okToClearData(parent, title, text, saveFunc): |
|
155 """ |
|
156 Function to show a model message box to ask for clearing the data. |
|
157 |
|
158 @param parent parent widget of the message box (QWidget) |
|
159 @param title caption of the message box (string) |
|
160 @param text text to be shown by the message box (string) |
|
161 @param saveFunc reference to a function performing the save action. It |
|
162 must be a parameterless function returning a flag indicating success. |
|
163 @return flag indicating that it is ok to clear the data (boolean) |
|
164 """ |
|
165 res = __messageBox(parent, title, text, QMessageBox.Warning, |
|
166 QMessageBox.StandardButtons( |
|
167 QMessageBox.Abort | QMessageBox.Discard | QMessageBox.Save), |
|
168 QMessageBox.Save) |
|
169 if res == QMessageBox.Abort: |
|
170 return False |
|
171 if res == QMessageBox.Save: |
|
172 return saveFunc() |
|
173 return True |