Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py

branch
Py2 comp.
changeset 3142
55030c09e142
parent 3056
9986ec0e559a
parent 3124
a01e410893ac
child 3145
a9de05d4a22f
equal deleted inserted replaced
3141:72f3bde98c58 3142:55030c09e142
213 213
214 def __enabledGroups(self): 214 def __enabledGroups(self):
215 """ 215 """
216 Private method to enable/disable some group boxes. 216 Private method to enable/disable some group boxes.
217 """ 217 """
218 self.standardButtons.setEnabled(not self.rAbout.isChecked() and 218 enable = not self.rAbout.isChecked() and not self.rAboutQt.isChecked()
219 not self.rAboutQt.isChecked() 219 self.standardButtons.setEnabled(enable)
220 ) 220 self.lResultVar.setEnabled(enable)
221 self.eResultVar.setEnabled(enable)
221 222
222 self.eMessage.setEnabled(not self.rAboutQt.isChecked()) 223 self.eMessage.setEnabled(not self.rAboutQt.isChecked())
223 224
224 def on_rAbout_toggled(self, on): 225 def on_rAbout_toggled(self, on):
225 """ 226 """
284 buttons.append("QMessageBox.YesToAll") 285 buttons.append("QMessageBox.YesToAll")
285 if len(buttons) == 0: 286 if len(buttons) == 0:
286 return "" 287 return ""
287 288
288 istring2 = istring + indString 289 istring2 = istring + indString
289 joinstring = ' | \\{0}{1}'.format(os.linesep, istring2) 290 joinstring = ' |{0}{1}'.format(os.linesep, istring2)
290 btnCode = ',{0}{1}QMessageBox.StandardButtons('.format( 291 btnCode = ',{0}{1}QMessageBox.StandardButtons('.format(
291 os.linesep, istring) 292 os.linesep, istring)
292 btnCode += '{0}{1}{2})'.format( 293 btnCode += '{0}{1}{2})'.format(
293 os.linesep, istring2, joinstring.join(buttons)) 294 os.linesep, istring2, joinstring.join(buttons))
294 defaultIndex = self.defaultCombo.currentIndex() 295 defaultIndex = self.defaultCombo.currentIndex()
319 elif self.parentOther.isChecked(): 320 elif self.parentOther.isChecked():
320 parent = self.parentEdit.text() 321 parent = self.parentEdit.text()
321 if parent == "": 322 if parent == "":
322 parent = "None" 323 parent = "None"
323 324
325 resvar = self.eResultVar.text()
326 if not resvar:
327 resvar = "res"
328
324 if self.rAbout.isChecked(): 329 if self.rAbout.isChecked():
325 msgdlg = "QMessageBox.about({0}".format(os.linesep) 330 msgdlg = "QMessageBox.about("
326 elif self.rAboutQt.isChecked(): 331 elif self.rAboutQt.isChecked():
327 msgdlg = "QMessageBox.aboutQt({0}".format(os.linesep) 332 msgdlg = "QMessageBox.aboutQt("
328 elif self.rInformation.isChecked(): 333 elif self.rInformation.isChecked():
329 msgdlg = "res = QMessageBox.information({0}".format(os.linesep) 334 msgdlg = "{0} = QMessageBox.information(".format(resvar)
330 elif self.rQuestion.isChecked(): 335 elif self.rQuestion.isChecked():
331 msgdlg = "res = QMessageBox.question({0}".format(os.linesep) 336 msgdlg = "{0} = QMessageBox.question(".format(resvar)
332 elif self.rWarning.isChecked(): 337 elif self.rWarning.isChecked():
333 msgdlg = "res = QMessageBox.warning({0}".format(os.linesep) 338 msgdlg = "{0} = QMessageBox.warning(".format(resvar)
334 else: 339 else:
335 msgdlg = "res = QMessageBox.critical({0}".format(os.linesep) 340 msgdlg = "{0} = QMessageBox.critical(".format(resvar)
336 341
337 msgdlg += '{0}{1}{2}'.format(istring, parent, os.linesep) 342 if self.rAboutQt.isChecked():
338 msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text()) 343 if self.eCaption.text():
339 if not self.rAboutQt.isChecked(): 344 msgdlg += '{0}{1}{2}'.format(os.linesep, istring, parent)
345 msgdlg += ',{0}{1}self.trUtf8("{2}")'.format(
346 os.linesep, istring, self.eCaption.text())
347 else:
348 msgdlg += parent
349 else:
350 msgdlg += '{0}{1}{2}'.format(os.linesep, istring, parent)
351 msgdlg += ',{0}{1}self.trUtf8("{2}")'.format(
352 os.linesep, istring, self.eCaption.text())
340 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format( 353 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format(
341 os.linesep, istring, self.eMessage.toPlainText()) 354 os.linesep, istring, self.eMessage.toPlainText())
342 if not self.rAbout.isChecked() and not self.rAboutQt.isChecked(): 355 if not self.rAbout.isChecked() and not self.rAboutQt.isChecked():
343 msgdlg += self.__getButtonCode(istring, indString) 356 msgdlg += self.__getButtonCode(istring, indString)
344 msgdlg += '){0}'.format(estring) 357 msgdlg += '){0}'.format(estring)
345 return msgdlg 358 return msgdlg

eric ide

mercurial