12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator |
12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator |
13 |
13 |
14 from eric7 import Globals, Preferences |
14 from eric7 import Globals, Preferences |
15 from eric7.EricWidgets import EricMessageBox |
15 from eric7.EricWidgets import EricMessageBox |
16 from eric7.EricWidgets.EricApplication import ericApp |
16 from eric7.EricWidgets.EricApplication import ericApp |
|
17 from ExtensionCorba import idlclbr |
17 from ExtensionCorba.ProjectInterfacesBrowser import ProjectInterfacesBrowser |
18 from ExtensionCorba.ProjectInterfacesBrowser import ProjectInterfacesBrowser |
18 |
19 |
19 # Start-Of-Header |
20 # Start-Of-Header |
20 name = "Corba Extension Plugin" |
21 name = "Corba Extension Plugin" |
21 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
22 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
22 autoactivate = True |
23 autoactivate = True |
23 deactivateable = True |
24 deactivateable = True |
24 version = "10.0.2" |
25 version = "10.1.0" |
25 className = "CorbaExtensionPlugin" |
26 className = "CorbaExtensionPlugin" |
26 packageName = "ExtensionCorba" |
27 packageName = "ExtensionCorba" |
27 shortDescription = "Support for the development of CORBA projects" |
28 shortDescription = "Support for the development of CORBA projects" |
28 longDescription = ( |
29 longDescription = ( |
29 "This plugin adds support for the development of CORBA related projects." |
30 "This plugin adds support for the development of CORBA related projects." |
93 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light" |
94 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light" |
94 |
95 |
95 return { |
96 return { |
96 "corbaPage": [ |
97 "corbaPage": [ |
97 QCoreApplication.translate("CorbaExtensionPlugin", "CORBA"), |
98 QCoreApplication.translate("CorbaExtensionPlugin", "CORBA"), |
98 os.path.join( |
99 os.path.join("ExtensionCorba", "icons", "corba-{0}".format(iconSuffix)), |
99 "ExtensionCorba", "icons", "preferences-corba-{0}".format(iconSuffix) |
|
100 ), |
|
101 createCorbaPage, |
100 createCorbaPage, |
102 None, |
101 None, |
103 None, |
102 None, |
104 ], |
103 ], |
105 } |
104 } |
168 Public method to activate this plug-in. |
167 Public method to activate this plug-in. |
169 |
168 |
170 @return tuple of None and activation status |
169 @return tuple of None and activation status |
171 @rtype bool |
170 @rtype bool |
172 """ |
171 """ |
|
172 from eric7.QScintilla import Lexers |
|
173 from eric7.Utilities import ClassBrowsers |
|
174 |
173 global error, corbaExtensionPluginObject |
175 global error, corbaExtensionPluginObject |
174 error = "" # clear previous error |
176 error = "" # clear previous error |
175 |
177 |
176 if self.__ui.versionIsNewer("22.12"): |
178 if self.__ui.versionIsNewer("22.12"): |
177 corbaExtensionPluginObject = self |
179 corbaExtensionPluginObject = self |
178 |
180 |
179 self.__browser = ProjectInterfacesBrowser(self) |
181 self.__browser = ProjectInterfacesBrowser(self) |
|
182 |
|
183 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light" |
|
184 Lexers.registerLexer( |
|
185 "IDL", |
|
186 self.tr("IDL"), |
|
187 "dummy.idl", |
|
188 self.getLexer, |
|
189 [self.tr("Corba IDL Files (*.idl)")], |
|
190 [self.tr("Corba IDL Files (*.idl)")], |
|
191 ["*.idl"], |
|
192 os.path.join("ExtensionCorba", "icons", "corba-{0}".format(iconSuffix)), |
|
193 ) |
|
194 |
|
195 ClassBrowsers.registerClassBrowser( |
|
196 "IDL", idlclbr.readmodule_ex, idlclbr.scan, self.getFileIcon, [".idl"] |
|
197 ) |
180 |
198 |
181 return None, True |
199 return None, True |
182 else: |
200 else: |
183 EricMessageBox.warning( |
201 EricMessageBox.warning( |
184 self.__ui, |
202 self.__ui, |
197 |
215 |
198 def deactivate(self): |
216 def deactivate(self): |
199 """ |
217 """ |
200 Public method to deactivate this plug-in. |
218 Public method to deactivate this plug-in. |
201 """ |
219 """ |
|
220 from eric7.QScintilla import Lexers |
|
221 from eric7.Utilities import ClassBrowsers |
|
222 |
|
223 Lexers.unregisterLexer("IDL") |
|
224 ClassBrowsers.registerClassBrowser("IDL") |
|
225 |
202 self.__browser.deactivate() |
226 self.__browser.deactivate() |
203 |
227 |
204 self.__initialize() |
228 self.__initialize() |
205 |
229 |
206 def __loadTranslator(self): |
230 def __loadTranslator(self): |
248 @param value the value to be set |
272 @param value the value to be set |
249 @type any |
273 @type any |
250 """ |
274 """ |
251 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) |
275 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) |
252 |
276 |
|
277 def getLexer(self, parent=None): |
|
278 """ |
|
279 Public method to instantiate a QScintilla CORBA IDL lexer object. |
|
280 |
|
281 @param parent reference to the parent object |
|
282 @type QObject |
|
283 @return reference to the instanciated lexer object |
|
284 @rtype QsciLexer |
|
285 """ |
|
286 from ExtensionCorba.LexerIDL import LexerIDL |
|
287 |
|
288 return LexerIDL(parent=parent) |
|
289 |
|
290 def getFileIcon(self, filename=""): |
|
291 """ |
|
292 Public method to get the name of a file icon. |
|
293 |
|
294 @param filename file name (defaults to "") |
|
295 @type str (optional) |
|
296 @return name of a file icon |
|
297 @rtype str |
|
298 """ |
|
299 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light" |
|
300 return os.path.join("ExtensionCorba", "icons", "corba-{0}".format(iconSuffix)) |
|
301 |
253 |
302 |
254 # |
303 # |
255 # eflag: noqa = M801 |
304 # eflag: noqa = M801 |