src/eric7/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py

branch
eric7
changeset 10437
2f70ca07f0af
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10436:f6881d10e995 10437:2f70ca07f0af
39 39
40 def __init__(self, parent=None, fromEric=True): 40 def __init__(self, parent=None, fromEric=True):
41 """ 41 """
42 Constructor 42 Constructor
43 43
44 @param parent parent widget (QWidget) 44 @param parent parent widget
45 @type QWidget
45 @param fromEric flag indicating a call from within eric 46 @param fromEric flag indicating a call from within eric
47 @type bool
46 """ 48 """
47 super().__init__(parent) 49 super().__init__(parent)
48 self.setupUi(self) 50 self.setupUi(self)
49 51
50 # initialize icons of the tool buttons 52 # initialize icons of the tool buttons
117 def __insertString(self, s, steps=0): 119 def __insertString(self, s, steps=0):
118 """ 120 """
119 Private method to insert a string into line edit and move cursor. 121 Private method to insert a string into line edit and move cursor.
120 122
121 @param s string to be inserted into the regexp line edit 123 @param s string to be inserted into the regexp line edit
122 (string) 124 @type str
123 @param steps number of characters to move the cursor (integer). 125 @param steps number of characters to move the cursor. Negative steps
124 Negative steps moves cursor back, positives forward. 126 move cursor back, positive steps forward.
127 @type int
125 """ 128 """
126 self.regexpTextEdit.insertPlainText(s) 129 self.regexpTextEdit.insertPlainText(s)
127 tc = self.regexpTextEdit.textCursor() 130 tc = self.regexpTextEdit.textCursor()
128 if steps != 0: 131 if steps != 0:
129 if steps < 0: 132 if steps < 0:
302 305
303 def on_buttonBox_clicked(self, button): 306 def on_buttonBox_clicked(self, button):
304 """ 307 """
305 Private slot called by a button of the button box clicked. 308 Private slot called by a button of the button box clicked.
306 309
307 @param button button that was clicked (QAbstractButton) 310 @param button button that was clicked
311 @type QAbstractButton
308 """ 312 """
309 if button == self.validateButton: 313 if button == self.validateButton:
310 self.on_validateButton_clicked() 314 self.on_validateButton_clicked()
311 elif button == self.executeButton: 315 elif button == self.executeButton:
312 self.on_executeButton_clicked() 316 self.on_executeButton_clicked()
458 462
459 This slot will execute the entered regexp on the entered test 463 This slot will execute the entered regexp on the entered test
460 data and will display the result in the table part of the dialog. 464 data and will display the result in the table part of the dialog.
461 465
462 @param startpos starting position for the regexp matching 466 @param startpos starting position for the regexp matching
467 @type int
463 """ 468 """
464 regex = self.regexpTextEdit.toPlainText() 469 regex = self.regexpTextEdit.toPlainText()
465 text = self.textTextEdit.toPlainText() 470 text = self.textTextEdit.toPlainText()
466 if regex and text: 471 if regex and text:
467 try: 472 try:
612 617
613 def getCode(self, indLevel, indString): 618 def getCode(self, indLevel, indString):
614 """ 619 """
615 Public method to get the source code. 620 Public method to get the source code.
616 621
617 @param indLevel indentation level (int) 622 @param indLevel indentation level
618 @param indString string used for indentation (space or tab) (string) 623 @type int
619 @return generated code (string) 624 @param indString string used for indentation (space or tab)
625 @type str
626 @return generated code
627 @rtype str
620 """ 628 """
621 # calculate the indentation string 629 # calculate the indentation string
622 istring = indLevel * indString 630 istring = indLevel * indString
623 i1string = (indLevel + 1) * indString 631 i1string = (indLevel + 1) * indString
624 estring = os.linesep + indLevel * indString 632 estring = os.linesep + indLevel * indString
663 671
664 def __init__(self, parent=None, fromEric=True): 672 def __init__(self, parent=None, fromEric=True):
665 """ 673 """
666 Constructor 674 Constructor
667 675
668 @param parent parent widget (QWidget) 676 @param parent parent widget
677 @type QWidget
669 @param fromEric flag indicating a call from within eric 678 @param fromEric flag indicating a call from within eric
679 @type bool
670 """ 680 """
671 super().__init__(parent) 681 super().__init__(parent)
672 self.setModal(fromEric) 682 self.setModal(fromEric)
673 self.setSizeGripEnabled(True) 683 self.setSizeGripEnabled(True)
674 684
687 697
688 def getCode(self, indLevel, indString): 698 def getCode(self, indLevel, indString):
689 """ 699 """
690 Public method to get the source code. 700 Public method to get the source code.
691 701
692 @param indLevel indentation level (int) 702 @param indLevel indentation level
693 @param indString string used for indentation (space or tab) (string) 703 @type int
694 @return generated code (string) 704 @param indString string used for indentation (space or tab)
705 @type str
706 @return generated code
707 @rtype str
695 """ 708 """
696 return self.cw.getCode(indLevel, indString) 709 return self.cw.getCode(indLevel, indString)
697 710
698 711
699 class PyRegExpWizardWindow(EricMainWindow): 712 class PyRegExpWizardWindow(EricMainWindow):
703 716
704 def __init__(self, parent=None): 717 def __init__(self, parent=None):
705 """ 718 """
706 Constructor 719 Constructor
707 720
708 @param parent reference to the parent widget (QWidget) 721 @param parent reference to the parent widget
722 @type QWidget
709 """ 723 """
710 super().__init__(parent) 724 super().__init__(parent)
711 self.cw = PyRegExpWizardWidget(self, fromEric=False) 725 self.cw = PyRegExpWizardWidget(self, fromEric=False)
712 size = self.cw.size() 726 size = self.cw.size()
713 self.setCentralWidget(self.cw) 727 self.setCentralWidget(self.cw)

eric ide

mercurial