PluginExtensionCorba.py

changeset 4
ff4fc402f193
parent 2
68c017d640b0
child 6
dbc40938587e
--- a/PluginExtensionCorba.py	Sat Dec 03 18:18:00 2022 +0100
+++ b/PluginExtensionCorba.py	Sun Dec 04 15:02:16 2022 +0100
@@ -4,7 +4,7 @@
 #
 
 """
-Module documentation goes here.
+Module implementing a plugin to add support for CORBA development.
 """
 
 import os
@@ -47,24 +47,38 @@
     """
     global corbaExtensionPluginObject
 
-    exe = corbaExtensionPluginObject.getPreferences("omniidl")
-    if not exe:
-        exe = "omniidl"
-        if Globals.isWindowsPlatform():
-            exe += ".exe"
+    if corbaExtensionPluginObject is None:
+        data = {
+            "programEntry": False,
+            "header": QCoreApplication.translate(
+                "CorbaExtensionPlugin", "CORBA IDL Compiler"
+            ),
+            "text": QCoreApplication.translate(
+                "CorbaExtensionPlugin", "CORBA Support plugin is not activated"
+            ),
+            "version": QCoreApplication.translate("CorbaExtensionPlugin", "(inactive)"),
+        }
+    else:
+        exe = corbaExtensionPluginObject.getPreferences("omniidl")
+        if not exe:
+            exe = "omniidl"
+            if Globals.isWindowsPlatform():
+                exe += ".exe"
 
-    data = {
-        "programEntry": True,
-        "header": "CORBA IDL compiler",
-        "exe": exe,
-        "versionCommand": "-V",
-        "versionStartsWith": "omniidl",
-        "versionRe": "",
-        "versionPosition": -1,
-        "version": "",
-        "versionCleanup": None,
-        "exeModule": None,
-    }
+        data = {
+            "programEntry": True,
+            "header": QCoreApplication.translate(
+                "CorbaExtensionPlugin", "CORBA IDL Compiler"
+            ),
+            "exe": exe,
+            "versionCommand": "-V",
+            "versionStartsWith": "omniidl",
+            "versionRe": "",
+            "versionPosition": -1,
+            "version": "",
+            "versionCleanup": None,
+            "exeModule": None,
+        }
 
     return data
 
@@ -100,9 +114,9 @@
     @return reference to the configuration page
     @rtype CorbaPage
     """
-    global corbaExtensionPluginObject
+    from ExtensionCorba.ConfigurationPage.CorbaPage import CorbaPage
 
-    from ExtensionCorba.ConfigurationPage.CorbaPage import CorbaPage
+    global corbaExtensionPluginObject
 
     page = CorbaPage(corbaExtensionPluginObject)
     return page
@@ -117,7 +131,7 @@
 
 class CorbaExtensionPlugin(QObject):
     """
-    Class documentation goes here.
+    Class implementing a plugin to add support for CORBA development.
     """
 
     PreferencesKey = "Corba"
@@ -129,7 +143,7 @@
         @param ui reference to the user interface object
         @type UI.UserInterface
         """
-        super(CorbaExtensionPlugin, self).__init__(ui)
+        super().__init__(ui)
         self.__ui = ui
         self.__initialize()
 
@@ -141,6 +155,9 @@
         """
         Private slot to (re)initialize the plugin.
         """
+        global corbaExtensionPluginObject
+        corbaExtensionPluginObject = None
+
         self.__browser = None
 
     def activate(self):
@@ -229,3 +246,7 @@
         @type any
         """
         Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
+
+
+#
+# eflag: noqa = M801

eric ide

mercurial