src/eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py

branch
eric7
changeset 10437
2f70ca07f0af
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10436:f6881d10e995 10437:2f70ca07f0af
40 40
41 def __init__(self, parent=None, fromEric=True): 41 def __init__(self, parent=None, fromEric=True):
42 """ 42 """
43 Constructor 43 Constructor
44 44
45 @param parent parent widget (QWidget) 45 @param parent parent widget
46 @type QWidget
46 @param fromEric flag indicating a call from within eric 47 @param fromEric flag indicating a call from within eric
48 @type bool
47 """ 49 """
48 super().__init__(parent) 50 super().__init__(parent)
49 self.setupUi(self) 51 self.setupUi(self)
50 52
51 # initialize icons of the tool buttons 53 # initialize icons of the tool buttons
140 142
141 def __sendCommand(self, command, **kw): 143 def __sendCommand(self, command, **kw):
142 """ 144 """
143 Private method to send a command to the server. 145 Private method to send a command to the server.
144 146
145 @param command dictionary with command string and related 147 @param command dictionary with command string and related data
146 data (dict) 148 @type dict
147 @keyparam kw parameters for the command 149 @keyparam kw parameters for the command
148 @return flag indicating a successful transmission (boolean) 150 @type dict
151 @return flag indicating a successful transmission
152 @rtype bool
149 """ 153 """
150 result = False 154 result = False
151 if command: 155 if command:
152 commandDict = {"command": command} 156 commandDict = {"command": command}
153 commandDict.update(kw) 157 commandDict.update(kw)
159 163
160 def __receiveResponse(self): 164 def __receiveResponse(self):
161 """ 165 """
162 Private method to receive a response from the server. 166 Private method to receive a response from the server.
163 167
164 @return response dictionary (dict) 168 @return response dictionary
169 @rtype dict
165 """ 170 """
166 responseDict = {} 171 responseDict = {}
167 if self.__pyqt6Server.waitForReadyRead(10000): 172 if self.__pyqt6Server.waitForReadyRead(10000):
168 data = bytes(self.__pyqt6Server.readAllStandardOutput()) 173 data = bytes(self.__pyqt6Server.readAllStandardOutput())
169 responseStr = data.decode("utf-8") 174 responseStr = data.decode("utf-8")
190 def __insertString(self, s, steps=0): 195 def __insertString(self, s, steps=0):
191 """ 196 """
192 Private method to insert a string into line edit and move cursor. 197 Private method to insert a string into line edit and move cursor.
193 198
194 @param s string to be inserted into the regexp line edit 199 @param s string to be inserted into the regexp line edit
195 (string) 200 @type str
196 @param steps number of characters to move the cursor (integer). 201 @param steps number of characters to move the cursor. Negative steps
197 Negative steps moves cursor back, positives forward. 202 move cursor back, positive steps forward.
203 @type int
198 """ 204 """
199 self.regexpTextEdit.insertPlainText(s) 205 self.regexpTextEdit.insertPlainText(s)
200 tc = self.regexpTextEdit.textCursor() 206 tc = self.regexpTextEdit.textCursor()
201 if steps != 0: 207 if steps != 0:
202 if steps < 0: 208 if steps < 0:
386 392
387 def on_buttonBox_clicked(self, button): 393 def on_buttonBox_clicked(self, button):
388 """ 394 """
389 Private slot called by a button of the button box clicked. 395 Private slot called by a button of the button box clicked.
390 396
391 @param button button that was clicked (QAbstractButton) 397 @param button button that was clicked
398 @type QAbstractButton
392 """ 399 """
393 if button == self.validateButton: 400 if button == self.validateButton:
394 self.on_validateButton_clicked() 401 self.on_validateButton_clicked()
395 elif button == self.executeButton: 402 elif button == self.executeButton:
396 self.on_executeButton_clicked() 403 self.on_executeButton_clicked()
567 574
568 This slot will execute the entered QRegularExpression on the entered 575 This slot will execute the entered QRegularExpression on the entered
569 test data and will display the result in the table part of the dialog. 576 test data and will display the result in the table part of the dialog.
570 577
571 @param startpos starting position for the QRegularExpression matching 578 @param startpos starting position for the QRegularExpression matching
579 @type int
572 """ 580 """
573 if not self.__pyqt6Available: 581 if not self.__pyqt6Available:
574 # only available for PyQt6 582 # only available for PyQt6
575 return 583 return
576 584
754 762
755 def getCode(self, indLevel, indString): 763 def getCode(self, indLevel, indString):
756 """ 764 """
757 Public method to get the source code. 765 Public method to get the source code.
758 766
759 @param indLevel indentation level (int) 767 @param indLevel indentation level
760 @param indString string used for indentation (space or tab) (string) 768 @type int
761 @return generated code (string) 769 @param indString string used for indentation (space or tab)
770 @type str
771 @return generated code
772 @rtype str
762 """ 773 """
763 # calculate the indentation string 774 # calculate the indentation string
764 i1string = (indLevel + 1) * indString 775 i1string = (indLevel + 1) * indString
765 estring = os.linesep + indLevel * indString 776 estring = os.linesep + indLevel * indString
766 777
813 824
814 def __init__(self, parent=None, fromEric=True): 825 def __init__(self, parent=None, fromEric=True):
815 """ 826 """
816 Constructor 827 Constructor
817 828
818 @param parent parent widget (QWidget) 829 @param parent parent widget
830 @type QWidget
819 @param fromEric flag indicating a call from within eric 831 @param fromEric flag indicating a call from within eric
832 @type bool
820 """ 833 """
821 super().__init__(parent) 834 super().__init__(parent)
822 self.setModal(fromEric) 835 self.setModal(fromEric)
823 self.setSizeGripEnabled(True) 836 self.setSizeGripEnabled(True)
824 837
837 850
838 def getCode(self, indLevel, indString): 851 def getCode(self, indLevel, indString):
839 """ 852 """
840 Public method to get the source code. 853 Public method to get the source code.
841 854
842 @param indLevel indentation level (int) 855 @param indLevel indentation level
843 @param indString string used for indentation (space or tab) (string) 856 @type int
844 @return generated code (string) 857 @param indString string used for indentation (space or tab)
858 @type str
859 @return generated code
860 @rtype str
845 """ 861 """
846 return self.cw.getCode(indLevel, indString) 862 return self.cw.getCode(indLevel, indString)
847 863
848 def accept(self): 864 def accept(self):
849 """ 865 """
867 883
868 def __init__(self, parent=None): 884 def __init__(self, parent=None):
869 """ 885 """
870 Constructor 886 Constructor
871 887
872 @param parent reference to the parent widget (QWidget) 888 @param parent reference to the parent widget
889 @type QWidget
873 """ 890 """
874 super().__init__(parent) 891 super().__init__(parent)
875 self.cw = QRegularExpressionWizardWidget(self, fromEric=False) 892 self.cw = QRegularExpressionWizardWidget(self, fromEric=False)
876 size = self.cw.size() 893 size = self.cw.size()
877 self.setCentralWidget(self.cw) 894 self.setCentralWidget(self.cw)
885 902
886 def closeEvent(self, evt): 903 def closeEvent(self, evt):
887 """ 904 """
888 Protected method handling the close event. 905 Protected method handling the close event.
889 906
890 @param evt close event (QCloseEvent) 907 @param evt close event
908 @type QCloseEvent
891 """ 909 """
892 self.cw.shutdown() 910 self.cw.shutdown()
893 super().closeEvent(evt) 911 super().closeEvent(evt)

eric ide

mercurial