From b8270be10fa415e40e2a74c6bf7dd45e01146b48 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 24 Mar 2010 13:29:41 -0700 Subject: [PATCH] Add ability for plugins to set their component update interval by setting a 'update_interval' value in their object. --- deluge/plugins/pluginbase.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/plugins/pluginbase.py b/deluge/plugins/pluginbase.py index f6fae5e25..451ce58d7 100644 --- a/deluge/plugins/pluginbase.py +++ b/deluge/plugins/pluginbase.py @@ -37,6 +37,10 @@ import deluge.component as component from deluge.log import LOG as log class PluginBase(component.Component): + def __init__(self, name): + interval = self.update_interval if hasattr(self, update_interval) else 1 + super(PluginBase, self).__init__(name, interval) + def enable(self): raise NotImplementedError("Need to define an enable method!") @@ -45,7 +49,7 @@ class PluginBase(component.Component): class CorePluginBase(PluginBase): def __init__(self, plugin_name): - super(CorePluginBase, self).__init__("CorePlugin." + plugin_name) + super(PluginBase, self).__init__("CorePlugin." + plugin_name) # Register RPC methods component.get("RPCServer").register_object(self, plugin_name.lower()) log.debug("CorePlugin initialized..")