11216:a1471981ef18 | 11217:856628e8a303 |
---|---|
48 @type UserInterface | 48 @type UserInterface |
49 """ | 49 """ |
50 super().__init__(ui) | 50 super().__init__(ui) |
51 self.__ui = ui | 51 self.__ui = ui |
52 | 52 |
53 # PyQt5/PyQt6 | 53 # PyQt6 |
54 self.__pyqtRe = re.compile(r"(?:import|from)\s+PyQt([56])") | 54 self.__pyqtRe = re.compile(r"(?:import|from)\s+PyQt([6])") |
55 | 55 |
56 def activate(self): | 56 def activate(self): |
57 """ | 57 """ |
58 Public method to activate this plugin. | 58 Public method to activate this plugin. |
59 | 59 |
139 Private method to display a dialog and get the code. | 139 Private method to display a dialog and get the code. |
140 | 140 |
141 @param editor reference to the current editor | 141 @param editor reference to the current editor |
142 @type Editor | 142 @type Editor |
143 @param variant variant of code to be generated | 143 @param variant variant of code to be generated |
144 (-1 = EricFileDialog, 0 = unknown, 5 = PyQt5, 6 = PyQt6) | 144 (-1 = EricFileDialog, 0 = unknown, 6 = PyQt6) |
145 @type int | 145 @type int |
146 @return the generated code | 146 @return the generated code |
147 @rtype str | 147 @rtype str |
148 """ | 148 """ |
149 from eric7.Plugins.WizardPlugins.FileDialogWizard import FileDialogWizardDialog | 149 from eric7.Plugins.WizardPlugins.FileDialogWizard import FileDialogWizardDialog |
185 match = self.__pyqtRe.search(editor.text()) | 185 match = self.__pyqtRe.search(editor.text()) |
186 if match is None: | 186 if match is None: |
187 # unknown | 187 # unknown |
188 dialogVariant = 0 | 188 dialogVariant = 0 |
189 else: | 189 else: |
190 # PyQt5/PyQt6 | 190 # PyQt6 |
191 dialogVariant = int(match.group(1)) | 191 dialogVariant = int(match.group(1)) |
192 else: | 192 else: |
193 # EricFileDialog | 193 # EricFileDialog |
194 dialogVariant = -1 | 194 dialogVariant = -1 |
195 | 195 |