From 6705e871609bbca3701a016ff17407fba8f62d6a Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Fri, 13 Jul 2007 03:40:31 +0000 Subject: [PATCH] open up events to plugins - elpargo --- src/interface.py | 4 ++-- src/plugins.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/interface.py b/src/interface.py index 336f3e3ab..b5e1d40d3 100644 --- a/src/interface.py +++ b/src/interface.py @@ -848,7 +848,7 @@ class DelugeGTK: # Handle the events try: - self.manager.handle_events() + events=self.manager.handle_events() except core.SystemError, e: print "SystemError", e dialogs.show_popup_warning(self.window, _("You cannot move torrent to a different partition. Please fix your preferences")) @@ -863,7 +863,7 @@ class DelugeGTK: self.update_statusbar_and_tray() #Update any active plugins - self.plugins.update_active_plugins() + self.plugins.update_active_plugins(events) # Put the generated message into the statusbar # This gives plugins a chance to write to the diff --git a/src/plugins.py b/src/plugins.py index a87aa3479..785622ed9 100644 --- a/src/plugins.py +++ b/src/plugins.py @@ -93,12 +93,15 @@ class PluginManager: def configure_plugin(self, name): self.enabled_plugins[name].configure() - def update_active_plugins(self): + def update_active_plugins(self,events): for name in self.enabled_plugins.keys(): plugin = self.enabled_plugins[name] if 'update' in dir(plugin): plugin.update() - + #having two methods for not breaking compatibility + if 'notify' in dir(plugin): + plugin.notify(events) + def shutdown_all_plugins(self): for name in self.enabled_plugins.keys(): self.disable_plugin(name)