Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py

branch
Py2 comp.
changeset 3142
55030c09e142
parent 3056
9986ec0e559a
parent 3124
a01e410893ac
child 3145
a9de05d4a22f
--- a/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py	Fri Dec 13 22:45:47 2013 +0100
+++ b/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py	Fri Dec 13 23:39:14 2013 +0100
@@ -215,9 +215,10 @@
         """
         Private method to enable/disable some group boxes.
         """
-        self.standardButtons.setEnabled(not self.rAbout.isChecked() and
-                                        not self.rAboutQt.isChecked()
-                                        )
+        enable = not self.rAbout.isChecked() and not self.rAboutQt.isChecked()
+        self.standardButtons.setEnabled(enable)
+        self.lResultVar.setEnabled(enable)
+        self.eResultVar.setEnabled(enable)
         
         self.eMessage.setEnabled(not self.rAboutQt.isChecked())
     
@@ -286,7 +287,7 @@
             return ""
         
         istring2 = istring + indString
-        joinstring = ' | \\{0}{1}'.format(os.linesep, istring2)
+        joinstring = ' |{0}{1}'.format(os.linesep, istring2)
         btnCode = ',{0}{1}QMessageBox.StandardButtons('.format(
             os.linesep, istring)
         btnCode += '{0}{1}{2})'.format(
@@ -321,25 +322,37 @@
             if parent == "":
                 parent = "None"
         
+        resvar = self.eResultVar.text()
+        if not resvar:
+            resvar = "res"
+        
         if self.rAbout.isChecked():
-            msgdlg = "QMessageBox.about({0}".format(os.linesep)
+            msgdlg = "QMessageBox.about("
         elif self.rAboutQt.isChecked():
-            msgdlg = "QMessageBox.aboutQt({0}".format(os.linesep)
+            msgdlg = "QMessageBox.aboutQt("
         elif self.rInformation.isChecked():
-            msgdlg = "res = QMessageBox.information({0}".format(os.linesep)
+            msgdlg = "{0} = QMessageBox.information(".format(resvar)
         elif self.rQuestion.isChecked():
-            msgdlg = "res = QMessageBox.question({0}".format(os.linesep)
+            msgdlg = "{0} = QMessageBox.question(".format(resvar)
         elif self.rWarning.isChecked():
-            msgdlg = "res = QMessageBox.warning({0}".format(os.linesep)
+            msgdlg = "{0} = QMessageBox.warning(".format(resvar)
         else:
-            msgdlg = "res = QMessageBox.critical({0}".format(os.linesep)
+            msgdlg = "{0} = QMessageBox.critical(".format(resvar)
         
-        msgdlg += '{0}{1}{2}'.format(istring, parent, os.linesep)
-        msgdlg += '{0}self.trUtf8("{1}")'.format(istring, self.eCaption.text())
-        if not self.rAboutQt.isChecked():
+        if self.rAboutQt.isChecked():
+            if self.eCaption.text():
+                msgdlg += '{0}{1}{2}'.format(os.linesep, istring, parent)
+                msgdlg += ',{0}{1}self.trUtf8("{2}")'.format(
+                    os.linesep, istring, self.eCaption.text())
+            else:
+                msgdlg += parent
+        else:
+            msgdlg += '{0}{1}{2}'.format(os.linesep, istring, parent)
+            msgdlg += ',{0}{1}self.trUtf8("{2}")'.format(
+                os.linesep, istring, self.eCaption.text())
             msgdlg += ',{0}{1}self.trUtf8("""{2}""")'.format(
                 os.linesep, istring, self.eMessage.toPlainText())
-        if not self.rAbout.isChecked() and not self.rAboutQt.isChecked():
-            msgdlg += self.__getButtonCode(istring, indString)
+            if not self.rAbout.isChecked() and not self.rAboutQt.isChecked():
+                msgdlg += self.__getButtonCode(istring, indString)
         msgdlg += '){0}'.format(estring)
         return msgdlg

eric ide

mercurial