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). 6_0_x

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 21 Aug 2015 14:16:37 +0200
branch
6_0_x
changeset 4379
2fadbed7d297
parent 4377
4bae1fa50c68
child 4381
bde46f229e2c

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).
(grafted from d8f81e8648169156e7afaeb1bf747dc757deefa5)

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
@@ -189,33 +189,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"]):
@@ -239,12 +235,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