E5Gui/E5MessageBox.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3022
57179e4cdadd
child 3145
a9de05d4a22f
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
237 @param textFormat format of the text (Qt.TextFormat) 237 @param textFormat format of the text (Qt.TextFormat)
238 @return flag indicating the selection of the Yes button (boolean) 238 @return flag indicating the selection of the Yes button (boolean)
239 """ 239 """
240 assert icon in [Critical, Information, Question, Warning] 240 assert icon in [Critical, Information, Question, Warning]
241 241
242 res = __messageBox(parent, title, text, icon, 242 res = __messageBox(
243 QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No), 243 parent, title, text, icon,
244 yesDefault and QMessageBox.Yes or QMessageBox.No, 244 QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No),
245 textFormat) 245 yesDefault and QMessageBox.Yes or QMessageBox.No,
246 textFormat)
246 return res == QMessageBox.Yes 247 return res == QMessageBox.Yes
247 248
248 249
249 def retryAbort(parent, title, text, icon=Question, textFormat=Qt.AutoText): 250 def retryAbort(parent, title, text, icon=Question, textFormat=Qt.AutoText):
250 """ 251 """
258 @param textFormat format of the text (Qt.TextFormat) 259 @param textFormat format of the text (Qt.TextFormat)
259 @return flag indicating the selection of the Retry button (boolean) 260 @return flag indicating the selection of the Retry button (boolean)
260 """ 261 """
261 assert icon in [Critical, Information, Question, Warning] 262 assert icon in [Critical, Information, Question, Warning]
262 263
263 res = __messageBox(parent, title, text, icon, 264 res = __messageBox(
264 QMessageBox.StandardButtons(QMessageBox.Retry | QMessageBox.Abort), 265 parent, title, text, icon,
265 QMessageBox.Retry, 266 QMessageBox.StandardButtons(QMessageBox.Retry | QMessageBox.Abort),
266 textFormat) 267 QMessageBox.Retry,
268 textFormat)
267 return res == QMessageBox.Retry 269 return res == QMessageBox.Retry
268 270
269 271
270 def okToClearData(parent, title, text, saveFunc, textFormat=Qt.AutoText): 272 def okToClearData(parent, title, text, saveFunc, textFormat=Qt.AutoText):
271 """ 273 """
277 @param saveFunc reference to a function performing the save action. It 279 @param saveFunc reference to a function performing the save action. It
278 must be a parameterless function returning a flag indicating success. 280 must be a parameterless function returning a flag indicating success.
279 @param textFormat format of the text (Qt.TextFormat) 281 @param textFormat format of the text (Qt.TextFormat)
280 @return flag indicating that it is ok to clear the data (boolean) 282 @return flag indicating that it is ok to clear the data (boolean)
281 """ 283 """
282 res = __messageBox(parent, title, text, QMessageBox.Warning, 284 res = __messageBox(
283 QMessageBox.StandardButtons( 285 parent, title, text, QMessageBox.Warning,
284 QMessageBox.Abort | QMessageBox.Discard | QMessageBox.Save), 286 QMessageBox.StandardButtons(
285 QMessageBox.Save, 287 QMessageBox.Abort | QMessageBox.Discard | QMessageBox.Save),
286 textFormat) 288 QMessageBox.Save,
289 textFormat)
287 if res == QMessageBox.Abort: 290 if res == QMessageBox.Abort:
288 return False 291 return False
289 if res == QMessageBox.Save: 292 if res == QMessageBox.Save:
290 return saveFunc() 293 return saveFunc()
291 return True 294 return True

eric ide

mercurial