diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-02-05 21:21:36 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-02-05 21:21:36 +0100 |
commit | d7eef2c28eae2e43e3ade4441810ecc0cdea6fd7 (patch) | |
tree | dd2e998df9934a78201d23209ed7fbb2329a2820 /module/HookManager.py | |
parent | updated documentation + diagrams (diff) | |
download | pyload-d7eef2c28eae2e43e3ade4441810ecc0cdea6fd7.tar.xz |
option for internal plugins
Diffstat (limited to 'module/HookManager.py')
-rw-r--r-- | module/HookManager.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/module/HookManager.py b/module/HookManager.py index 0ad37b321..f3201738d 100644 --- a/module/HookManager.py +++ b/module/HookManager.py @@ -91,16 +91,23 @@ class HookManager: for pluginname in self.core.pluginManager.getPlugins("hooks"): try: - #hookClass = getattr(plugin, plugin.__name__) + # check first for builtin plugin + attrs = self.core.pluginManager.loadAttributes("hooks", pluginname) + internal = attrs.get("internal", False) - if self.core.config.get(pluginname, "activated"): + if internal or self.core.config.get(pluginname, "activated"): pluginClass = self.core.pluginManager.loadClass("hooks", pluginname) + if not pluginClass: continue plugin = pluginClass(self.core, self) self.plugins[pluginClass.__name__] = plugin - if plugin.isActivated(): + + # hide internals from printing + if not internal and plugin.isActivated(): active.append(pluginClass.__name__) + else: + self.log.debug("Loaded internal plugin: %s" % pluginClass.__name__) else: deactive.append(pluginname) @@ -149,6 +156,8 @@ class HookManager: else: hook = self.plugins[plugin] + if hook.__internal__: return + self.call(hook, "deactivate") self.log.debug("Plugin deactivated: %s" % plugin) |