Changed the QColorDialog wizard to generate PEP-8 compliant code.

Sat, 30 Nov 2013 16:33:11 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 30 Nov 2013 16:33:11 +0100
changeset 3118
b1278ba1d7fe
parent 3117
449af5479f49
child 3119
8b19074bb239

Changed the QColorDialog wizard to generate PEP-8 compliant code.

Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py	Fri Nov 29 19:50:08 2013 +0100
+++ b/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py	Sat Nov 30 16:33:11 2013 +0100
@@ -124,27 +124,32 @@
         # now generate the code
         code = 'QColorDialog.'
         if self.rColor.isChecked():
-            code += 'getColor('
+            code += 'getColor({0}'.format(os.linesep)
             if self.eColor.currentText():
                 col = self.eColor.currentText()
                 if col.startswith('#'):
-                    code += 'QColor("{0}")'.format(col)
+                    code += '{0}QColor("{1}"),{2}'.format(
+                        istring, col, os.linesep)
                 else:
-                    code += 'QColor({0})'.format(col)
-            code += ', None,{0}'.format(os.linesep)
+                    code += '{0}QColor({1}),{2}'.format(
+                        istring, col, os.linesep)
+            else:
+                code += '{0}QColor(Qt.white),{1}'.format(istring, os.linesep)
+            code += '{0}None,{1}'.format(istring, os.linesep)
             code += '{0}self.trUtf8("{1}"),{2}'.format(
                 istring, self.eTitle.text(), os.linesep)
             code += '{0}QColorDialog.ColorDialogOptions(' \
                 'QColorDialog.ShowAlphaChannel)'.format(istring)
             code += '){0}'.format(estring)
         elif self.rRGBA.isChecked():
-            code += 'getColor('
+            code += 'getColor({0}'.format(os.linesep)
             if not self.eRGB.text():
-                code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format(
-                    self.sRed.value(), self.sGreen.value(), self.sBlue.value(),
-                    self.sAlpha.value(), os.linesep)
+                code += '{0}QColor({1:d}, {2:d}, {3:d}, {4:d}),{5}'.format(
+                    istring, self.sRed.value(), self.sGreen.value(),
+                    self.sBlue.value(), self.sAlpha.value(), os.linesep)
             else:
-                code += '{0},{1}'.format(self.eRGB.text(), os.linesep)
+                code += '{0}{1},{2}'.format(
+                    istring, self.eRGB.text(), os.linesep)
             code += '{0}None,{1}'.format(istring, os.linesep)
             code += '{0}self.trUtf8("{1}"),{2}'.format(
                 istring, self.eTitle.text(), os.linesep)
--- a/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py	Fri Nov 29 19:50:08 2013 +0100
+++ b/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py	Sat Nov 30 16:33:11 2013 +0100
@@ -311,3 +311,5 @@
         @return generated code (string)
         """
         return self.__getCode4(indLevel, indString)
+    
+    # TODO: add getCode for PyQt5

eric ide

mercurial