src/eric7/Plugins/WizardPlugins/EricMessageBoxWizard/EricMessageBoxWizardDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 18
19 19
20 class EricMessageBoxWizardDialog(QDialog, Ui_EricMessageBoxWizardDialog): 20 class EricMessageBoxWizardDialog(QDialog, Ui_EricMessageBoxWizardDialog):
21 """ 21 """
22 Class implementing the eric message box wizard dialog. 22 Class implementing the eric message box wizard dialog.
23 23
24 It displays a dialog for entering the parameters 24 It displays a dialog for entering the parameters
25 for the EricMessageBox code generator. 25 for the EricMessageBox code generator.
26 """ 26 """
27
27 def __init__(self, parent=None): 28 def __init__(self, parent=None):
28 """ 29 """
29 Constructor 30 Constructor
30 31
31 @param parent reference to the parent widget 32 @param parent reference to the parent widget
32 @type QWidget 33 @type QWidget
33 """ 34 """
34 super().__init__(parent) 35 super().__init__(parent)
35 self.setupUi(self) 36 self.setupUi(self)
36 37
37 # keep the following three lists in sync 38 # keep the following three lists in sync
38 self.buttonsList = [ 39 self.buttonsList = [
39 self.tr("No button"), 40 self.tr("No button"),
40 self.tr("Abort"), 41 self.tr("Abort"),
41 self.tr("Apply"), 42 self.tr("Apply"),
96 "EricMessageBox.Save", 97 "EricMessageBox.Save",
97 "EricMessageBox.SaveAll", 98 "EricMessageBox.SaveAll",
98 "EricMessageBox.Yes", 99 "EricMessageBox.Yes",
99 "EricMessageBox.YesToAll", 100 "EricMessageBox.YesToAll",
100 ] 101 ]
101 102
102 self.defaultCombo.addItems(self.buttonsList) 103 self.defaultCombo.addItems(self.buttonsList)
103 104
104 self.bTest = self.buttonBox.addButton( 105 self.bTest = self.buttonBox.addButton(
105 self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole) 106 self.tr("Test"), QDialogButtonBox.ButtonRole.ActionRole
106 107 )
108
107 self.__enabledGroups() 109 self.__enabledGroups()
108 110
109 def __enabledGroups(self): 111 def __enabledGroups(self):
110 """ 112 """
111 Private method to enable/disable some group boxes. 113 Private method to enable/disable some group boxes.
112 """ 114 """
113 self.standardButtons.setEnabled( 115 self.standardButtons.setEnabled(
114 self.rInformation.isChecked() or 116 self.rInformation.isChecked()
115 self.rQuestion.isChecked() or 117 or self.rQuestion.isChecked()
116 self.rWarning.isChecked() or 118 or self.rWarning.isChecked()
117 self.rCritical.isChecked() or 119 or self.rCritical.isChecked()
118 self.rStandard.isChecked() 120 or self.rStandard.isChecked()
119 ) 121 )
120 122
121 self.defaultButton.setEnabled( 123 self.defaultButton.setEnabled(
122 self.rInformation.isChecked() or 124 self.rInformation.isChecked()
123 self.rQuestion.isChecked() or 125 or self.rQuestion.isChecked()
124 self.rWarning.isChecked() or 126 or self.rWarning.isChecked()
125 self.rCritical.isChecked() 127 or self.rCritical.isChecked()
126 ) 128 )
127 129
128 self.iconBox.setEnabled( 130 self.iconBox.setEnabled(
129 self.rYesNo.isChecked() or 131 self.rYesNo.isChecked()
130 self.rRetryAbort.isChecked() or 132 or self.rRetryAbort.isChecked()
131 self.rStandard.isChecked() 133 or self.rStandard.isChecked()
132 ) 134 )
133 135
134 self.bTest.setEnabled(not self.rStandard.isChecked()) 136 self.bTest.setEnabled(not self.rStandard.isChecked())
135 137
136 self.eMessage.setEnabled(not self.rAboutQt.isChecked()) 138 self.eMessage.setEnabled(not self.rAboutQt.isChecked())
137 139
138 @pyqtSlot(bool) 140 @pyqtSlot(bool)
139 def on_rInformation_toggled(self, on): 141 def on_rInformation_toggled(self, on):
140 """ 142 """
141 Private slot to handle the toggled signal of the rInformation 143 Private slot to handle the toggled signal of the rInformation
142 radio button. 144 radio button.
143 145
144 @param on toggle state (ignored) 146 @param on toggle state (ignored)
145 @type bool 147 @type bool
146 """ 148 """
147 self.__enabledGroups() 149 self.__enabledGroups()
148 150
149 @pyqtSlot(bool) 151 @pyqtSlot(bool)
150 def on_rQuestion_toggled(self, on): 152 def on_rQuestion_toggled(self, on):
151 """ 153 """
152 Private slot to handle the toggled signal of the rQuestion 154 Private slot to handle the toggled signal of the rQuestion
153 radio button. 155 radio button.
154 156
155 @param on toggle state (ignored) 157 @param on toggle state (ignored)
156 @type bool 158 @type bool
157 """ 159 """
158 self.__enabledGroups() 160 self.__enabledGroups()
159 161
160 @pyqtSlot(bool) 162 @pyqtSlot(bool)
161 def on_rWarning_toggled(self, on): 163 def on_rWarning_toggled(self, on):
162 """ 164 """
163 Private slot to handle the toggled signal of the rWarning 165 Private slot to handle the toggled signal of the rWarning
164 radio button. 166 radio button.
165 167
166 @param on toggle state (ignored) 168 @param on toggle state (ignored)
167 @type bool 169 @type bool
168 """ 170 """
169 self.__enabledGroups() 171 self.__enabledGroups()
170 172
171 @pyqtSlot(bool) 173 @pyqtSlot(bool)
172 def on_rCritical_toggled(self, on): 174 def on_rCritical_toggled(self, on):
173 """ 175 """
174 Private slot to handle the toggled signal of the rCritical 176 Private slot to handle the toggled signal of the rCritical
175 radio button. 177 radio button.
176 178
177 @param on toggle state (ignored) 179 @param on toggle state (ignored)
178 @type bool 180 @type bool
179 """ 181 """
180 self.__enabledGroups() 182 self.__enabledGroups()
181 183
182 @pyqtSlot(bool) 184 @pyqtSlot(bool)
183 def on_rYesNo_toggled(self, on): 185 def on_rYesNo_toggled(self, on):
184 """ 186 """
185 Private slot to handle the toggled signal of the rYesNo 187 Private slot to handle the toggled signal of the rYesNo
186 radio button. 188 radio button.
187 189
188 @param on toggle state (ignored) 190 @param on toggle state (ignored)
189 @type bool 191 @type bool
190 """ 192 """
191 self.__enabledGroups() 193 self.__enabledGroups()
192 194
193 @pyqtSlot(bool) 195 @pyqtSlot(bool)
194 def on_rRetryAbort_toggled(self, on): 196 def on_rRetryAbort_toggled(self, on):
195 """ 197 """
196 Private slot to handle the toggled signal of the rRetryAbort 198 Private slot to handle the toggled signal of the rRetryAbort
197 radio button. 199 radio button.
198 200
199 @param on toggle state (ignored) 201 @param on toggle state (ignored)
200 @type bool 202 @type bool
201 """ 203 """
202 self.__enabledGroups() 204 self.__enabledGroups()
203 205
204 @pyqtSlot(bool) 206 @pyqtSlot(bool)
205 def on_rOkToClearData_toggled(self, on): 207 def on_rOkToClearData_toggled(self, on):
206 """ 208 """
207 Private slot to handle the toggled signal of the rOkToClearData 209 Private slot to handle the toggled signal of the rOkToClearData
208 radio button. 210 radio button.
209 211
210 @param on toggle state (ignored) 212 @param on toggle state (ignored)
211 @type bool 213 @type bool
212 """ 214 """
213 self.__enabledGroups() 215 self.__enabledGroups()
214 216
215 @pyqtSlot(bool) 217 @pyqtSlot(bool)
216 def on_rAbout_toggled(self, on): 218 def on_rAbout_toggled(self, on):
217 """ 219 """
218 Private slot to handle the toggled signal of the rAbout 220 Private slot to handle the toggled signal of the rAbout
219 radio button. 221 radio button.
220 222
221 @param on toggle state (ignored) 223 @param on toggle state (ignored)
222 @type bool 224 @type bool
223 """ 225 """
224 self.__enabledGroups() 226 self.__enabledGroups()
225 227
226 @pyqtSlot(bool) 228 @pyqtSlot(bool)
227 def on_rAboutQt_toggled(self, on): 229 def on_rAboutQt_toggled(self, on):
228 """ 230 """
229 Private slot to handle the toggled signal of the rAboutQt 231 Private slot to handle the toggled signal of the rAboutQt
230 radio button. 232 radio button.
231 233
232 @param on toggle state (ignored) 234 @param on toggle state (ignored)
233 @type bool 235 @type bool
234 """ 236 """
235 self.__enabledGroups() 237 self.__enabledGroups()
236 238
237 @pyqtSlot(bool) 239 @pyqtSlot(bool)
238 def on_rStandard_toggled(self, on): 240 def on_rStandard_toggled(self, on):
239 """ 241 """
240 Private slot to handle the toggled signal of the rStandard 242 Private slot to handle the toggled signal of the rStandard
241 radio button. 243 radio button.
242 244
243 @param on toggle state (ignored) 245 @param on toggle state (ignored)
244 @type bool 246 @type bool
245 """ 247 """
246 self.__enabledGroups() 248 self.__enabledGroups()
247 249
248 @pyqtSlot(QAbstractButton) 250 @pyqtSlot(QAbstractButton)
249 def on_buttonBox_clicked(self, button): 251 def on_buttonBox_clicked(self, button):
250 """ 252 """
251 Private slot called by a button of the button box clicked. 253 Private slot called by a button of the button box clicked.
252 254
253 @param button button that was clicked 255 @param button button that was clicked
254 @type QAbstractButton 256 @type QAbstractButton
255 """ 257 """
256 if button == self.bTest: 258 if button == self.bTest:
257 self.on_bTest_clicked() 259 self.on_bTest_clicked()
258 260
259 @pyqtSlot() 261 @pyqtSlot()
260 def on_bTest_clicked(self): 262 def on_bTest_clicked(self):
261 """ 263 """
262 Private method to test the selected options. 264 Private method to test the selected options.
263 """ 265 """
264 if self.rAbout.isChecked(): 266 if self.rAbout.isChecked():
265 EricMessageBox.about( 267 EricMessageBox.about(
266 None, 268 None, self.eCaption.text(), self.eMessage.toPlainText()
267 self.eCaption.text(),
268 self.eMessage.toPlainText()
269 ) 269 )
270 elif self.rAboutQt.isChecked(): 270 elif self.rAboutQt.isChecked():
271 EricMessageBox.aboutQt( 271 EricMessageBox.aboutQt(None, self.eCaption.text())
272 None, self.eCaption.text()
273 )
274 elif ( 272 elif (
275 self.rInformation.isChecked() or 273 self.rInformation.isChecked()
276 self.rQuestion.isChecked() or 274 or self.rQuestion.isChecked()
277 self.rWarning.isChecked() or 275 or self.rWarning.isChecked()
278 self.rCritical.isChecked() 276 or self.rCritical.isChecked()
279 ): 277 ):
280 buttons = EricMessageBox.NoButton 278 buttons = EricMessageBox.NoButton
281 if self.abortCheck.isChecked(): 279 if self.abortCheck.isChecked():
282 buttons |= EricMessageBox.Abort 280 buttons |= EricMessageBox.Abort
283 if self.applyCheck.isChecked(): 281 if self.applyCheck.isChecked():
314 buttons |= EricMessageBox.Yes 312 buttons |= EricMessageBox.Yes
315 if self.yestoallCheck.isChecked(): 313 if self.yestoallCheck.isChecked():
316 buttons |= EricMessageBox.YesToAll 314 buttons |= EricMessageBox.YesToAll
317 if buttons == EricMessageBox.NoButton: 315 if buttons == EricMessageBox.NoButton:
318 buttons = EricMessageBox.Ok 316 buttons = EricMessageBox.Ok
319 317
320 defaultButton = self.buttonsCodeListBinary[ 318 defaultButton = self.buttonsCodeListBinary[self.defaultCombo.currentIndex()]
321 self.defaultCombo.currentIndex()] 319
322
323 if self.rInformation.isChecked(): 320 if self.rInformation.isChecked():
324 EricMessageBox.information( 321 EricMessageBox.information(
325 self, 322 self,
326 self.eCaption.text(), 323 self.eCaption.text(),
327 self.eMessage.toPlainText(), 324 self.eMessage.toPlainText(),
328 buttons, 325 buttons,
329 defaultButton 326 defaultButton,
330 ) 327 )
331 elif self.rQuestion.isChecked(): 328 elif self.rQuestion.isChecked():
332 EricMessageBox.question( 329 EricMessageBox.question(
333 self, 330 self,
334 self.eCaption.text(), 331 self.eCaption.text(),
335 self.eMessage.toPlainText(), 332 self.eMessage.toPlainText(),
336 buttons, 333 buttons,
337 defaultButton 334 defaultButton,
338 ) 335 )
339 elif self.rWarning.isChecked(): 336 elif self.rWarning.isChecked():
340 EricMessageBox.warning( 337 EricMessageBox.warning(
341 self, 338 self,
342 self.eCaption.text(), 339 self.eCaption.text(),
343 self.eMessage.toPlainText(), 340 self.eMessage.toPlainText(),
344 buttons, 341 buttons,
345 defaultButton 342 defaultButton,
346 ) 343 )
347 elif self.rCritical.isChecked(): 344 elif self.rCritical.isChecked():
348 EricMessageBox.critical( 345 EricMessageBox.critical(
349 self, 346 self,
350 self.eCaption.text(), 347 self.eCaption.text(),
351 self.eMessage.toPlainText(), 348 self.eMessage.toPlainText(),
352 buttons, 349 buttons,
353 defaultButton 350 defaultButton,
354 ) 351 )
355 elif ( 352 elif self.rYesNo.isChecked() or self.rRetryAbort.isChecked():
356 self.rYesNo.isChecked() or
357 self.rRetryAbort.isChecked()
358 ):
359 if self.iconInformation.isChecked(): 353 if self.iconInformation.isChecked():
360 icon = EricMessageBox.Information 354 icon = EricMessageBox.Information
361 elif self.iconQuestion.isChecked(): 355 elif self.iconQuestion.isChecked():
362 icon = EricMessageBox.Question 356 icon = EricMessageBox.Question
363 elif self.iconWarning.isChecked(): 357 elif self.iconWarning.isChecked():
364 icon = EricMessageBox.Warning 358 icon = EricMessageBox.Warning
365 elif self.iconCritical.isChecked(): 359 elif self.iconCritical.isChecked():
366 icon = EricMessageBox.Critical 360 icon = EricMessageBox.Critical
367 361
368 if self.rYesNo.isChecked(): 362 if self.rYesNo.isChecked():
369 EricMessageBox.yesNo( 363 EricMessageBox.yesNo(
370 self, 364 self,
371 self.eCaption.text(), 365 self.eCaption.text(),
372 self.eMessage.toPlainText(), 366 self.eMessage.toPlainText(),
373 icon=icon, 367 icon=icon,
374 yesDefault=self.yesDefaultCheck.isChecked() 368 yesDefault=self.yesDefaultCheck.isChecked(),
375 ) 369 )
376 elif self.rRetryAbort.isChecked(): 370 elif self.rRetryAbort.isChecked():
377 EricMessageBox.retryAbort( 371 EricMessageBox.retryAbort(
378 self, 372 self, self.eCaption.text(), self.eMessage.toPlainText(), icon=icon
379 self.eCaption.text(),
380 self.eMessage.toPlainText(),
381 icon=icon
382 ) 373 )
383 elif self.rOkToClearData.isChecked(): 374 elif self.rOkToClearData.isChecked():
384 EricMessageBox.okToClearData( 375 EricMessageBox.okToClearData(
385 self, 376 self, self.eCaption.text(), self.eMessage.toPlainText(), lambda: True
386 self.eCaption.text(),
387 self.eMessage.toPlainText(),
388 lambda: True
389 ) 377 )
390 378
391 def __getStandardButtonCode(self, istring, withIntro=True): 379 def __getStandardButtonCode(self, istring, withIntro=True):
392 """ 380 """
393 Private method to generate the button code for the standard buttons. 381 Private method to generate the button code for the standard buttons.
394 382
395 @param istring indentation string 383 @param istring indentation string
396 @type str 384 @type str
397 @param withIntro flag indicating to generate a first line 385 @param withIntro flag indicating to generate a first line
398 with introductory text 386 with introductory text
399 @type bool 387 @type bool
437 buttons.append("EricMessageBox.Yes") 425 buttons.append("EricMessageBox.Yes")
438 if self.yestoallCheck.isChecked(): 426 if self.yestoallCheck.isChecked():
439 buttons.append("EricMessageBox.YesToAll") 427 buttons.append("EricMessageBox.YesToAll")
440 if len(buttons) == 0: 428 if len(buttons) == 0:
441 return "" 429 return ""
442 430
443 joinstring = ' |{0}{1}'.format(os.linesep, istring) 431 joinstring = " |{0}{1}".format(os.linesep, istring)
444 intro = ',' if withIntro else '' 432 intro = "," if withIntro else ""
445 btnCode = '{0}{1}{2}{3}'.format( 433 btnCode = "{0}{1}{2}{3}".format(
446 intro, os.linesep, istring, joinstring.join(buttons)) 434 intro, os.linesep, istring, joinstring.join(buttons)
447 435 )
436
448 return btnCode 437 return btnCode
449 438
450 def __getDefaultButtonCode(self, istring): 439 def __getDefaultButtonCode(self, istring):
451 """ 440 """
452 Private method to generate the button code for the default button. 441 Private method to generate the button code for the default button.
453 442
454 @param istring indentation string 443 @param istring indentation string
455 @type str 444 @type str
456 @return the button code 445 @return the button code
457 @rtype str 446 @rtype str
458 """ 447 """
459 btnCode = "" 448 btnCode = ""
460 defaultIndex = self.defaultCombo.currentIndex() 449 defaultIndex = self.defaultCombo.currentIndex()
461 if defaultIndex: 450 if defaultIndex:
462 btnCode = ',{0}{1}{2}'.format( 451 btnCode = ",{0}{1}{2}".format(
463 os.linesep, istring, 452 os.linesep, istring, self.buttonsCodeListText[defaultIndex]
464 self.buttonsCodeListText[defaultIndex]) 453 )
465 return btnCode 454 return btnCode
466 455
467 def getCode(self, indLevel, indString): 456 def getCode(self, indLevel, indString):
468 """ 457 """
469 Public method to get the source code. 458 Public method to get the source code.
470 459
471 @param indLevel indentation level 460 @param indLevel indentation level
472 @type int 461 @type int
473 @param indString string used for indentation (space or tab) 462 @param indString string used for indentation (space or tab)
474 @type str 463 @type str
475 @return generated code 464 @return generated code
477 """ 466 """
478 # calculate our indentation level and the indentation string 467 # calculate our indentation level and the indentation string
479 il = indLevel + 1 468 il = indLevel + 1
480 istring = il * indString 469 istring = il * indString
481 estring = os.linesep + indLevel * indString 470 estring = os.linesep + indLevel * indString
482 471
483 # now generate the code 472 # now generate the code
484 if self.parentSelf.isChecked(): 473 if self.parentSelf.isChecked():
485 parent = "self" 474 parent = "self"
486 elif self.parentNone.isChecked(): 475 elif self.parentNone.isChecked():
487 parent = "None" 476 parent = "None"
488 elif self.parentOther.isChecked(): 477 elif self.parentOther.isChecked():
489 parent = self.parentEdit.text() 478 parent = self.parentEdit.text()
490 if parent == "": 479 if parent == "":
491 parent = "None" 480 parent = "None"
492 481
493 if self.iconInformation.isChecked(): 482 if self.iconInformation.isChecked():
494 icon = "EricMessageBox.Information" 483 icon = "EricMessageBox.Information"
495 elif self.iconQuestion.isChecked(): 484 elif self.iconQuestion.isChecked():
496 icon = "EricMessageBox.Question" 485 icon = "EricMessageBox.Question"
497 elif self.iconWarning.isChecked(): 486 elif self.iconWarning.isChecked():
498 icon = "EricMessageBox.Warning" 487 icon = "EricMessageBox.Warning"
499 elif self.iconCritical.isChecked(): 488 elif self.iconCritical.isChecked():
500 icon = "EricMessageBox.Critical" 489 icon = "EricMessageBox.Critical"
501 490
502 if not self.rStandard.isChecked(): 491 if not self.rStandard.isChecked():
503 resvar = self.eResultVar.text() 492 resvar = self.eResultVar.text()
504 if not resvar: 493 if not resvar:
505 resvar = "res" 494 resvar = "res"
506 495
507 if self.rAbout.isChecked(): 496 if self.rAbout.isChecked():
508 msgdlg = "EricMessageBox.about({0}".format(os.linesep) 497 msgdlg = "EricMessageBox.about({0}".format(os.linesep)
509 elif self.rAboutQt.isChecked(): 498 elif self.rAboutQt.isChecked():
510 msgdlg = "EricMessageBox.aboutQt({0}".format(os.linesep) 499 msgdlg = "EricMessageBox.aboutQt({0}".format(os.linesep)
511 elif self.rInformation.isChecked(): 500 elif self.rInformation.isChecked():
512 msgdlg = "{0} = EricMessageBox.information({1}".format( 501 msgdlg = "{0} = EricMessageBox.information({1}".format(
513 resvar, os.linesep) 502 resvar, os.linesep
503 )
514 elif self.rQuestion.isChecked(): 504 elif self.rQuestion.isChecked():
515 msgdlg = "{0} = EricMessageBox.question({1}".format( 505 msgdlg = "{0} = EricMessageBox.question({1}".format(resvar, os.linesep)
516 resvar, os.linesep)
517 elif self.rWarning.isChecked(): 506 elif self.rWarning.isChecked():
518 msgdlg = "{0} = EricMessageBox.warning({1}".format( 507 msgdlg = "{0} = EricMessageBox.warning({1}".format(resvar, os.linesep)
519 resvar, os.linesep)
520 elif self.rCritical.isChecked(): 508 elif self.rCritical.isChecked():
521 msgdlg = "{0} = EricMessageBox.critical({1}".format( 509 msgdlg = "{0} = EricMessageBox.critical({1}".format(resvar, os.linesep)
522 resvar, os.linesep)
523 elif self.rYesNo.isChecked(): 510 elif self.rYesNo.isChecked():
524 msgdlg = "{0} = EricMessageBox.yesNo({1}".format( 511 msgdlg = "{0} = EricMessageBox.yesNo({1}".format(resvar, os.linesep)
525 resvar, os.linesep)
526 elif self.rRetryAbort.isChecked(): 512 elif self.rRetryAbort.isChecked():
527 msgdlg = "{0} = EricMessageBox.retryAbort({1}".format( 513 msgdlg = "{0} = EricMessageBox.retryAbort({1}".format(
528 resvar, os.linesep) 514 resvar, os.linesep
515 )
529 elif self.rOkToClearData.isChecked(): 516 elif self.rOkToClearData.isChecked():
530 msgdlg = "{0} = EricMessageBox.okToClearData({1}".format( 517 msgdlg = "{0} = EricMessageBox.okToClearData({1}".format(
531 resvar, os.linesep) 518 resvar, os.linesep
532 519 )
533 msgdlg += '{0}{1},{2}'.format(istring, parent, os.linesep) 520
534 msgdlg += '{0}self.tr("{1}")'.format( 521 msgdlg += "{0}{1},{2}".format(istring, parent, os.linesep)
535 istring, self.eCaption.text()) 522 msgdlg += '{0}self.tr("{1}")'.format(istring, self.eCaption.text())
536 523
537 if not self.rAboutQt.isChecked(): 524 if not self.rAboutQt.isChecked():
538 msgdlg += ',{0}{1}self.tr("""{2}""")'.format( 525 msgdlg += ',{0}{1}self.tr("""{2}""")'.format(
539 os.linesep, istring, self.eMessage.toPlainText()) 526 os.linesep, istring, self.eMessage.toPlainText()
540 527 )
528
541 if ( 529 if (
542 self.rInformation.isChecked() or 530 self.rInformation.isChecked()
543 self.rQuestion.isChecked() or 531 or self.rQuestion.isChecked()
544 self.rWarning.isChecked() or 532 or self.rWarning.isChecked()
545 self.rCritical.isChecked() 533 or self.rCritical.isChecked()
546 ): 534 ):
547 msgdlg += self.__getStandardButtonCode(istring) 535 msgdlg += self.__getStandardButtonCode(istring)
548 msgdlg += self.__getDefaultButtonCode(istring) 536 msgdlg += self.__getDefaultButtonCode(istring)
549 elif self.rYesNo.isChecked(): 537 elif self.rYesNo.isChecked():
550 if not self.iconQuestion.isChecked(): 538 if not self.iconQuestion.isChecked():
551 msgdlg += ',{0}{1}icon={2}'.format( 539 msgdlg += ",{0}{1}icon={2}".format(os.linesep, istring, icon)
552 os.linesep, istring, icon)
553 if self.yesDefaultCheck.isChecked(): 540 if self.yesDefaultCheck.isChecked():
554 msgdlg += ',{0}{1}yesDefault=True'.format( 541 msgdlg += ",{0}{1}yesDefault=True".format(os.linesep, istring)
555 os.linesep, istring)
556 elif self.rRetryAbort.isChecked(): 542 elif self.rRetryAbort.isChecked():
557 if not self.iconQuestion.isChecked(): 543 if not self.iconQuestion.isChecked():
558 msgdlg += ',{0}{1}icon={2}'.format( 544 msgdlg += ",{0}{1}icon={2}".format(os.linesep, istring, icon)
559 os.linesep, istring, icon)
560 elif self.rOkToClearData.isChecked(): 545 elif self.rOkToClearData.isChecked():
561 saveFunc = self.saveFuncEdit.text() 546 saveFunc = self.saveFuncEdit.text()
562 if saveFunc == "": 547 if saveFunc == "":
563 saveFunc = "lambda: True" 548 saveFunc = "lambda: True"
564 msgdlg += ',{0}{1}{2}'.format(os.linesep, istring, saveFunc) 549 msgdlg += ",{0}{1}{2}".format(os.linesep, istring, saveFunc)
565 else: 550 else:
566 resvar = self.eResultVar.text() 551 resvar = self.eResultVar.text()
567 if not resvar: 552 if not resvar:
568 resvar = "dlg" 553 resvar = "dlg"
569 554
570 msgdlg = "{0} = EricMessageBox.EricMessageBox({1}".format( 555 msgdlg = "{0} = EricMessageBox.EricMessageBox({1}".format(
571 resvar, os.linesep) 556 resvar, os.linesep
572 msgdlg += '{0}{1},{2}'.format(istring, icon, os.linesep) 557 )
573 msgdlg += '{0}self.tr("{1}")'.format( 558 msgdlg += "{0}{1},{2}".format(istring, icon, os.linesep)
574 istring, self.eCaption.text()) 559 msgdlg += '{0}self.tr("{1}")'.format(istring, self.eCaption.text())
575 msgdlg += ',{0}{1}self.tr("""{2}""")'.format( 560 msgdlg += ',{0}{1}self.tr("""{2}""")'.format(
576 os.linesep, istring, self.eMessage.toPlainText()) 561 os.linesep, istring, self.eMessage.toPlainText()
562 )
577 if self.modalCheck.isChecked(): 563 if self.modalCheck.isChecked():
578 msgdlg += ',{0}{1}modal=True'.format(os.linesep, istring) 564 msgdlg += ",{0}{1}modal=True".format(os.linesep, istring)
579 btnCode = self.__getStandardButtonCode( 565 btnCode = self.__getStandardButtonCode(istring, withIntro=False)
580 istring, withIntro=False)
581 if btnCode: 566 if btnCode:
582 msgdlg += ',{0}{1}buttons={2}'.format( 567 msgdlg += ",{0}{1}buttons={2}".format(os.linesep, istring, btnCode)
583 os.linesep, istring, btnCode)
584 if not self.parentNone.isChecked(): 568 if not self.parentNone.isChecked():
585 msgdlg += ',{0}{1}parent={2}'.format( 569 msgdlg += ",{0}{1}parent={2}".format(os.linesep, istring, parent)
586 os.linesep, istring, parent) 570
587 571 msgdlg += "{0}){0}".format(estring)
588 msgdlg += '{0}){0}'.format(estring)
589 return msgdlg 572 return msgdlg

eric ide

mercurial