Plugins/WizardPlugins/E5MessageBoxWizard/E5MessageBoxWizardDialog.py

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

eric ide

mercurial