Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py

changeset 3119
8b19074bb239
parent 2893
150de635fa29
child 3142
55030c09e142
child 3160
209a07d7e401
equal deleted inserted replaced
3118:b1278ba1d7fe 3119:8b19074bb239
611 Private slot called when the Python version was selected. 611 Private slot called when the Python version was selected.
612 612
613 @param checked state of the Python 2 button (boolean) 613 @param checked state of the Python 2 button (boolean)
614 """ 614 """
615 # set the checkboxes 615 # set the checkboxes
616 self.localeCheckBox.setHidden(not checked) 616 self.localeCheckBox.setEnabled(checked)
617 if checked: 617 if checked:
618 self.unicodeCheckBox.setText(self.trUtf8("Unicode")) 618 self.unicodeCheckBox.setText(self.trUtf8("Unicode"))
619 else: 619 else:
620 self.unicodeCheckBox.setText(self.trUtf8("ASCII")) 620 self.unicodeCheckBox.setText(self.trUtf8("ASCII"))
621 self.unicodeCheckBox.setChecked(not self.unicodeCheckBox.isChecked()) 621 self.unicodeCheckBox.setChecked(not self.unicodeCheckBox.isChecked())
670 flags = " | ".join(flags) 670 flags = " | ".join(flags)
671 671
672 code = '' 672 code = ''
673 if self.importCheckBox.isChecked(): 673 if self.importCheckBox.isChecked():
674 code += 'import re{0}{1}'.format(os.linesep, istring) 674 code += 'import re{0}{1}'.format(os.linesep, istring)
675 code += '{0} = re.compile(r"""{1}"""'.format( 675 code += '{0} = re.compile('.format(reVar)
676 reVar, regexp.replace('"', '\\"')) 676 code += '{0}{1}r"""{2}"""'.format(
677 os.linesep, i1string, regexp.replace('"', '\\"'))
677 if flags: 678 if flags:
678 code += ', {0}{1}{2}'.format(os.linesep, i1string, flags) 679 code += ',{0}{1}{2}'.format(os.linesep, i1string, flags)
679 code += '){0}'.format(estring) 680 code += '){0}'.format(estring)
680 return code 681 return code
681 682
682 683
683 class PyRegExpWizardDialog(QDialog): 684 class PyRegExpWizardDialog(QDialog):

eric ide

mercurial