PluginManager/PluginManager.py

branch
maintenance
changeset 6273
0daf79d65080
parent 6267
350655a6c85f
child 6360
73033fa6a99c
equal deleted inserted replaced
6207:0a74c1efab70 6273:0daf79d65080
63 pluginActivated = pyqtSignal(str, object) 63 pluginActivated = pyqtSignal(str, object)
64 allPlugginsActivated = pyqtSignal() 64 allPlugginsActivated = pyqtSignal()
65 pluginAboutToBeDeactivated = pyqtSignal(str, object) 65 pluginAboutToBeDeactivated = pyqtSignal(str, object)
66 pluginDeactivated = pyqtSignal(str, object) 66 pluginDeactivated = pyqtSignal(str, object)
67 67
68 def __init__(self, parent=None, doLoadPlugins=True, develPlugin=None): 68 def __init__(self, parent=None, disabledPlugins=None, doLoadPlugins=True,
69 develPlugin=None):
69 """ 70 """
70 Constructor 71 Constructor
71 72
72 The Plugin Manager deals with three different plugin directories. 73 The Plugin Manager deals with three different plugin directories.
73 The first is the one, that is part of eric6 (eric6/Plugins). The 74 The first is the one, that is part of eric6 (eric6/Plugins). The
74 second one is the global plugin directory called 'eric6plugins', 75 second one is the global plugin directory called 'eric6plugins',
75 which is located inside the site-packages directory. The last one 76 which is located inside the site-packages directory. The last one
76 is the user plugin directory located inside the .eric6 directory 77 is the user plugin directory located inside the .eric6 directory
77 of the users home directory. 78 of the users home directory.
78 79
79 @param parent reference to the parent object (QObject) 80 @param parent reference to the parent object
80 @keyparam doLoadPlugins flag indicating, that plugins should 81 @type QObject
81 be loaded (boolean) 82 @param disabledPlugins list of plug-ins that have been disabled via
82 @keyparam develPlugin filename of a plugin to be loaded for 83 the command line parameters '--disable-plugin='
83 development (string) 84 @type list of str
85 @param doLoadPlugins flag indicating, that plug-ins should
86 be loaded
87 @type bool
88 @param develPlugin filename of a plug-in to be loaded for
89 development
90 @type str
84 @exception PluginPathError raised to indicate an invalid plug-in path 91 @exception PluginPathError raised to indicate an invalid plug-in path
85 @exception PluginModulesError raised to indicate the absence of 92 @exception PluginModulesError raised to indicate the absence of
86 plug-in modules 93 plug-in modules
87 """ 94 """
88 super(PluginManager, self).__init__(parent) 95 super(PluginManager, self).__init__(parent)
89 96
90 self.__ui = parent 97 self.__ui = parent
91 self.__develPluginFile = develPlugin 98 self.__develPluginFile = develPlugin
92 self.__develPluginName = None 99 self.__develPluginName = None
100 if disabledPlugins is not None:
101 self.__disabledPlugins = disabledPlugins[:]
102 else:
103 self.__disabledPlugins = []
93 104
94 self.__inactivePluginsKey = "PluginManager/InactivePlugins" 105 self.__inactivePluginsKey = "PluginManager/InactivePlugins"
95 106
96 self.pluginDirs = { 107 self.pluginDirs = {
97 "eric6": os.path.join(getConfig('ericDir'), "Plugins"), 108 "eric6": os.path.join(getConfig('ericDir'), "Plugins"),
529 Public method to activate all plugins having the "autoactivate" 540 Public method to activate all plugins having the "autoactivate"
530 attribute set to True. 541 attribute set to True.
531 """ 542 """
532 savedInactiveList = Preferences.Prefs.settings.value( 543 savedInactiveList = Preferences.Prefs.settings.value(
533 self.__inactivePluginsKey) 544 self.__inactivePluginsKey)
545 inactiveList = self.__disabledPlugins[:]
546 if savedInactiveList is not None:
547 inactiveList += [p for p in savedInactiveList
548 if p not in self.__disabledPlugins]
534 if self.__develPluginName is not None and \ 549 if self.__develPluginName is not None and \
535 savedInactiveList is not None and \ 550 self.__develPluginName in inactiveList:
536 self.__develPluginName in savedInactiveList: 551 inactiveList.remove(self.__develPluginName)
537 savedInactiveList.remove(self.__develPluginName)
538 names = sorted(self.__inactiveModules.keys()) 552 names = sorted(self.__inactiveModules.keys())
539 for name in names: 553 for name in names:
540 if savedInactiveList is None or name not in savedInactiveList: 554 if name not in inactiveList:
541 self.activatePlugin(name) 555 self.activatePlugin(name)
542 self.allPlugginsActivated.emit() 556 self.allPlugginsActivated.emit()
543 557
544 def activatePlugin(self, name, onDemand=False): 558 def activatePlugin(self, name, onDemand=False):
545 """ 559 """

eric ide

mercurial