Plugins/PluginEricapi.py

changeset 53
c3eb7cc1ff8b
parent 18
3b1f5d872fd7
child 55
b5c84934de9c
equal deleted inserted replaced
52:ba69827929ee 53:c3eb7cc1ff8b
12 import copy 12 import copy
13 13
14 from PyQt4.QtCore import QObject, SIGNAL 14 from PyQt4.QtCore import QObject, SIGNAL
15 from PyQt4.QtGui import QDialog, QApplication 15 from PyQt4.QtGui import QDialog, QApplication
16 16
17 from E4Gui.E4Application import e4App 17 from E4Gui.E4Application import e5App
18 18
19 from E4Gui.E4Action import E4Action 19 from E4Gui.E4Action import E4Action
20 20
21 from DocumentationPlugins.Ericapi.EricapiConfigDialog import EricapiConfigDialog 21 from DocumentationPlugins.Ericapi.EricapiConfigDialog import EricapiConfigDialog
22 from DocumentationPlugins.Ericapi.EricapiExecDialog import EricapiExecDialog 22 from DocumentationPlugins.Ericapi.EricapiExecDialog import EricapiExecDialog
88 """ 88 """
89 Public method to activate this plugin. 89 Public method to activate this plugin.
90 90
91 @return tuple of None and activation status (boolean) 91 @return tuple of None and activation status (boolean)
92 """ 92 """
93 menu = e4App().getObject("Project").getMenu("Apidoc") 93 menu = e5App().getObject("Project").getMenu("Apidoc")
94 if menu: 94 if menu:
95 self.__projectAct = E4Action(self.trUtf8('Generate API file (eric5-api)'), 95 self.__projectAct = E4Action(self.trUtf8('Generate API file (eric5-api)'),
96 self.trUtf8('Generate &API file (eric5-api)'), 0, 0, 96 self.trUtf8('Generate &API file (eric5-api)'), 0, 0,
97 self, 'doc_eric5_api') 97 self, 'doc_eric5_api')
98 self.__projectAct.setStatusTip(\ 98 self.__projectAct.setStatusTip(\
100 self.__projectAct.setWhatsThis(self.trUtf8( 100 self.__projectAct.setWhatsThis(self.trUtf8(
101 """<b>Generate API file</b>""" 101 """<b>Generate API file</b>"""
102 """<p>Generate an API file using eric5-api.</p>""" 102 """<p>Generate an API file using eric5-api.</p>"""
103 )) 103 ))
104 self.connect(self.__projectAct, SIGNAL('triggered()'), self.__doEricapi) 104 self.connect(self.__projectAct, SIGNAL('triggered()'), self.__doEricapi)
105 e4App().getObject("Project").addE4Actions([self.__projectAct]) 105 e5App().getObject("Project").addE4Actions([self.__projectAct])
106 menu.addAction(self.__projectAct) 106 menu.addAction(self.__projectAct)
107 107
108 self.connect(e4App().getObject("Project"), SIGNAL("showMenu"), 108 self.connect(e5App().getObject("Project"), SIGNAL("showMenu"),
109 self.__projectShowMenu) 109 self.__projectShowMenu)
110 110
111 return None, True 111 return None, True
112 112
113 def deactivate(self): 113 def deactivate(self):
114 """ 114 """
115 Public method to deactivate this plugin. 115 Public method to deactivate this plugin.
116 """ 116 """
117 self.disconnect(e4App().getObject("Project"), SIGNAL("showMenu"), 117 self.disconnect(e5App().getObject("Project"), SIGNAL("showMenu"),
118 self.__projectShowMenu) 118 self.__projectShowMenu)
119 119
120 menu = e4App().getObject("Project").getMenu("Apidoc") 120 menu = e5App().getObject("Project").getMenu("Apidoc")
121 if menu: 121 if menu:
122 menu.removeAction(self.__projectAct) 122 menu.removeAction(self.__projectAct)
123 e4App().getObject("Project").removeE4Actions([self.__projectAct]) 123 e5App().getObject("Project").removeE4Actions([self.__projectAct])
124 self.__initialize() 124 self.__initialize()
125 125
126 def __projectShowMenu(self, menuName, menu): 126 def __projectShowMenu(self, menuName, menu):
127 """ 127 """
128 Private slot called, when the the project menu or a submenu is 128 Private slot called, when the the project menu or a submenu is
132 @param menu reference to the menu (QMenu) 132 @param menu reference to the menu (QMenu)
133 """ 133 """
134 if menuName == "Apidoc": 134 if menuName == "Apidoc":
135 if self.__projectAct is not None: 135 if self.__projectAct is not None:
136 self.__projectAct.setEnabled(\ 136 self.__projectAct.setEnabled(\
137 e4App().getObject("Project").getProjectLanguage() in \ 137 e5App().getObject("Project").getProjectLanguage() in \
138 ["Python", "Python3", "Ruby"]) 138 ["Python", "Python3", "Ruby"])
139 139
140 def __doEricapi(self): 140 def __doEricapi(self):
141 """ 141 """
142 Private slot to perform the eric5-api api generation. 142 Private slot to perform the eric5-api api generation.
143 """ 143 """
144 project = e4App().getObject("Project") 144 project = e5App().getObject("Project")
145 parms = project.getData('DOCUMENTATIONPARMS', "ERIC4API") 145 parms = project.getData('DOCUMENTATIONPARMS', "ERIC4API")
146 dlg = EricapiConfigDialog(project, parms) 146 dlg = EricapiConfigDialog(project, parms)
147 if dlg.exec_() == QDialog.Accepted: 147 if dlg.exec_() == QDialog.Accepted:
148 args, parms = dlg.generateParameters() 148 args, parms = dlg.generateParameters()
149 project.setData('DOCUMENTATIONPARMS', "ERIC4API", parms) 149 project.setData('DOCUMENTATIONPARMS', "ERIC4API", parms)

eric ide

mercurial