8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import QObject |
10 from PyQt6.QtCore import QObject |
11 from PyQt6.QtWidgets import QDialog |
11 from PyQt6.QtWidgets import QDialog |
12 |
12 |
13 from E5Gui.E5Application import e5App |
13 from E5Gui.EricApplication import ericApp |
14 from E5Gui.E5Action import E5Action |
14 from E5Gui.EricAction import EricAction |
15 from E5Gui import E5MessageBox |
15 from E5Gui import EricMessageBox |
16 |
16 |
17 import UI.Info |
17 import UI.Info |
18 |
18 |
19 # Start-Of-Header |
19 # Start-Of-Header |
20 name = "QRegularExpression Wizard Plugin" |
20 name = "QRegularExpression Wizard Plugin" |
61 Public method to deactivate this plugin. |
61 Public method to deactivate this plugin. |
62 """ |
62 """ |
63 menu = self.__ui.getMenu("wizards") |
63 menu = self.__ui.getMenu("wizards") |
64 if menu: |
64 if menu: |
65 menu.removeAction(self.action) |
65 menu.removeAction(self.action) |
66 self.__ui.removeE5Actions([self.action], 'wizards') |
66 self.__ui.removeEricActions([self.action], 'wizards') |
67 |
67 |
68 def __initAction(self): |
68 def __initAction(self): |
69 """ |
69 """ |
70 Private method to initialize the action. |
70 Private method to initialize the action. |
71 """ |
71 """ |
72 self.action = E5Action( |
72 self.action = EricAction( |
73 self.tr('QRegularExpression Wizard'), |
73 self.tr('QRegularExpression Wizard'), |
74 self.tr('QRegularE&xpression Wizard...'), 0, 0, self, |
74 self.tr('QRegularE&xpression Wizard...'), 0, 0, self, |
75 'wizards_qregularexpression') |
75 'wizards_qregularexpression') |
76 self.action.setStatusTip(self.tr('QRegularExpression Wizard')) |
76 self.action.setStatusTip(self.tr('QRegularExpression Wizard')) |
77 self.action.setWhatsThis(self.tr( |
77 self.action.setWhatsThis(self.tr( |
80 """ needed to create a QRegularExpression string. The generated""" |
80 """ needed to create a QRegularExpression string. The generated""" |
81 """ code is inserted at the current cursor position.</p>""" |
81 """ code is inserted at the current cursor position.</p>""" |
82 )) |
82 )) |
83 self.action.triggered.connect(self.__handle) |
83 self.action.triggered.connect(self.__handle) |
84 |
84 |
85 self.__ui.addE5Actions([self.action], 'wizards') |
85 self.__ui.addEricActions([self.action], 'wizards') |
86 |
86 |
87 def __initMenu(self): |
87 def __initMenu(self): |
88 """ |
88 """ |
89 Private method to add the actions to the right menu. |
89 Private method to add the actions to the right menu. |
90 """ |
90 """ |
117 |
117 |
118 def __handle(self): |
118 def __handle(self): |
119 """ |
119 """ |
120 Private method to handle the wizards action. |
120 Private method to handle the wizards action. |
121 """ |
121 """ |
122 editor = e5App().getObject("ViewManager").activeWindow() |
122 editor = ericApp().getObject("ViewManager").activeWindow() |
123 |
123 |
124 if editor is None: |
124 if editor is None: |
125 E5MessageBox.critical( |
125 EricMessageBox.critical( |
126 self.__ui, |
126 self.__ui, |
127 self.tr('No current editor'), |
127 self.tr('No current editor'), |
128 self.tr('Please open or create a file first.')) |
128 self.tr('Please open or create a file first.')) |
129 else: |
129 else: |
130 code, ok = self.__callForm(editor) |
130 code, ok = self.__callForm(editor) |