198 QMessageBox.aboutQt(None, |
198 QMessageBox.aboutQt(None, |
199 self.eCaption.text() |
199 self.eCaption.text() |
200 ) |
200 ) |
201 else: |
201 else: |
202 self.__testQt42() |
202 self.__testQt42() |
203 |
203 |
204 def __enabledGroups(self): |
204 def __enabledGroups(self): |
205 """ |
205 """ |
206 Private method to enable/disable some group boxes. |
206 Private method to enable/disable some group boxes. |
207 """ |
207 """ |
208 self.standardButtons.setEnabled(not self.rAbout.isChecked() and \ |
208 self.standardButtons.setEnabled(not self.rAbout.isChecked() and \ |
209 not self.rAboutQt.isChecked() |
209 not self.rAboutQt.isChecked() |
210 ) |
210 ) |
|
211 |
|
212 self.eMessage.setEnabled(not self.rAboutQt.isChecked()) |
211 |
213 |
212 def on_rAbout_toggled(self, on): |
214 def on_rAbout_toggled(self, on): |
213 """ |
215 """ |
214 Private slot to handle the toggled signal of the rAbout radio button. |
216 Private slot to handle the toggled signal of the rAbout radio button. |
215 |
217 |
223 |
225 |
224 @param on toggle state (boolean) (ignored) |
226 @param on toggle state (boolean) (ignored) |
225 """ |
227 """ |
226 self.__enabledGroups() |
228 self.__enabledGroups() |
227 |
229 |
228 def __getQt42ButtonCode(self, istring, indString): |
230 def __getButtonCode(self, istring, indString): |
229 """ |
231 """ |
230 Private method to generate the button code for Qt 4.2.0. |
232 Private method to generate the button code. |
231 |
233 |
232 @param istring indentation string (string) |
234 @param istring indentation string (string) |
233 @param indString string used for indentation (space or tab) (string) |
235 @param indString string used for indentation (space or tab) (string) |
234 @return the button code (string) |
236 @return the button code (string) |
235 """ |
237 """ |
273 if len(buttons) == 0: |
275 if len(buttons) == 0: |
274 return "" |
276 return "" |
275 |
277 |
276 istring2 = istring + indString |
278 istring2 = istring + indString |
277 joinstring = ' | \\{0}{1}'.format(os.linesep, istring2) |
279 joinstring = ' | \\{0}{1}'.format(os.linesep, istring2) |
278 btnCode = ',{0}{1}QMessageBox.StandardButtons(\\'.format(os.linesep, istring) |
280 btnCode = ',{0}{1}QMessageBox.StandardButtons('.format(os.linesep, istring) |
279 btnCode += '{0}{1}{2})'.format(os.linesep, istring2, joinstring.join(buttons)) |
281 btnCode += '{0}{1}{2})'.format(os.linesep, istring2, joinstring.join(buttons)) |
280 defaultIndex = self.defaultCombo.currentIndex() |
282 defaultIndex = self.defaultCombo.currentIndex() |
281 if defaultIndex: |
283 if defaultIndex: |
282 btnCode += ',{0}{1}{2}'.format(os.linesep, istring, |
284 btnCode += ',{0}{1}{2}'.format(os.linesep, istring, |
283 self.buttonsCodeListText[defaultIndex]) |
285 self.buttonsCodeListText[defaultIndex]) |
295 il = indLevel + 1 |
297 il = indLevel + 1 |
296 istring = il * indString |
298 istring = il * indString |
297 estring = os.linesep + indLevel * indString |
299 estring = os.linesep + indLevel * indString |
298 |
300 |
299 # now generate the code |
301 # now generate the code |
300 msgdlg = 'QMessageBox.' |
302 if self.parentSelf.isChecked(): |
|
303 parent = "self" |
|
304 elif self.parentNone.isChecked(): |
|
305 parent = "None" |
|
306 elif self.parentOther.isChecked(): |
|
307 parent = self.parentEdit.text() |
|
308 if parent == "": |
|
309 parent = "None" |
|
310 |
301 if self.rAbout.isChecked(): |
311 if self.rAbout.isChecked(): |
302 msgdlg += "about(None,{0}".format(os.linesep) |
312 msgdlg = "QMessageBox.about({0},{1}".format(parent, os.linesep) |
303 elif self.rAboutQt.isChecked(): |
313 elif self.rAboutQt.isChecked(): |
304 msgdlg += "aboutQt(None,{0}".format(os.linesep) |
314 msgdlg = "QMessageBox.aboutQt({0},{1}".format(parent, os.linesep) |
305 elif self.rInformation.isChecked(): |
315 elif self.rInformation.isChecked(): |
306 msgdlg += "information(None,{0}".format(os.linesep) |
316 msgdlg = "res = QMessageBox.information({0},{1}".format(parent, os.linesep) |
307 elif self.rQuestion.isChecked(): |
317 elif self.rQuestion.isChecked(): |
308 msgdlg += "question(None,{0}".format(os.linesep) |
318 msgdlg = "res = QMessageBox.question({0},{1}".format(parent, os.linesep) |
309 elif self.rWarning.isChecked(): |
319 elif self.rWarning.isChecked(): |
310 msgdlg += "warning(None,{0}".format(os.linesep) |
320 msgdlg = "res = QMessageBox.warning({0},{1}".format(parent, os.linesep) |
311 else: |
321 else: |
312 msgdlg +="critical(None,{0}".format(os.linesep) |
322 msgdlg ="res = QMessageBox.critical({0},{1}".format(parent, os.linesep) |
|
323 |
313 msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text()) |
324 msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text()) |
314 if not self.rAboutQt.isChecked(): |
325 if not self.rAboutQt.isChecked(): |
315 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format( |
326 msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format( |
316 os.linesep, istring, self.eMessage.toPlainText()) |
327 os.linesep, istring, self.eMessage.toPlainText()) |
317 if not self.rAbout.isChecked() and not self.rAboutQt.isChecked(): |
328 if not self.rAbout.isChecked() and not self.rAboutQt.isChecked(): |
318 msgdlg += self.__getQt42ButtonCode(istring, indString) |
329 msgdlg += self.__getButtonCode(istring, indString) |
319 msgdlg +='){0}'.format(estring) |
330 msgdlg +='){0}'.format(estring) |
320 return msgdlg |
331 return msgdlg |