diff options
-rw-r--r-- | docs/write_hooks.rst | 4 | ||||
-rw-r--r-- | module/HookManager.py | 15 | ||||
-rw-r--r-- | module/plugins/Hook.py | 1 |
3 files changed, 3 insertions, 17 deletions
diff --git a/docs/write_hooks.rst b/docs/write_hooks.rst index 351b9af39..a088a3ed3 100644 --- a/docs/write_hooks.rst +++ b/docs/write_hooks.rst @@ -23,7 +23,6 @@ All Hooks should start with something like this: :: __version__ = "0.1" __description__ = "Does really cool stuff" __config__ = [ ("activated" , "bool" , "Activated" , "True" ) ] - __threaded__ = ["downloadFinished"] __author_name__ = ("Me") __author_mail__ = ("me@has-no-mail.com") @@ -65,9 +64,6 @@ A basic excerpt would look like: :: def downloadFinished(self, pyfile): print "A Download just finished." -Another important feature to mention can be seen at the ``__threaded__`` parameter. Function names listed will be executed -in a thread, in order to not block the main thread. This should be used for all kind of longer processing tasks. - Another and more flexible and powerful way is to use event listener. All hook methods exists as event and very useful additional events are dispatched by the core. For a little overview look at :class:`HookManager <module.HookManager.HookManager>`. Keep in mind that you can define own events and other people may listen on them. diff --git a/module/HookManager.py b/module/HookManager.py index 9f173a79e..62e53e783 100644 --- a/module/HookManager.py +++ b/module/HookManager.py @@ -219,10 +219,7 @@ class HookManager: def downloadFinished(self, pyfile): for plugin in self.plugins: if plugin.isActivated(): - if "downloadFinished" in plugin.__threaded__: - self.startThread(plugin.downloadFinished, pyfile) - else: - plugin.downloadFinished(pyfile) + plugin.downloadFinished(pyfile) self.dispatchEvent("downloadFinished", pyfile) @@ -231,10 +228,7 @@ class HookManager: def downloadFailed(self, pyfile): for plugin in self.plugins: if plugin.isActivated(): - if "downloadFailed" in plugin.__threaded__: - self.startThread(plugin.downloadFinished, pyfile) - else: - plugin.downloadFailed(pyfile) + plugin.downloadFailed(pyfile) self.dispatchEvent("downloadFailed", pyfile) @@ -242,10 +236,7 @@ class HookManager: def packageFinished(self, package): for plugin in self.plugins: if plugin.isActivated(): - if "packageFinished" in plugin.__threaded__: - self.startThread(plugin.packageFinished, package) - else: - plugin.packageFinished(package) + plugin.packageFinished(package) self.dispatchEvent("packageFinished", package) diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index ef3d978a5..90b683d75 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -41,7 +41,6 @@ class Hook(Base): __name__ = "Hook" __version__ = "0.2" __type__ = "hook" - __threaded__ = [] __config__ = [("name", "type", "desc", "default")] __description__ = """Interface for hook""" __author_name__ = ("mkaay", "RaNaN") |