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 = "setup.py Wizard Plug-in" |
20 name = "setup.py Wizard Plug-in" |
73 Public method to deactivate this plug-in. |
73 Public method to deactivate this plug-in. |
74 """ |
74 """ |
75 menu = self.__ui.getMenu("wizards") |
75 menu = self.__ui.getMenu("wizards") |
76 if menu: |
76 if menu: |
77 menu.removeAction(self.__action) |
77 menu.removeAction(self.__action) |
78 self.__ui.removeE5Actions([self.__action], 'wizards') |
78 self.__ui.removeEricActions([self.__action], 'wizards') |
79 |
79 |
80 def __initAction(self): |
80 def __initAction(self): |
81 """ |
81 """ |
82 Private method to initialize the action. |
82 Private method to initialize the action. |
83 """ |
83 """ |
84 self.__action = E5Action( |
84 self.__action = EricAction( |
85 self.tr('setup.py Wizard'), |
85 self.tr('setup.py Wizard'), |
86 self.tr('&setup.py Wizard...'), |
86 self.tr('&setup.py Wizard...'), |
87 0, 0, self, |
87 0, 0, self, |
88 'wizards_setup_py') |
88 'wizards_setup_py') |
89 self.__action.setStatusTip(self.tr('setup.py Wizard')) |
89 self.__action.setStatusTip(self.tr('setup.py Wizard')) |
94 """ generated code is inserted at the current cursor position.""" |
94 """ generated code is inserted at the current cursor position.""" |
95 """</p>""" |
95 """</p>""" |
96 )) |
96 )) |
97 self.__action.triggered.connect(self.__handle) |
97 self.__action.triggered.connect(self.__handle) |
98 |
98 |
99 self.__ui.addE5Actions([self.__action], 'wizards') |
99 self.__ui.addEricActions([self.__action], 'wizards') |
100 |
100 |
101 def __initMenu(self): |
101 def __initMenu(self): |
102 """ |
102 """ |
103 Private method to add the actions to the right menu. |
103 Private method to add the actions to the right menu. |
104 """ |
104 """ |
130 |
130 |
131 def __handle(self): |
131 def __handle(self): |
132 """ |
132 """ |
133 Private method to handle the wizards action. |
133 Private method to handle the wizards action. |
134 """ |
134 """ |
135 editor = e5App().getObject("ViewManager").activeWindow() |
135 editor = ericApp().getObject("ViewManager").activeWindow() |
136 |
136 |
137 if editor is None: |
137 if editor is None: |
138 E5MessageBox.critical( |
138 EricMessageBox.critical( |
139 self.__ui, |
139 self.__ui, |
140 self.tr('No current editor'), |
140 self.tr('No current editor'), |
141 self.tr('Please open or create a file first.')) |
141 self.tr('Please open or create a file first.')) |
142 else: |
142 else: |
143 code, ok = self.__callForm(editor) |
143 code, ok = self.__callForm(editor) |