From ec1c5cf2c78adc1710f7ab49bcf38ac5a9b3f482 Mon Sep 17 00:00:00 2001 From: Alex Dedul Date: Mon, 6 Aug 2007 04:37:11 +0000 Subject: [PATCH] Tweaks to the Peers plugin. --- plugins/TorrentPeers/__init__.py | 14 +++++--------- plugins/TorrentPeers/tab_peers.py | 6 ------ src/dgtk.py | 3 +++ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/plugins/TorrentPeers/__init__.py b/plugins/TorrentPeers/__init__.py index 3c8703b3c..e61313f20 100644 --- a/plugins/TorrentPeers/__init__.py +++ b/plugins/TorrentPeers/__init__.py @@ -117,8 +117,7 @@ class TorrentPeers: self.tab_peers.clear_flag_cache() self.tab_peers.set_flag_size("25x15") else: - self.tab_peers.disable_flags() - + self.tab_peers.disable_flags() def toggle_ui(self, widget): if not self.dialog_initialize: @@ -155,13 +154,10 @@ class TorrentPeers: def ok_pressed(self, src): self.dialog.hide() - if self.config.get("enable_flags") and not \ - self.glade.get_widget("chk_flags").get_active(): - self.tab_peers.clear_peer_store() - self.tab_peers.rebuild_peer_view(self.top_widget) - self.tab_peers.update_peer_store() - self.config.set("enable_flags", self.glade.get_widget("chk_flags").get_active()) - self.config.set("size_18", self.glade.get_widget("radio_18").get_active()) + self.config.set("enable_flags", + self.glade.get_widget("chk_flags").get_active()) + self.config.set("size_18", + self.glade.get_widget("radio_18").get_active()) self.update_config() def cancel_pressed(self, src): diff --git a/plugins/TorrentPeers/tab_peers.py b/plugins/TorrentPeers/tab_peers.py index 0b99df8a0..efe60c1e9 100644 --- a/plugins/TorrentPeers/tab_peers.py +++ b/plugins/TorrentPeers/tab_peers.py @@ -22,16 +22,10 @@ class PeersTabManager(object): def clear_peer_store(self): self.peer_store.clear() self.peer_store_dict = {} - self.peer_unique_id = None def set_unique_id(self, unique_id): self.peer_unique_id = unique_id - def rebuild_peers_view(self, top_widget): - self.peer_view.destroy() - self.peer_view = gtk.TreeView() - top_widget.add(self.peer_view) - def build_peers_view(self): def percent(column, cell, model, iter, data): percent = float(model.get_value(iter, data)) diff --git a/src/dgtk.py b/src/dgtk.py index 64f89c338..e524c6b55 100644 --- a/src/dgtk.py +++ b/src/dgtk.py @@ -132,6 +132,9 @@ def add_texticon_column(view, header, icon_col, text_col): column.set_expand(False) column.set_min_width(10) column.set_reorderable(True) + # gtk.TREE_VIEW_COLUMN_AUTOSIZE is because of toggled flags in Peers tab + # in IP Address column. + column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) render = gtk.CellRendererPixbuf() column.pack_start(render, expand=False) column.add_attribute(render, 'pixbuf', icon_col)