Changed the 'load external plug-ins' logic and enable this option upon installation of a plug-in, if it is switched off (needs a restart of eric).

Fri, 21 Aug 2015 14:16:37 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 21 Aug 2015 14:16:37 +0200
changeset 4378
d8f81e864816
parent 4376
7847a37ee71d
child 4380
d79c055a12cc

Changed the 'load external plug-ins' logic and enable this option upon installation of a plug-in, if it is switched off (needs a restart of eric).

PluginManager/PluginInstallDialog.py file | annotate | diff | comparison | revisions
PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
--- a/PluginManager/PluginInstallDialog.py	Wed Aug 19 11:00:48 2015 +0200
+++ b/PluginManager/PluginInstallDialog.py	Fri Aug 21 14:16:37 2015 +0200
@@ -211,6 +211,9 @@
         elif button == self.__finishButton:
             self.__finishButton.setEnabled(False)
             self.__installPlugins()
+            if not Preferences.getPluginManager("ActivateExternal"):
+                Preferences.setPluginManager("ActivateExternal", True)
+                self.__restartNeeded = True
             self.__closeButton.show()
             self.__cancelButton.hide()
     
--- a/PluginManager/PluginManager.py	Wed Aug 19 11:00:48 2015 +0200
+++ b/PluginManager/PluginManager.py	Fri Aug 21 14:16:37 2015 +0200
@@ -190,33 +190,29 @@
                         self.tr("Could not create a package for {0}.")
                             .format(self.__develPluginFile))
         
-        if Preferences.getPluginManager("ActivateExternal"):
-            fname = os.path.join(self.pluginDirs["user"], "__init__.py")
-            if not os.path.exists(fname):
-                if not os.path.exists(self.pluginDirs["user"]):
-                    os.mkdir(self.pluginDirs["user"], 0o755)
-                try:
-                    f = open(fname, "w")
-                    f.close()
-                except IOError:
-                    del self.pluginDirs["user"]
-            
-            if not os.path.exists(self.pluginDirs["global"]) and \
-               os.access(Utilities.getPythonModulesDirectory(), os.W_OK):
-                # create the global plugins directory
-                os.mkdir(self.pluginDirs["global"], 0o755)
-                fname = os.path.join(self.pluginDirs["global"], "__init__.py")
-                f = open(fname, "w", encoding="utf-8")
-                f.write('# -*- coding: utf-8 -*-' + "\n")
-                f.write("\n")
-                f.write('"""' + "\n")
-                f.write('Package containing the global plugins.' + "\n")
-                f.write('"""' + "\n")
+        fname = os.path.join(self.pluginDirs["user"], "__init__.py")
+        if not os.path.exists(fname):
+            if not os.path.exists(self.pluginDirs["user"]):
+                os.mkdir(self.pluginDirs["user"], 0o755)
+            try:
+                f = open(fname, "w")
                 f.close()
-            if not os.path.exists(self.pluginDirs["global"]):
-                del self.pluginDirs["global"]
-        else:
-            del self.pluginDirs["user"]
+            except IOError:
+                del self.pluginDirs["user"]
+        
+        if not os.path.exists(self.pluginDirs["global"]) and \
+           os.access(Utilities.getPythonModulesDirectory(), os.W_OK):
+            # create the global plugins directory
+            os.mkdir(self.pluginDirs["global"], 0o755)
+            fname = os.path.join(self.pluginDirs["global"], "__init__.py")
+            f = open(fname, "w", encoding="utf-8")
+            f.write('# -*- coding: utf-8 -*-' + "\n")
+            f.write("\n")
+            f.write('"""' + "\n")
+            f.write('Package containing the global plugins.' + "\n")
+            f.write('"""' + "\n")
+            f.close()
+        if not os.path.exists(self.pluginDirs["global"]):
             del self.pluginDirs["global"]
         
         if not os.path.exists(self.pluginDirs["eric6"]):
@@ -240,12 +236,13 @@
         
         self.__foundCoreModules = self.getPluginModules(
             self.pluginDirs["eric6"])
-        if "global" in self.pluginDirs:
-            self.__foundGlobalModules = \
-                self.getPluginModules(self.pluginDirs["global"])
-        if "user" in self.pluginDirs:
-            self.__foundUserModules = \
-                self.getPluginModules(self.pluginDirs["user"])
+        if Preferences.getPluginManager("ActivateExternal"):
+            if "global" in self.pluginDirs:
+                self.__foundGlobalModules = \
+                    self.getPluginModules(self.pluginDirs["global"])
+            if "user" in self.pluginDirs:
+                self.__foundUserModules = \
+                    self.getPluginModules(self.pluginDirs["user"])
         
         return len(self.__foundCoreModules + self.__foundGlobalModules +
                    self.__foundUserModules) > 0

eric ide

mercurial