summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2012-11-07 00:35:58 -0500
committerChase Sterling <chase.sterling@gmail.com>2012-11-07 00:35:58 -0500
commitb7ca968fae803eec2845276b888c7aeecb527909 (patch)
tree9d66eee05d79bd1d74cf06a3b0d67591f2a4dbc8
parent8f71b8d5c6eab187cb963a064629efcd88badf29 (diff)
downloaddeluge-b7ca968fae803eec2845276b888c7aeecb527909.zip
deluge-b7ca968fae803eec2845276b888c7aeecb527909.tar.gz
deluge-b7ca968fae803eec2845276b888c7aeecb527909.tar.bz2
Fix jitter in gtk torrent view.
-rw-r--r--ChangeLog1
-rw-r--r--deluge/ui/gtkui/listview.py22
2 files changed, 18 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index c8a4b28..880af4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
==== GtkUI ====
* Add move completed option to add torrent dialog
+ * Prevent jitter in torrent view
=== Deluge 1.3.5 (09 April 2012) ===
==== Core ====
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index 72613b3..d539d1a 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -233,13 +233,25 @@ class ListView:
self.set_sort_functions()
self.treeview.set_model(self.model_filter)
+ def stabilize_sort_func(self, sort_func):
+ def stabilized(model, iter1, iter2, data):
+ result = sort_func(model, iter1, iter2, data)
+ if result == 0:
+ # Compare by hash if main column values are equal
+ return cmp(model[iter1][1], model[iter2][1])
+ return result
+ return stabilized
+
+ def generic_sort_func(self, model, iter1, iter2, data):
+ return cmp(model[iter1][data], model[iter2][data])
+
def set_sort_functions(self):
for column in self.columns.values():
- if column.sort_func:
- self.model_filter.set_sort_func(
- column.sort_id,
- column.sort_func,
- column.sort_id)
+ sort_func = column.sort_func or self.generic_sort_func
+ self.model_filter.set_sort_func(
+ column.sort_id,
+ self.stabilize_sort_func(sort_func),
+ column.sort_id)
def create_column_state(self, column, position=None):
if not position: