From a0ae3ebfce826980d08f6e75ec62a48e39cd5b41 Mon Sep 17 00:00:00 2001 From: bendikro Date: Sun, 20 Jan 2013 11:04:10 +0100 Subject: [PATCH] Optimizations to torrentview.update_view A few changes that reduces the CPU usage of the GTK UI significantly. This small patch is made simple to be 100% certain not to introduce new bugs. --- deluge/ui/gtkui/torrentview.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 0634e465e..366dce88f 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -406,14 +406,17 @@ class TorrentView(listview.ListView, component.Component): filter_column = self.columns["filter"].column_indices[0] # Update the torrent view model with data we've received status = self.status + status_keys = status.keys() for row in self.liststore: torrent_id = row[self.columns["torrent_id"].column_indices[0]] - if not torrent_id in status.keys(): - row[filter_column] = False + if not torrent_id in status_keys: + if row[filter_column] is True: + row[filter_column] = False else: - row[filter_column] = True + if row[filter_column] is False: + row[filter_column] = True if torrent_id in self.prev_status and status[torrent_id] == self.prev_status[torrent_id]: # The status dict is the same, so do not update continue