PluginExtensionCorba.py

Sat, 23 Dec 2023 19:43:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 19:43:44 +0100
changeset 53
d70c2a05a494
parent 52
ba2929194c7b
child 55
2f709d7a4a49
permissions
-rw-r--r--

Converted some source code documentation to the new style.

1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2
52
ba2929194c7b Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 46
diff changeset
3 # Copyright (c) 2022 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
4 #
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
5
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
6 """
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
7 Module implementing a plugin to add support for CORBA development.
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
8 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
9
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
10 import os
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
11
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
13
22
6d679ee089b1 Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
14 from eric7 import Preferences
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from eric7.EricWidgets import EricMessageBox
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16 from eric7.EricWidgets.EricApplication import ericApp
22
6d679ee089b1 Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
17 from eric7.SystemUtilities import OSUtilities
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
18 from ExtensionCorba import idlclbr
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
19 from ExtensionCorba.ProjectInterfacesBrowser import ProjectInterfacesBrowser
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
20
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21 # Start-Of-Header
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22 name = "Corba Extension Plugin"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
23 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
24 autoactivate = True
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
25 deactivateable = True
46
bd9f89d3bf8b - Added context menu entries to show the directory path of an item in an external file manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
26 version = "10.1.8"
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
27 className = "CorbaExtensionPlugin"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
28 packageName = "ExtensionCorba"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
29 shortDescription = "Support for the development of CORBA projects"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 longDescription = (
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
31 "This plugin adds support for the development of CORBA related projects."
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
32 )
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
33 needsRestart = False
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
34 pyqtApi = 2
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35 # End-Of-Header
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
36
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
37 error = ""
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
38
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
39 corbaExtensionPluginObject = None
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
40
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
41
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
42 def exeDisplayData():
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
43 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
44 Module function to support the display of some executable info.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
45
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46 @return dictionary containing the data to query the presence of
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 the executable
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
48 @rtype dict
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 global corbaExtensionPluginObject
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
52 if corbaExtensionPluginObject is None:
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
53 data = {
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
54 "programEntry": False,
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
55 "header": QCoreApplication.translate(
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
56 "CorbaExtensionPlugin", "CORBA IDL Compiler"
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
57 ),
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
58 "text": QCoreApplication.translate(
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
59 "CorbaExtensionPlugin", "CORBA Support plugin is not activated"
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
60 ),
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
61 "version": QCoreApplication.translate("CorbaExtensionPlugin", "(inactive)"),
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
62 }
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
63 else:
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
64 exe = corbaExtensionPluginObject.getPreferences("omniidl")
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
65 if not exe:
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
66 exe = "omniidl"
22
6d679ee089b1 Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 19
diff changeset
67 if OSUtilities.isWindowsPlatform():
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
68 exe += ".exe"
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
69
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
70 data = {
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
71 "programEntry": True,
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
72 "header": QCoreApplication.translate(
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
73 "CorbaExtensionPlugin", "CORBA IDL Compiler"
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
74 ),
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
75 "exe": exe,
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
76 "versionCommand": "-V",
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
77 "versionStartsWith": "omniidl",
35
feb9a283922b Fixed an issue causing the version of the IDL compiler not being detected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 33
diff changeset
78 "versionRe": None,
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
79 "versionPosition": -1,
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
80 "version": "",
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
81 "versionCleanup": None,
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
82 "exeModule": None,
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
83 }
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
84
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
85 return data
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
86
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
87
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
88 def getConfigData():
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
90 Module function returning data as required by the configuration dialog.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
91
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
92 @return dictionary containing the relevant data
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
93 @rtype dict
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
94 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
95 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
96
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
97 return {
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
98 "corbaPage": [
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
99 QCoreApplication.translate("CorbaExtensionPlugin", "CORBA"),
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
100 os.path.join("ExtensionCorba", "icons", "corba-{0}".format(iconSuffix)),
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
101 createCorbaPage,
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
102 None,
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
103 None,
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
104 ],
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
105 }
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
106
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
107
39
e033c7f0d45e Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
108 def createCorbaPage(configDlg): # noqa: U100
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
109 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
110 Module function to create the CORBA configuration page.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
111
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
112 @param configDlg reference to the configuration dialog
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
113 @type ConfigurationWidget
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
114 @return reference to the configuration page
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
115 @rtype CorbaPage
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
116 """
46
bd9f89d3bf8b - Added context menu entries to show the directory path of an item in an external file manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
117 from ExtensionCorba.ConfigurationPage.CorbaPage import CorbaPage # noqa: I102
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
118
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
119 global corbaExtensionPluginObject
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
120
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
121 page = CorbaPage(corbaExtensionPluginObject)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
122 return page
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
123
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
124
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
125 def prepareUninstall():
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
126 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
127 Module function to prepare for an un-installation.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
128 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
129 Preferences.getSettings().remove(CorbaExtensionPlugin.PreferencesKey)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
130
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
131
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
132 class CorbaExtensionPlugin(QObject):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
133 """
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
134 Class implementing a plugin to add support for CORBA development.
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
135 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
136
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
137 PreferencesKey = "Corba"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
138
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
139 def __init__(self, ui):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
140 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
141 Constructor
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
142
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
143 @param ui reference to the user interface object
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
144 @type UI.UserInterface
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
145 """
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
146 super().__init__(ui)
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
147 self.__ui = ui
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
148 self.__initialize()
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
149
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
150 self.__defaults = {
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
151 "omniidl": "",
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
152 }
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
153
6
dbc40938587e Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
154 self.__translator = None
dbc40938587e Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
155 self.__loadTranslator()
dbc40938587e Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
156
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
157 def __initialize(self):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
158 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
159 Private slot to (re)initialize the plugin.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
160 """
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
161 global corbaExtensionPluginObject
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
162 corbaExtensionPluginObject = None
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
163
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
164 self.__browser = None
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
165
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
166 def activate(self):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
167 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
168 Public method to activate this plug-in.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
169
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
170 @return tuple of None and activation status
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
171 @rtype bool
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
172 """
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
173 from eric7.QScintilla import Lexers
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
174 from eric7.Utilities import ClassBrowsers
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
175
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
176 global error, corbaExtensionPluginObject
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
177 error = "" # clear previous error
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
178
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
179 if self.__ui.versionIsNewer("22.12"):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
180 corbaExtensionPluginObject = self
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
181
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
182 self.__browser = ProjectInterfacesBrowser(self)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
183
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
184 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light"
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
185 Lexers.registerLexer(
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
186 "IDL",
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
187 self.tr("IDL"),
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
188 "dummy.idl",
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
189 self.getLexer,
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
190 [self.tr("Corba IDL Files (*.idl)")],
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
191 [self.tr("Corba IDL Files (*.idl)")],
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
192 ["*.idl"],
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
193 os.path.join("ExtensionCorba", "icons", "corba-{0}".format(iconSuffix)),
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
194 )
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
195
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
196 ClassBrowsers.registerClassBrowser(
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
197 "IDL", idlclbr.readmodule_ex, idlclbr.scan, self.getFileIcon, [".idl"]
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
198 )
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
199
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
200 return None, True
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
201 else:
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
202 EricMessageBox.warning(
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
203 self.__ui,
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
204 self.tr("CORBA Extension"),
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
205 self.tr(
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
206 "The CORBA extension cannot be activated because it requires eric7"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
207 " 23.1 or newer."
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
208 ),
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
209 )
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
210 error = self.tr(
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
211 "The CORBA extension cannot be activated because it requires eric7"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
212 " 23.1 or newer."
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
213 )
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
214
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
215 return None, False
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
216
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
217 def deactivate(self):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
218 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
219 Public method to deactivate this plug-in.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
220 """
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
221 from eric7.QScintilla import Lexers
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
222 from eric7.Utilities import ClassBrowsers
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
223
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
224 Lexers.unregisterLexer("IDL")
17
40f44cfcb661 Fixed an issue deactivating the plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
225 ClassBrowsers.unregisterClassBrowser("IDL")
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
226
2
68c017d640b0 Fixed a few issues detected during testing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
227 self.__browser.deactivate()
68c017d640b0 Fixed a few issues detected during testing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1
diff changeset
228
1
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
229 self.__initialize()
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
230
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
231 def __loadTranslator(self):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
232 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
233 Private method to load the translation file.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
234 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
235 if self.__ui is not None:
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
236 loc = self.__ui.getLocale()
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
237 if loc and loc != "C":
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
238 locale_dir = os.path.join(
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
239 os.path.dirname(__file__), "ExtensionCorba", "i18n"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
240 )
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
241 translation = "corba_{0}".format(loc)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
242 translator = QTranslator(None)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
243 loaded = translator.load(translation, locale_dir)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
244 if loaded:
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
245 self.__translator = translator
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
246 ericApp().installTranslator(self.__translator)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
247 else:
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
248 print(
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
249 "Warning: translation file '{0}' could not be"
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
250 " loaded.".format(translation)
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
251 )
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
252 print("Using default.")
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
253
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
254 def getPreferences(self, key):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
255 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
256 Public method to retrieve the various settings values.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
257
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
258 @param key the key of the value to get
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
259 @type str
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
260 @return the requested setting value
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
261 @rtype any
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
262 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
263 return Preferences.Prefs.settings.value(
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
264 self.PreferencesKey + "/" + key, self.__defaults[key]
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
265 )
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
266
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
267 def setPreferences(self, key, value):
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
268 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
269 Public method to store the various settings values.
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
270
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
271 @param key the key of the setting to be set
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
272 @type str
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
273 @param value the value to be set
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
274 @type any
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
275 """
d4384e4d7aff First incarnation of the CORBA IDL support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
276 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
277
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
278 def getLexer(self, parent=None):
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
279 """
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
280 Public method to instantiate a QScintilla CORBA IDL lexer object.
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
281
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
282 @param parent reference to the parent object
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
283 @type QObject
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
284 @return reference to the instanciated lexer object
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
285 @rtype QsciLexer
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
286 """
46
bd9f89d3bf8b - Added context menu entries to show the directory path of an item in an external file manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 39
diff changeset
287 from ExtensionCorba.LexerIDL import LexerIDL # noqa: I102
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
288
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
289 return LexerIDL(parent=parent)
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
290
39
e033c7f0d45e Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
291 def getFileIcon(self, filename=""): # noqa: U100
12
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
292 """
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
293 Public method to get the name of a file icon.
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
294
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
295 @param filename file name (defaults to "")
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
296 @type str (optional)
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
297 @return name of a file icon
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
298 @rtype str
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
299 """
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
300 iconSuffix = "dark" if ericApp().usesDarkPalette() else "light"
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
301 return os.path.join("ExtensionCorba", "icons", "corba-{0}".format(iconSuffix))
58b645cde6e3 Moved the IDL class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10
diff changeset
302
4
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
303
ff4fc402f193 Implemented some final changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2
diff changeset
304 #
39
e033c7f0d45e Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 37
diff changeset
305 # eflag: noqa = M801, U200

eric ide

mercurial