From cdf3011c813a2131220cbd1fe7221167bef40cbe Mon Sep 17 00:00:00 2001 From: Alex Dedul Date: Mon, 6 Aug 2007 04:02:42 +0000 Subject: [PATCH] Tweaks to Peers and Files tabs plugins to handle removal of torrents. Patch is from eternalswd, thanks. --- plugins/TorrentFiles/__init__.py | 6 ++++-- plugins/TorrentPeers/__init__.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/TorrentFiles/__init__.py b/plugins/TorrentFiles/__init__.py index 808d2c607..5a1ea5e86 100644 --- a/plugins/TorrentFiles/__init__.py +++ b/plugins/TorrentFiles/__init__.py @@ -41,7 +41,8 @@ class TorrentFiles: def __init__(self, path, core, interface): print "Loading TorrentFiles plugin..." self.parent = interface - + self.manager = core + tree_view = gtk.TreeView() scrolled_window = gtk.ScrolledWindow() scrolled_window.add(tree_view) @@ -73,7 +74,8 @@ class TorrentFiles: if tab_page == current_page: unique_id = self.parent.get_selected_torrent() - if unique_id is None: + if unique_id is None or \ + unique_id in self.manager.removed_unique_ids: # If no torrents added or more than one torrent selected self.tab_files.clear_file_store() self.tab_files.set_unique_id(None) diff --git a/plugins/TorrentPeers/__init__.py b/plugins/TorrentPeers/__init__.py index 5995fd9b7..3c8703b3c 100644 --- a/plugins/TorrentPeers/__init__.py +++ b/plugins/TorrentPeers/__init__.py @@ -41,6 +41,7 @@ class TorrentPeers: def __init__(self, path, core, interface): print "Loading TorrentPeers plugin..." self.parent = interface + self.manager = core self.config_file = deluge.common.CONFIG_DIR + "/peers.conf" self.config = deluge.pref.Preferences(self.config_file) try: @@ -139,7 +140,8 @@ class TorrentPeers: if tab_page == current_page: unique_id = self.parent.get_selected_torrent() - if unique_id is None: + if unique_id is None or \ + unique_id in self.manager.removed_unique_ids: #if no torrents added or more than one torrent selected self.tab_peers.clear_peer_store() self.tab_peers.set_unique_id(None)