95 """ |
95 """ |
96 Public method to activate this plugin. |
96 Public method to activate this plugin. |
97 |
97 |
98 @return tuple of None and activation status (boolean) |
98 @return tuple of None and activation status (boolean) |
99 """ |
99 """ |
100 menu = e5App().getObject("Project").getMenu("Apidoc") |
100 menu = ericApp().getObject("Project").getMenu("Apidoc") |
101 if menu: |
101 if menu: |
102 self.__projectAct = E5Action( |
102 self.__projectAct = EricAction( |
103 self.tr('Generate API file (eric7_api)'), |
103 self.tr('Generate API file (eric7_api)'), |
104 self.tr('Generate &API file (eric7_api)'), 0, 0, |
104 self.tr('Generate &API file (eric7_api)'), 0, 0, |
105 self, 'doc_eric7_api') |
105 self, 'doc_eric7_api') |
106 self.__projectAct.setStatusTip(self.tr( |
106 self.__projectAct.setStatusTip(self.tr( |
107 'Generate an API file using eric7_api')) |
107 'Generate an API file using eric7_api')) |
108 self.__projectAct.setWhatsThis(self.tr( |
108 self.__projectAct.setWhatsThis(self.tr( |
109 """<b>Generate API file</b>""" |
109 """<b>Generate API file</b>""" |
110 """<p>Generate an API file using eric7_api.</p>""" |
110 """<p>Generate an API file using eric7_api.</p>""" |
111 )) |
111 )) |
112 self.__projectAct.triggered.connect(self.__doEricapi) |
112 self.__projectAct.triggered.connect(self.__doEricapi) |
113 e5App().getObject("Project").addE5Actions([self.__projectAct]) |
113 ericApp().getObject("Project").addEricActions([self.__projectAct]) |
114 menu.addAction(self.__projectAct) |
114 menu.addAction(self.__projectAct) |
115 |
115 |
116 e5App().getObject("Project").showMenu.connect(self.__projectShowMenu) |
116 ericApp().getObject("Project").showMenu.connect(self.__projectShowMenu) |
117 |
117 |
118 return None, True |
118 return None, True |
119 |
119 |
120 def deactivate(self): |
120 def deactivate(self): |
121 """ |
121 """ |
122 Public method to deactivate this plugin. |
122 Public method to deactivate this plugin. |
123 """ |
123 """ |
124 e5App().getObject("Project").showMenu.disconnect( |
124 ericApp().getObject("Project").showMenu.disconnect( |
125 self.__projectShowMenu) |
125 self.__projectShowMenu) |
126 |
126 |
127 menu = e5App().getObject("Project").getMenu("Apidoc") |
127 menu = ericApp().getObject("Project").getMenu("Apidoc") |
128 if menu: |
128 if menu: |
129 menu.removeAction(self.__projectAct) |
129 menu.removeAction(self.__projectAct) |
130 e5App().getObject("Project").removeE5Actions([self.__projectAct]) |
130 ericApp().getObject("Project").removeEricActions([self.__projectAct]) |
131 self.__initialize() |
131 self.__initialize() |
132 |
132 |
133 def __projectShowMenu(self, menuName, menu): |
133 def __projectShowMenu(self, menuName, menu): |
134 """ |
134 """ |
135 Private slot called, when the the project menu or a submenu is |
135 Private slot called, when the the project menu or a submenu is |
138 @param menuName name of the menu to be shown (string) |
138 @param menuName name of the menu to be shown (string) |
139 @param menu reference to the menu (QMenu) |
139 @param menu reference to the menu (QMenu) |
140 """ |
140 """ |
141 if menuName == "Apidoc" and self.__projectAct is not None: |
141 if menuName == "Apidoc" and self.__projectAct is not None: |
142 self.__projectAct.setEnabled( |
142 self.__projectAct.setEnabled( |
143 e5App().getObject("Project").getProjectLanguage() in |
143 ericApp().getObject("Project").getProjectLanguage() in |
144 ["Python", "Python3", "Ruby", "MicroPython"]) |
144 ["Python", "Python3", "Ruby", "MicroPython"]) |
145 |
145 |
146 def __doEricapi(self): |
146 def __doEricapi(self): |
147 """ |
147 """ |
148 Private slot to perform the eric7_api api generation. |
148 Private slot to perform the eric7_api api generation. |
153 eolTranslation = { |
153 eolTranslation = { |
154 '\r': 'cr', |
154 '\r': 'cr', |
155 '\n': 'lf', |
155 '\n': 'lf', |
156 '\r\n': 'crlf', |
156 '\r\n': 'crlf', |
157 } |
157 } |
158 project = e5App().getObject("Project") |
158 project = ericApp().getObject("Project") |
159 parms = project.getData('DOCUMENTATIONPARMS', "ERIC4API") |
159 parms = project.getData('DOCUMENTATIONPARMS', "ERIC4API") |
160 dlg = EricapiConfigDialog(project, parms) |
160 dlg = EricapiConfigDialog(project, parms) |
161 if dlg.exec() == QDialog.DialogCode.Accepted: |
161 if dlg.exec() == QDialog.DialogCode.Accepted: |
162 args, parms = dlg.generateParameters() |
162 args, parms = dlg.generateParameters() |
163 project.setData('DOCUMENTATIONPARMS', "ERIC4API", parms) |
163 project.setData('DOCUMENTATIONPARMS', "ERIC4API", parms) |