157 E5MessageBox.critical( |
157 E5MessageBox.critical( |
158 self.__ui, |
158 self.__ui, |
159 self.tr('No current editor'), |
159 self.tr('No current editor'), |
160 self.tr('Please open or create a file first.')) |
160 self.tr('Please open or create a file first.')) |
161 else: |
161 else: |
|
162 if variant not in ("QFileDialog", "E5FileDialog"): |
|
163 raise ValueError("Illegal dialog variant given") |
|
164 |
162 if variant == "QFileDialog": |
165 if variant == "QFileDialog": |
163 match = self.__pyqtRe.search(editor.text()) |
166 match = self.__pyqtRe.search(editor.text()) |
164 if match is None: |
167 if match is None: |
165 # unknown |
168 # unknown |
166 dialogVariant = 0 |
169 dialogVariant = 0 |
167 else: |
170 else: |
168 # PyQt5/PyQt6 |
171 # PyQt5/PyQt6 |
169 dialogVariant = int(match.group(1)) |
172 dialogVariant = int(match.group(1)) |
170 elif variant == "E5FileDialog": |
173 else: |
171 # E5FileDialog |
174 # E5FileDialog |
172 dialogVariant = -1 |
175 dialogVariant = -1 |
173 else: |
|
174 raise ValueError("Illegal dialog variant given") |
|
175 |
176 |
176 code, ok = self.__callForm(editor, dialogVariant) |
177 code, ok = self.__callForm(editor, dialogVariant) |
177 if ok: |
178 if ok: |
178 line, index = editor.getCursorPosition() |
179 line, index = editor.getCursorPosition() |
179 # It should be done on this way to allow undo |
180 # It should be done on this way to allow undo |