PluginExtensionCorba.py

changeset 4
ff4fc402f193
parent 2
68c017d640b0
child 6
dbc40938587e
equal deleted inserted replaced
3:80d79fc9653c 4:ff4fc402f193
2 2
3 # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module documentation goes here. 7 Module implementing a plugin to add support for CORBA development.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator 12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator
45 the executable 45 the executable
46 @rtype dict 46 @rtype dict
47 """ 47 """
48 global corbaExtensionPluginObject 48 global corbaExtensionPluginObject
49 49
50 exe = corbaExtensionPluginObject.getPreferences("omniidl") 50 if corbaExtensionPluginObject is None:
51 if not exe: 51 data = {
52 exe = "omniidl" 52 "programEntry": False,
53 if Globals.isWindowsPlatform(): 53 "header": QCoreApplication.translate(
54 exe += ".exe" 54 "CorbaExtensionPlugin", "CORBA IDL Compiler"
55 55 ),
56 data = { 56 "text": QCoreApplication.translate(
57 "programEntry": True, 57 "CorbaExtensionPlugin", "CORBA Support plugin is not activated"
58 "header": "CORBA IDL compiler", 58 ),
59 "exe": exe, 59 "version": QCoreApplication.translate("CorbaExtensionPlugin", "(inactive)"),
60 "versionCommand": "-V", 60 }
61 "versionStartsWith": "omniidl", 61 else:
62 "versionRe": "", 62 exe = corbaExtensionPluginObject.getPreferences("omniidl")
63 "versionPosition": -1, 63 if not exe:
64 "version": "", 64 exe = "omniidl"
65 "versionCleanup": None, 65 if Globals.isWindowsPlatform():
66 "exeModule": None, 66 exe += ".exe"
67 } 67
68 data = {
69 "programEntry": True,
70 "header": QCoreApplication.translate(
71 "CorbaExtensionPlugin", "CORBA IDL Compiler"
72 ),
73 "exe": exe,
74 "versionCommand": "-V",
75 "versionStartsWith": "omniidl",
76 "versionRe": "",
77 "versionPosition": -1,
78 "version": "",
79 "versionCleanup": None,
80 "exeModule": None,
81 }
68 82
69 return data 83 return data
70 84
71 85
72 def getConfigData(): 86 def getConfigData():
98 @param configDlg reference to the configuration dialog 112 @param configDlg reference to the configuration dialog
99 @type ConfigurationWidget 113 @type ConfigurationWidget
100 @return reference to the configuration page 114 @return reference to the configuration page
101 @rtype CorbaPage 115 @rtype CorbaPage
102 """ 116 """
117 from ExtensionCorba.ConfigurationPage.CorbaPage import CorbaPage
118
103 global corbaExtensionPluginObject 119 global corbaExtensionPluginObject
104
105 from ExtensionCorba.ConfigurationPage.CorbaPage import CorbaPage
106 120
107 page = CorbaPage(corbaExtensionPluginObject) 121 page = CorbaPage(corbaExtensionPluginObject)
108 return page 122 return page
109 123
110 124
115 Preferences.getSettings().remove(CorbaExtensionPlugin.PreferencesKey) 129 Preferences.getSettings().remove(CorbaExtensionPlugin.PreferencesKey)
116 130
117 131
118 class CorbaExtensionPlugin(QObject): 132 class CorbaExtensionPlugin(QObject):
119 """ 133 """
120 Class documentation goes here. 134 Class implementing a plugin to add support for CORBA development.
121 """ 135 """
122 136
123 PreferencesKey = "Corba" 137 PreferencesKey = "Corba"
124 138
125 def __init__(self, ui): 139 def __init__(self, ui):
127 Constructor 141 Constructor
128 142
129 @param ui reference to the user interface object 143 @param ui reference to the user interface object
130 @type UI.UserInterface 144 @type UI.UserInterface
131 """ 145 """
132 super(CorbaExtensionPlugin, self).__init__(ui) 146 super().__init__(ui)
133 self.__ui = ui 147 self.__ui = ui
134 self.__initialize() 148 self.__initialize()
135 149
136 self.__defaults = { 150 self.__defaults = {
137 "omniidl": "", 151 "omniidl": "",
139 153
140 def __initialize(self): 154 def __initialize(self):
141 """ 155 """
142 Private slot to (re)initialize the plugin. 156 Private slot to (re)initialize the plugin.
143 """ 157 """
158 global corbaExtensionPluginObject
159 corbaExtensionPluginObject = None
160
144 self.__browser = None 161 self.__browser = None
145 162
146 def activate(self): 163 def activate(self):
147 """ 164 """
148 Public method to activate this plug-in. 165 Public method to activate this plug-in.
227 @type str 244 @type str
228 @param value the value to be set 245 @param value the value to be set
229 @type any 246 @type any
230 """ 247 """
231 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) 248 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
249
250
251 #
252 # eflag: noqa = M801

eric ide

mercurial