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 = "QInputDialog Wizard Plugin" |
20 name = "QInputDialog 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('QInputDialog Wizard'), |
73 self.tr('QInputDialog Wizard'), |
74 self.tr('Q&InputDialog Wizard...'), 0, 0, self, |
74 self.tr('Q&InputDialog Wizard...'), 0, 0, self, |
75 'wizards_qinputdialog') |
75 'wizards_qinputdialog') |
76 self.action.setStatusTip(self.tr('QInputDialog Wizard')) |
76 self.action.setStatusTip(self.tr('QInputDialog Wizard')) |
77 self.action.setWhatsThis(self.tr( |
77 self.action.setWhatsThis(self.tr( |
80 """ needed to create a QInputDialog. The generated code is""" |
80 """ needed to create a QInputDialog. The generated code is""" |
81 """ inserted at the current cursor position.</p>""" |
81 """ 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 """ |
116 |
116 |
117 def __handle(self): |
117 def __handle(self): |
118 """ |
118 """ |
119 Private method to handle the wizards action. |
119 Private method to handle the wizards action. |
120 """ |
120 """ |
121 editor = e5App().getObject("ViewManager").activeWindow() |
121 editor = ericApp().getObject("ViewManager").activeWindow() |
122 |
122 |
123 if editor is None: |
123 if editor is None: |
124 E5MessageBox.critical( |
124 EricMessageBox.critical( |
125 self.__ui, |
125 self.__ui, |
126 self.tr('No current editor'), |
126 self.tr('No current editor'), |
127 self.tr('Please open or create a file first.')) |
127 self.tr('Please open or create a file first.')) |
128 else: |
128 else: |
129 code, ok = self.__callForm(editor) |
129 code, ok = self.__callForm(editor) |