Plugins/WizardPlugins/E5MessageBoxWizard/E5MessageBoxWizardDialog.py

changeset 2893
150de635fa29
parent 2342
2a56a27a4021
child 2964
84b65fb9e780
child 3056
9986ec0e559a
equal deleted inserted replaced
2892:b601ede6dbbf 2893:150de635fa29
95 "E5MessageBox.YesToAll", 95 "E5MessageBox.YesToAll",
96 ] 96 ]
97 97
98 self.defaultCombo.addItems(self.buttonsList) 98 self.defaultCombo.addItems(self.buttonsList)
99 99
100 self.bTest = \ 100 self.bTest = self.buttonBox.addButton(
101 self.buttonBox.addButton(self.trUtf8("Test"), QDialogButtonBox.ActionRole) 101 self.trUtf8("Test"), QDialogButtonBox.ActionRole)
102 102
103 self.__enabledGroups() 103 self.__enabledGroups()
104 104
105 def __enabledGroups(self): 105 def __enabledGroups(self):
106 """ 106 """
132 self.eMessage.setEnabled(not self.rAboutQt.isChecked()) 132 self.eMessage.setEnabled(not self.rAboutQt.isChecked())
133 133
134 @pyqtSlot(bool) 134 @pyqtSlot(bool)
135 def on_rInformation_toggled(self, checked): 135 def on_rInformation_toggled(self, checked):
136 """ 136 """
137 Private slot to handle the toggled signal of the rInformation radio button. 137 Private slot to handle the toggled signal of the rInformation
138 radio button.
138 139
139 @param on toggle state (boolean) (ignored) 140 @param on toggle state (boolean) (ignored)
140 """ 141 """
141 self.__enabledGroups() 142 self.__enabledGroups()
142 143
143 @pyqtSlot(bool) 144 @pyqtSlot(bool)
144 def on_rQuestion_toggled(self, checked): 145 def on_rQuestion_toggled(self, checked):
145 """ 146 """
146 Private slot to handle the toggled signal of the rQuestion radio button. 147 Private slot to handle the toggled signal of the rQuestion
148 radio button.
147 149
148 @param on toggle state (boolean) (ignored) 150 @param on toggle state (boolean) (ignored)
149 """ 151 """
150 self.__enabledGroups() 152 self.__enabledGroups()
151 153
152 @pyqtSlot(bool) 154 @pyqtSlot(bool)
153 def on_rWarning_toggled(self, checked): 155 def on_rWarning_toggled(self, checked):
154 """ 156 """
155 Private slot to handle the toggled signal of the rWarning radio button. 157 Private slot to handle the toggled signal of the rWarning
158 radio button.
156 159
157 @param on toggle state (boolean) (ignored) 160 @param on toggle state (boolean) (ignored)
158 """ 161 """
159 self.__enabledGroups() 162 self.__enabledGroups()
160 163
161 @pyqtSlot(bool) 164 @pyqtSlot(bool)
162 def on_rCritical_toggled(self, checked): 165 def on_rCritical_toggled(self, checked):
163 """ 166 """
164 Private slot to handle the toggled signal of the rCritical radio button. 167 Private slot to handle the toggled signal of the rCritical
168 radio button.
165 169
166 @param on toggle state (boolean) (ignored) 170 @param on toggle state (boolean) (ignored)
167 """ 171 """
168 self.__enabledGroups() 172 self.__enabledGroups()
169 173
170 @pyqtSlot(bool) 174 @pyqtSlot(bool)
171 def on_rYesNo_toggled(self, checked): 175 def on_rYesNo_toggled(self, checked):
172 """ 176 """
173 Private slot to handle the toggled signal of the rYesNo radio button. 177 Private slot to handle the toggled signal of the rYesNo
178 radio button.
174 179
175 @param on toggle state (boolean) (ignored) 180 @param on toggle state (boolean) (ignored)
176 """ 181 """
177 self.__enabledGroups() 182 self.__enabledGroups()
178 183
179 @pyqtSlot(bool) 184 @pyqtSlot(bool)
180 def on_rRetryAbort_toggled(self, checked): 185 def on_rRetryAbort_toggled(self, checked):
181 """ 186 """
182 Private slot to handle the toggled signal of the rRetryAbort radio button. 187 Private slot to handle the toggled signal of the rRetryAbort
188 radio button.
183 189
184 @param on toggle state (boolean) (ignored) 190 @param on toggle state (boolean) (ignored)
185 """ 191 """
186 self.__enabledGroups() 192 self.__enabledGroups()
187 193
188 @pyqtSlot(bool) 194 @pyqtSlot(bool)
189 def on_rOkToClearData_toggled(self, checked): 195 def on_rOkToClearData_toggled(self, checked):
190 """ 196 """
191 Private slot to handle the toggled signal of the rOkToClearData radio button. 197 Private slot to handle the toggled signal of the rOkToClearData
198 radio button.
192 199
193 @param on toggle state (boolean) (ignored) 200 @param on toggle state (boolean) (ignored)
194 """ 201 """
195 self.__enabledGroups() 202 self.__enabledGroups()
196 203
197 @pyqtSlot(bool) 204 @pyqtSlot(bool)
198 def on_rAbout_toggled(self, checked): 205 def on_rAbout_toggled(self, checked):
199 """ 206 """
200 Private slot to handle the toggled signal of the rAbout radio button. 207 Private slot to handle the toggled signal of the rAbout
208 radio button.
201 209
202 @param on toggle state (boolean) (ignored) 210 @param on toggle state (boolean) (ignored)
203 """ 211 """
204 self.__enabledGroups() 212 self.__enabledGroups()
205 213
206 @pyqtSlot(bool) 214 @pyqtSlot(bool)
207 def on_rAboutQt_toggled(self, checked): 215 def on_rAboutQt_toggled(self, checked):
208 """ 216 """
209 Private slot to handle the toggled signal of the rAboutQt radio button. 217 Private slot to handle the toggled signal of the rAboutQt
218 radio button.
210 219
211 @param on toggle state (boolean) (ignored) 220 @param on toggle state (boolean) (ignored)
212 """ 221 """
213 self.__enabledGroups() 222 self.__enabledGroups()
214 223
215 @pyqtSlot(bool) 224 @pyqtSlot(bool)
216 def on_rStandard_toggled(self, checked): 225 def on_rStandard_toggled(self, checked):
217 """ 226 """
218 Private slot to handle the toggled signal of the rStandard radio button. 227 Private slot to handle the toggled signal of the rStandard
228 radio button.
219 229
220 @param on toggle state (boolean) (ignored) 230 @param on toggle state (boolean) (ignored)
221 """ 231 """
222 self.__enabledGroups() 232 self.__enabledGroups()
223 233
287 if self.yestoallCheck.isChecked(): 297 if self.yestoallCheck.isChecked():
288 buttons |= E5MessageBox.YesToAll 298 buttons |= E5MessageBox.YesToAll
289 if buttons == E5MessageBox.NoButton: 299 if buttons == E5MessageBox.NoButton:
290 buttons = E5MessageBox.Ok 300 buttons = E5MessageBox.Ok
291 301
292 defaultButton = self.buttonsCodeListBinary[self.defaultCombo.currentIndex()] 302 defaultButton = self.buttonsCodeListBinary[
303 self.defaultCombo.currentIndex()]
293 304
294 if self.rInformation.isChecked(): 305 if self.rInformation.isChecked():
295 E5MessageBox.information(self, 306 E5MessageBox.information(self,
296 self.eCaption.text(), 307 self.eCaption.text(),
297 self.eMessage.toPlainText(), 308 self.eMessage.toPlainText(),
401 return "" 412 return ""
402 413
403 istring2 = istring + indString 414 istring2 = istring + indString
404 joinstring = ' | \\{0}{1}'.format(os.linesep, istring2) 415 joinstring = ' | \\{0}{1}'.format(os.linesep, istring2)
405 if withIntro: 416 if withIntro:
406 btnCode = ',{0}{1}E5MessageBox.StandardButtons('.format(os.linesep, istring) 417 btnCode = ',{0}{1}E5MessageBox.StandardButtons('.format(
418 os.linesep, istring)
407 else: 419 else:
408 btnCode = 'E5MessageBox.StandardButtons('.format(os.linesep, istring) 420 btnCode = 'E5MessageBox.StandardButtons('.format(
409 btnCode += '{0}{1}{2})'.format(os.linesep, istring2, joinstring.join(buttons)) 421 os.linesep, istring)
422 btnCode += '{0}{1}{2})'.format(
423 os.linesep, istring2, joinstring.join(buttons))
410 424
411 return btnCode 425 return btnCode
412 426
413 def __getDefaultButtonCode(self, istring): 427 def __getDefaultButtonCode(self, istring):
414 """ 428 """
457 elif self.iconCritical.isChecked(): 471 elif self.iconCritical.isChecked():
458 icon = "E5MessageBox.Critical" 472 icon = "E5MessageBox.Critical"
459 473
460 if not self.rStandard.isChecked(): 474 if not self.rStandard.isChecked():
461 if self.rAbout.isChecked(): 475 if self.rAbout.isChecked():
462 msgdlg = "E5MessageBox.about({0},{1}".format(parent, os.linesep) 476 msgdlg = "E5MessageBox.about({0}".format(os.linesep)
463 elif self.rAboutQt.isChecked(): 477 elif self.rAboutQt.isChecked():
464 msgdlg = "E5MessageBox.aboutQt({0},{1}".format(parent, os.linesep) 478 msgdlg = "E5MessageBox.aboutQt({0}".format(os.linesep)
465 elif self.rInformation.isChecked(): 479 elif self.rInformation.isChecked():
466 msgdlg = "res = E5MessageBox.information({0},{1}".format( 480 msgdlg = "res = E5MessageBox.information({0}".format(
467 parent, os.linesep) 481 os.linesep)
468 elif self.rQuestion.isChecked(): 482 elif self.rQuestion.isChecked():
469 msgdlg = "res = E5MessageBox.question({0},{1}".format(parent, os.linesep) 483 msgdlg = "res = E5MessageBox.question({0}".format(os.linesep)
470 elif self.rWarning.isChecked(): 484 elif self.rWarning.isChecked():
471 msgdlg = "res = E5MessageBox.warning({0},{1}".format(parent, os.linesep) 485 msgdlg = "res = E5MessageBox.warning({0}".format(os.linesep)
472 elif self.rCritical.isChecked(): 486 elif self.rCritical.isChecked():
473 msgdlg = "res = E5MessageBox.critical({0},{1}".format(parent, os.linesep) 487 msgdlg = "res = E5MessageBox.critical({0}".format(os.linesep)
474 elif self.rYesNo.isChecked(): 488 elif self.rYesNo.isChecked():
475 msgdlg = "res = E5MessageBox.yesNo({0},{1}".format(parent, os.linesep) 489 msgdlg = "res = E5MessageBox.yesNo({0}".format(os.linesep)
476 elif self.rRetryAbort.isChecked(): 490 elif self.rRetryAbort.isChecked():
477 msgdlg = "res = E5MessageBox.retryAbort({0},{1}".format(parent, os.linesep) 491 msgdlg = "res = E5MessageBox.retryAbort({0}".format(os.linesep)
478 elif self.rOkToClearData.isChecked(): 492 elif self.rOkToClearData.isChecked():
479 msgdlg = "res = E5MessageBox.okToClearData({0},{1}".format( 493 msgdlg = "res = E5MessageBox.okToClearData({0}".format(
480 parent, os.linesep) 494 os.linesep)
481 495
482 msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text()) 496 msgdlg += '{0}{1}{2}'.format(istring, parent, os.linesep)
497 msgdlg += '{0}self.trUtf8("{1}")'.format(
498 istring, self.eCaption.text())
483 499
484 if not self.rAboutQt.isChecked(): 500 if not self.rAboutQt.isChecked():
485 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format( 501 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format(
486 os.linesep, istring, self.eMessage.toPlainText()) 502 os.linesep, istring, self.eMessage.toPlainText())
487 503
491 self.rCritical.isChecked(): 507 self.rCritical.isChecked():
492 msgdlg += self.__getStandardButtonCode(istring, indString) 508 msgdlg += self.__getStandardButtonCode(istring, indString)
493 msgdlg += self.__getDefaultButtonCode(istring) 509 msgdlg += self.__getDefaultButtonCode(istring)
494 elif self.rYesNo.isChecked(): 510 elif self.rYesNo.isChecked():
495 if not self.iconQuestion.isChecked(): 511 if not self.iconQuestion.isChecked():
496 msgdlg += ',{0}{1}icon={2}'.format(os.linesep, istring, icon) 512 msgdlg += ',{0}{1}icon={2}'.format(
513 os.linesep, istring, icon)
497 if self.yesDefaultCheck.isChecked(): 514 if self.yesDefaultCheck.isChecked():
498 msgdlg += ',{0}{1}yesDefault=True'.format(os.linesep, istring) 515 msgdlg += ',{0}{1}yesDefault=True'.format(
516 os.linesep, istring)
499 elif self.rRetryAbort.isChecked(): 517 elif self.rRetryAbort.isChecked():
500 if not self.iconQuestion.isChecked(): 518 if not self.iconQuestion.isChecked():
501 msgdlg += ',{0}{1}icon={2}'.format(os.linesep, istring, icon) 519 msgdlg += ',{0}{1}icon={2}'.format(
520 os.linesep, istring, icon)
502 elif self.rOkToClearData.isChecked(): 521 elif self.rOkToClearData.isChecked():
503 saveFunc = self.saveFuncEdit.text() 522 saveFunc = self.saveFuncEdit.text()
504 if saveFunc == "": 523 if saveFunc == "":
505 saveFunc = "lambda: True" 524 saveFunc = "lambda: True"
506 msgdlg += ',{0}{1}{2}'.format(os.linesep, istring, saveFunc) 525 msgdlg += ',{0}{1}{2}'.format(os.linesep, istring, saveFunc)
507 else: 526 else:
508 msgdlg = "E5MessageBox.E5MessageBox({0}, {1}".format(icon, os.linesep) 527 msgdlg = "E5MessageBox.E5MessageBox({0}".format(os.linesep)
509 msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text()) 528 msgdlg += '{0}{1}{2}'.format(istring, icon, os.linesep)
529 msgdlg += '{0}self.trUtf8("{1}")'.format(
530 istring, self.eCaption.text())
510 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format( 531 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format(
511 os.linesep, istring, self.eMessage.toPlainText()) 532 os.linesep, istring, self.eMessage.toPlainText())
512 if self.modalCheck.isChecked(): 533 if self.modalCheck.isChecked():
513 msgdlg += ',{0}{1}modal=True'.format(os.linesep, istring) 534 msgdlg += ',{0}{1}modal=True'.format(os.linesep, istring)
514 btnCode = self.__getStandardButtonCode(istring, indString, withIntro=False) 535 btnCode = self.__getStandardButtonCode(
536 istring, indString, withIntro=False)
515 if btnCode: 537 if btnCode:
516 msgdlg += ',{0}{1}buttons={2}'.format(os.linesep, istring, btnCode) 538 msgdlg += ',{0}{1}buttons={2}'.format(
539 os.linesep, istring, btnCode)
517 if not self.parentNone.isChecked(): 540 if not self.parentNone.isChecked():
518 msgdlg += ',{0}{1}parent={2}'.format(os.linesep, istring, parent) 541 msgdlg += ',{0}{1}parent={2}'.format(
542 os.linesep, istring, parent)
519 543
520 msgdlg += '){0}'.format(estring) 544 msgdlg += '){0}'.format(estring)
521 return msgdlg 545 return msgdlg

eric ide

mercurial