diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-12-19 23:10:49 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-12-19 23:10:49 +0100 |
commit | 6eae782f13953dd0ba2bbe1b582cf33fd4d7d90a (patch) | |
tree | a7e80bc89b1a523854e1f3e3d9ec945023193212 /module/HookManager.py | |
parent | pluginmanager cleanup (diff) | |
download | pyload-6eae782f13953dd0ba2bbe1b582cf33fd4d7d90a.tar.xz |
configparser v2, warning CONFIG will be DELETED.
Diffstat (limited to 'module/HookManager.py')
-rw-r--r-- | module/HookManager.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/module/HookManager.py b/module/HookManager.py index 8bfcadca6..e32508c48 100644 --- a/module/HookManager.py +++ b/module/HookManager.py @@ -50,8 +50,7 @@ class HookManager: allDownloadsProcessed Every link was handled, pyload would idle afterwards. allDownloadsFinished Every download in queue is finished. unrarFinished folder, fname An Unrar job finished - configChanged The config was changed via the api. - pluginConfigChanged The plugin config changed, due to api or internal process. + configChanged sec,opt,value The config was changed. ===================== ============== ================================== | Notes: @@ -74,14 +73,15 @@ class HookManager: self.events = {} # contains events - #registering callback for config event - self.config.pluginCB = MethodType(self.dispatchEvent, "pluginConfigChanged", basestring) - - self.addEvent("pluginConfigChanged", self.manageHooks) - self.lock = RLock() self.createIndex() + #registering callback for config event + self.config.changeCB = MethodType(self.dispatchEvent, "configChanged", basestring) + + # manage hooks an config change + self.addEvent("configChanged", self.manageHooks) + def try_catch(func): def new(*args): try: @@ -123,7 +123,7 @@ class HookManager: try: #hookClass = getattr(plugin, plugin.__name__) - if self.core.config.getPlugin(pluginname, "activated"): + if self.core.config.get(pluginname, "activated"): pluginClass = self.core.pluginManager.loadClass("hooks", pluginname) if not pluginClass: continue @@ -147,6 +147,11 @@ class HookManager: self.plugins = plugins def manageHooks(self, plugin, name, value): + + # check if section was a plugin + if plugin not in self.core.pluginManager.getPlugins("hooks"): + return + if name == "activated" and value: self.activateHook(plugin) elif name == "activated" and not value: |