Changed the wizards code generation to eliminate not needed backslashes.

Sat, 31 Jul 2010 17:17:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Jul 2010 17:17:07 +0200
changeset 446
69aac6eeba9b
parent 444
6f3b2099858e
child 447
d5a0302040e9

Changed the wizards code generation to eliminate not needed backslashes.

Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.ui file | annotate | diff | comparison | revisions
Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -134,6 +134,7 @@
         # calculate our indentation level and the indentation string
         il = indLevel + 1
         istring = il * indString
+        estring = os.linesep + indLevel * indString
         
         # now generate the code
         code = 'QColorDialog.'
@@ -152,7 +153,7 @@
                 code += \
                     '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\
                         .format(istring)
-            code += '){0}'.format(os.linesep)
+            code += '){0}'.format(estring)
         elif self.rRGBA.isChecked():
             if self.rQt45.isChecked():
                 code += 'getColor('
@@ -168,7 +169,7 @@
                 code += \
                     '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\
                         .format(istring)
-                code += '){0}'.format(os.linesep)
+                code += '){0}'.format(estring)
             else:
                 code += 'getRgba('
                 if not self.eRGB.text():
@@ -177,6 +178,6 @@
                         self.sAlpha.value())
                 else:
                     code += self.eRGB.text()
-                code += '){0}'.format(os.linesep)
+                code += '){0}'.format(estring)
         
         return code
--- a/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -144,14 +144,15 @@
         # calculate our indentation level and the indentation string
         il = indLevel + 1
         istring = il * indString
+        estring = os.linesep + indLevel * indString
         
         # now generate the code
         code = 'QFileDialog.'
         if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked():
             if self.rOpenFile.isChecked():
-                code += 'getOpenFileName(\\{0}{1}'.format(os.linesep, istring)
+                code += 'getOpenFileName({0}{1}'.format(os.linesep, istring)
             else:
-                code += 'getOpenFileNameAndFilter(\\{0}{1}'.format(os.linesep, istring)
+                code += 'getOpenFileNameAndFilter({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             if not self.eCaption.text():
                 code += '"",{0}{1}'.format(os.linesep, istring)
@@ -179,12 +180,12 @@
             if not self.cSymlinks.isChecked():
                 code += ',{0}{1}QFileDialog.Options(QFileDialog.DontResolveSymlinks)'\
                         .format(os.linesep, istring)
-            code += '){0}'.format(os.linesep)
+            code += '){0}'.format(estring)
         elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked():
             if self.rOpenFiles.isChecked():
-                code += 'getOpenFileNames(\\{0}{1}'.format(os.linesep, istring)
+                code += 'getOpenFileNames({0}{1}'.format(os.linesep, istring)
             else:
-                code += 'getOpenFileNamesAndFilter(\\{0}{1}'.format(os.linesep, istring)
+                code += 'getOpenFileNamesAndFilter({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             if not self.eCaption.text():
                 code += '"",{0}{1}'.format(os.linesep, istring)
@@ -212,12 +213,12 @@
             if not self.cSymlinks.isChecked():
                 code += ',{0}{1}QFileDialog.Options(QFileDialog.DontResolveSymlinks)'\
                         .format(os.linesep, istring)
-            code += '){0}'.format(os.linesep)
+            code += '){0}'.format(estring)
         elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked():
             if self.rSaveFile.isChecked():
-                code += 'getSaveFileName(\\{0}{1}'.format(os.linesep, istring)
+                code += 'getSaveFileName({0}{1}'.format(os.linesep, istring)
             else:
-                code += 'getSaveFileNameAndFilter(\\{0}{1}'.format(os.linesep, istring)
+                code += 'getSaveFileNameAndFilter({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             if not self.eCaption.text():
                 code += '"",{0}{1}'.format(os.linesep, istring)
@@ -253,9 +254,9 @@
                 if not self.cConfirmOverwrite.isChecked():
                     code += 'QFileDialog.DontConfirmOverwrite'
                 code += ')'
-            code += '){0}'.format(os.linesep)
+            code += '){0}'.format(estring)
         elif self.rDirectory.isChecked():
-            code += 'getExistingDirectory(\\{0}{1}'.format(os.linesep, istring)
+            code += 'getExistingDirectory({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             if not self.eCaption.text():
                 code += '"",{0}{1}'.format(os.linesep, istring)
@@ -277,7 +278,7 @@
                 code += 'QFileDialog.ShowDirsOnly'
             else:
                 code += 'QFileDialog.Option(0)'
-            code += ')){0}'.format(os.linesep)
+            code += ')){0}'.format(estring)
             
         return code
         
--- a/Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/FontDialogWizard/FontDialogWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -88,6 +88,8 @@
         @param indString string used for indentation (space or tab) (string)
         @return generated code (string)
         """
+        estring = os.linesep + indLevel * indString
+        
         # generate the code
         code = 'QFontDialog.getFont('
         if not self.eVariable.text():
@@ -97,6 +99,6 @@
                     self.font.weight(), self.font.italic())
         else:
             code += self.eVariable.text()
-        code += '){0}'.format(os.linesep)
+        code += '){0}'.format(estring)
             
         return code
--- a/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -119,11 +119,12 @@
         # calculate our indentation level and the indentation string
         il = indLevel + 1
         istring = il * indString
+        estring = os.linesep + indLevel * indString
         
         # now generate the code
         code = 'QInputDialog.'
         if self.rText.isChecked():
-            code += 'getText(\\{0}{1}'.format(os.linesep, istring)
+            code += 'getText({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             code += 'self.trUtf8("{0}"),{1}{2}'.format(
                 self.eCaption.text(), os.linesep, istring)
@@ -138,9 +139,9 @@
             if self.eTextDefault.text():
                 code += ',{0}{1}self.trUtf8("{2}")'.format(
                     os.linesep, istring, self.eTextDefault.text())
-            code += '){0}'.format(os.linesep)
+            code += '){0}'.format(estring)
         elif self.rInteger.isChecked():
-            code += 'getInteger(\\{0}{1}'.format(os.linesep, istring)
+            code += 'getInteger({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             code += 'self.trUtf8("{0}"),{1}{2}'.format(
                 self.eCaption.text(), os.linesep, istring)
@@ -148,7 +149,7 @@
                 self.eLabel.text(), os.linesep, istring)
             code += '{0:d}, {1:d}, {2:d}, {3:d}){4}'.format(
                 self.sIntDefault.value(), self.sIntFrom.value(),
-                self.sIntTo.value(), self.sIntStep.value(), os.linesep)
+                self.sIntTo.value(), self.sIntStep.value(), estring)
         elif self.rDouble.isChecked():
             try:
                 doubleDefault = float(self.eDoubleDefault.text())
@@ -162,7 +163,7 @@
                 doubleTo = float(self.eDoubleTo.text())
             except ValueError:
                 doubleTo = 2147483647
-            code += 'getDouble(\\{0}{1}'.format(os.linesep, istring)
+            code += 'getDouble({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             code += 'self.trUtf8("{0}"),{1}{2}'.format(
                 self.eCaption.text(), os.linesep, istring)
@@ -170,9 +171,9 @@
                 self.eLabel.text(), os.linesep, istring)
             code += '{0}, {1}, {2}, {3:d}){4}'.format(
                 doubleDefault, doubleFrom, doubleTo, 
-                self.sDoubleDecimals.value(), os.linesep)
+                self.sDoubleDecimals.value(), estring)
         elif self.rItem.isChecked():
-            code += 'getItem(\\{0}{1}'.format(os.linesep, istring)
+            code += 'getItem({0}{1}'.format(os.linesep, istring)
             code += 'None,{0}{1}'.format(os.linesep, istring)
             code += 'self.trUtf8("{0}"),{1}{2}'.format(
                 self.eCaption.text(), os.linesep, istring)
@@ -180,7 +181,7 @@
                 self.eLabel.text(), os.linesep, istring)
             code += '{0},{1}{2}'.format(self.eVariable.text(), os.linesep, istring)
             code += '{0:d}, {1}){2}'.format(
-                self.sCurrentItem.value(), self.cEditable.isChecked(), os.linesep)
+                self.sCurrentItem.value(), self.cEditable.isChecked(), estring)
             
         return code
         
--- a/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/MessageBoxWizard/MessageBoxWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -294,13 +294,14 @@
         # calculate our indentation level and the indentation string
         il = indLevel + 1
         istring = il * indString
+        estring = os.linesep + indLevel * indString
         
         # now generate the code
         msgdlg = 'QMessageBox.'
         if self.rAbout.isChecked():
             msgdlg += "about(None,{0}".format(os.linesep)
         elif self.rAboutQt.isChecked():
-            msgdlg += "aboutQt(None, {0}".format(os.linesep)
+            msgdlg += "aboutQt(None,{0}".format(os.linesep)
         elif self.rInformation.isChecked():
             msgdlg += "information(None,{0}".format(os.linesep)
         elif self.rQuestion.isChecked():
@@ -315,5 +316,5 @@
                 os.linesep, istring, self.eMessage.toPlainText())
         if not self.rAbout.isChecked() and not self.rAboutQt.isChecked():
             msgdlg += self.__getQt42ButtonCode(istring, indString)
-        msgdlg +='){0}'.format(os.linesep)
+        msgdlg +='){0}'.format(estring)
         return msgdlg
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -586,6 +586,7 @@
         # calculate the indentation string
         istring = indLevel * indString
         i1string = (indLevel + 1) * indString
+        estring = os.linesep + indLevel * indString
         
         # now generate the code
         reVar = self.variableLineEdit.text()
@@ -619,8 +620,8 @@
         code += '{0} = re.compile(r"""{1}"""'.format(
             reVar, regexp.replace('"', '\\"'))
         if flags:
-            code += ', \\{0}{1}{2}'.format(os.linesep, i1string, flags)
-        code += '){0}'.format(os.linesep)
+            code += ', {0}{1}{2}'.format(os.linesep, i1string, flags)
+        code += '){0}'.format(estring)
         return code
 
 class PyRegExpWizardDialog(QDialog):
--- a/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.ui	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.ui	Sat Jul 31 17:17:07 2010 +0200
@@ -32,7 +32,7 @@
          <string>Python 2</string>
         </property>
         <property name="checked">
-         <bool>true</bool>
+         <bool>false</bool>
         </property>
        </widget>
       </item>
@@ -41,6 +41,9 @@
         <property name="text">
          <string>Python 3</string>
         </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
        </widget>
       </item>
       <item>
@@ -485,7 +488,7 @@
        <item row="1" column="2">
         <widget class="QCheckBox" name="unicodeCheckBox">
          <property name="text">
-          <string>Unicode</string>
+          <string>ASCII</string>
          </property>
         </widget>
        </item>
--- a/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py	Sat Jul 31 16:41:42 2010 +0200
+++ b/Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py	Sat Jul 31 17:17:07 2010 +0200
@@ -451,6 +451,7 @@
         """
         # calculate the indentation string
         istring = indLevel * indString
+        estring = os.linesep + indLevel * indString
         
         # now generate the code
         reVar = self.variableLineEdit.text()
@@ -465,10 +466,10 @@
             code += '{0}{1}.setCaseSensitivity(Qt.CaseInsensitive){2}'.format(
                     istring, reVar, os.linesep)
         if self.minimalCheckBox.isChecked():
-            code += '{0}{1}.setMinimal(1){2}'.format(istring, reVar, os.linesep)
+            code += '{0}{1}.setMinimal(True){2}'.format(istring, reVar, os.linesep)
         if self.wildcardCheckBox.isChecked():
             code += '{0}{1}.setPatternSyntax(QRegExp.Wildcard){2}'.format(
-                    istring, reVar, os.linesep)
+                    istring, reVar, estring)
         return code
 
 class QRegExpWizardDialog(QDialog):

eric ide

mercurial