584 @return generated code (string) |
584 @return generated code (string) |
585 """ |
585 """ |
586 # calculate the indentation string |
586 # calculate the indentation string |
587 istring = indLevel * indString |
587 istring = indLevel * indString |
588 i1string = (indLevel + 1) * indString |
588 i1string = (indLevel + 1) * indString |
|
589 estring = os.linesep + indLevel * indString |
589 |
590 |
590 # now generate the code |
591 # now generate the code |
591 reVar = self.variableLineEdit.text() |
592 reVar = self.variableLineEdit.text() |
592 if not reVar: |
593 if not reVar: |
593 reVar = "regexp" |
594 reVar = "regexp" |
617 if self.importCheckBox.isChecked(): |
618 if self.importCheckBox.isChecked(): |
618 code += 'import re{0}{1}'.format(os.linesep, istring) |
619 code += 'import re{0}{1}'.format(os.linesep, istring) |
619 code += '{0} = re.compile(r"""{1}"""'.format( |
620 code += '{0} = re.compile(r"""{1}"""'.format( |
620 reVar, regexp.replace('"', '\\"')) |
621 reVar, regexp.replace('"', '\\"')) |
621 if flags: |
622 if flags: |
622 code += ', \\{0}{1}{2}'.format(os.linesep, i1string, flags) |
623 code += ', {0}{1}{2}'.format(os.linesep, i1string, flags) |
623 code += '){0}'.format(os.linesep) |
624 code += '){0}'.format(estring) |
624 return code |
625 return code |
625 |
626 |
626 class PyRegExpWizardDialog(QDialog): |
627 class PyRegExpWizardDialog(QDialog): |
627 """ |
628 """ |
628 Class for the dialog variant. |
629 Class for the dialog variant. |