From 135a3d75f15de61504af9ab8e5e19075b48487c0 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 3 Jul 2008 23:52:27 +0000 Subject: [PATCH] Emit 'torrent_status_changed' signal to the clients --- deluge/core/torrentmanager.py | 8 ++++++++ deluge/ui/gtkui/signals.py | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 857b40557..24e6f6397 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -147,6 +147,8 @@ class TorrentManager(component.Component): self.on_alert_storage_moved) self.alerts.register_handler("torrent_resumed_alert", self.on_alert_torrent_resumed) + self.alerts.register_handler("state_changed_alert", + self.on_alert_state_changed) def start(self): # Get the pluginmanager reference @@ -701,3 +703,9 @@ class TorrentManager(component.Component): torrent = self.torrents[str(alert.handle.info_hash())] torrent.is_finished = torrent.handle.is_seed() torrent.update_state() + + def on_alert_state_changed(self, alert): + log.debug("on_alert_state_changed") + torrent_id = str(alert.handle.info_hash()) + component.get("SignalManager").emit("torrent_state_changed", torrent_id) + diff --git a/deluge/ui/gtkui/signals.py b/deluge/ui/gtkui/signals.py index db046f574..343fcddf1 100644 --- a/deluge/ui/gtkui/signals.py +++ b/deluge/ui/gtkui/signals.py @@ -72,6 +72,8 @@ class Signals(component.Component): self.new_version_available) self.receiver.connect_to_signal("args_from_external", self.args_from_external) + self.receiver.connect_to_signal("torrent_state_changed", + self.torrent_state_changed) def stop(self): try: @@ -143,4 +145,7 @@ class Signals(component.Component): log.debug("args_from_external: %s", value) import ipcinterface ipcinterface.process_args(value) + + def torrent_state_changed(self, value): + log.debug("torrent_state_changed: %s", value)