From 6e1f089fc8658342bf5b165e7c2436144dc3bc35 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 13 Jun 2007 19:23:33 +0000 Subject: [PATCH] fix for not sorting correctly in file tab if sort column was not progress column --- src/interface.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/interface.py b/src/interface.py index e0ddb5c8e..1764c6413 100644 --- a/src/interface.py +++ b/src/interface.py @@ -516,6 +516,15 @@ class DelugeGTK: itr = self.file_store.iter_next(itr) self.manager.set_file_filter(self.get_selected_torrent(), file_filter) + def file_get_iter_from_name(self, name): + iter = self.file_store.get_iter_first() + while iter: + if self.file_store.get_value(iter, 1) == name: + return iter + iter = self.file_store.iter_next(iter) + + return None + def show_about_dialog(self, arg=None): dialogs.show_about_dialog() @@ -796,19 +805,17 @@ class DelugeGTK: new_file_info = self.manager.get_torrent_file_info(unique_id) - iter = self.file_store.get_iter_first() for file in new_file_info: - if iter != None: - if round(self.file_store.get_value(iter, 4),2) != round(file['progress'],2): - self.file_store.set_value(iter, 4, round(file['progress'],2)) - iter = self.file_store.iter_next(iter) + iter = self.file_get_iter_from_name(file['path']) + if (iter != None) and (round(self.file_store.get_value(iter, 4),2) != round(file['progress'],2)): + self.file_store.set_value(iter, 4, round(file['progress'],2)) return True else: pass - return True + return True def calc_share_ratio(self, unique_id, torrent_state): r = float(self.manager.calc_ratio(unique_id, torrent_state))