112 """ |
112 """ |
113 menu = self.__ui.getMenu("wizards") |
113 menu = self.__ui.getMenu("wizards") |
114 if menu: |
114 if menu: |
115 menu.addAction(self.__action) |
115 menu.addAction(self.__action) |
116 |
116 |
117 def __callForm(self, editor): |
117 def __callForm(self): |
118 """ |
118 """ |
119 Private method to display a dialog and get the code. |
119 Private method to display a dialog and get the code. |
120 |
120 |
121 @param editor reference to the current editor |
|
122 @return generated code (string), the plug-in package name (string) |
121 @return generated code (string), the plug-in package name (string) |
123 and a flag indicating success (boolean) |
122 and a flag indicating success (boolean) |
124 """ |
123 """ |
125 from eric7.Plugins.WizardPlugins.EricPluginWizard.PluginWizardDialog import ( |
124 from eric7.Plugins.WizardPlugins.EricPluginWizard.PluginWizardDialog import ( |
126 PluginWizardDialog, |
125 PluginWizardDialog, |
143 self.__ui, |
142 self.__ui, |
144 self.tr("No current editor"), |
143 self.tr("No current editor"), |
145 self.tr("Please open or create a file first."), |
144 self.tr("Please open or create a file first."), |
146 ) |
145 ) |
147 else: |
146 else: |
148 code, packageName, ok = self.__callForm(editor) |
147 code, packageName, ok = self.__callForm() |
149 if ok: |
148 if ok: |
150 line, index = editor.getCursorPosition() |
149 line, index = editor.getCursorPosition() |
151 # It should be done on this way to allow undo |
150 # It should be done on this way to allow undo |
152 editor.beginUndoAction() |
151 editor.beginUndoAction() |
153 editor.insertAt(code, line, index) |
152 editor.insertAt(code, line, index) |