eric7/Plugins/PluginWizardE5MessageBox.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8318
962bce857696
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
2 2
3 # Copyright (c) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the E5MessageBox wizard plugin. 7 Module implementing the EricMessageBox wizard plugin.
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 = "E5MessageBox Wizard Plugin" 20 name = "EricMessageBox Wizard Plugin"
21 author = "Detlev Offenbach <detlev@die-offenbachs.de>" 21 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
22 autoactivate = True 22 autoactivate = True
23 deactivateable = True 23 deactivateable = True
24 version = UI.Info.VersionOnly 24 version = UI.Info.VersionOnly
25 className = "E5MessageBoxWizard" 25 className = "E5MessageBoxWizard"
26 packageName = "__core__" 26 packageName = "__core__"
27 shortDescription = "Show the E5MessageBox wizard." 27 shortDescription = "Show the EricMessageBox wizard."
28 longDescription = """This plugin shows the E5MessageBox wizard.""" 28 longDescription = """This plugin shows the EricMessageBox wizard."""
29 pyqtApi = 2 29 pyqtApi = 2
30 # End-Of-Header 30 # End-Of-Header
31 31
32 error = "" 32 error = ""
33 33
34 34
35 class E5MessageBoxWizard(QObject): 35 class E5MessageBoxWizard(QObject):
36 """ 36 """
37 Class implementing the E5MessageBox wizard plugin. 37 Class implementing the EricMessageBox wizard plugin.
38 """ 38 """
39 def __init__(self, ui): 39 def __init__(self, ui):
40 """ 40 """
41 Constructor 41 Constructor
42 42
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('E5MessageBox Wizard'), 73 self.tr('EricMessageBox Wizard'),
74 self.tr('&E5MessageBox Wizard...'), 0, 0, self, 74 self.tr('&EricMessageBox Wizard...'), 0, 0, self,
75 'wizards_e5messagebox') 75 'wizards_e5messagebox')
76 self.action.setStatusTip(self.tr('E5MessageBox Wizard')) 76 self.action.setStatusTip(self.tr('EricMessageBox Wizard'))
77 self.action.setWhatsThis(self.tr( 77 self.action.setWhatsThis(self.tr(
78 """<b>E5MessageBox Wizard</b>""" 78 """<b>EricMessageBox Wizard</b>"""
79 """<p>This wizard opens a dialog for entering all the parameters""" 79 """<p>This wizard opens a dialog for entering all the parameters"""
80 """ needed to create an E5MessageBox. The generated code is""" 80 """ needed to create an EricMessageBox. 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)

eric ide

mercurial