mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
Fix #215 ETA sort order
This commit is contained in:
parent
475a880dd9
commit
5c26a4b1cf
2 changed files with 17 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
* Fix 'autostart localhost if needed' option
|
||||
* Fix starting plugins when the pluginmanager is started
|
||||
* Fix #799 translate connection status
|
||||
* Fix #215 ETA sort order
|
||||
|
||||
==== Core ====
|
||||
* Fix saving torrent state on fresh configs
|
||||
|
|
|
@ -133,6 +133,20 @@ def queue_column_sort(model, iter1, iter2, data):
|
|||
if v2 > v1:
|
||||
return -1
|
||||
|
||||
def eta_column_sort(model, iter1, iter2, data):
|
||||
v1 = model[iter1][data]
|
||||
v2 = model[iter2][data]
|
||||
if v1 == v2:
|
||||
return 0
|
||||
if v1 == 0:
|
||||
return 1
|
||||
if v2 == 0:
|
||||
return -1
|
||||
if v1 > v2:
|
||||
return 1
|
||||
if v2 > v1:
|
||||
return -1
|
||||
|
||||
class TorrentView(listview.ListView, component.Component):
|
||||
"""TorrentView handles the listing of torrents."""
|
||||
def __init__(self):
|
||||
|
@ -190,7 +204,8 @@ class TorrentView(listview.ListView, component.Component):
|
|||
self.add_func_column(_("ETA"),
|
||||
listview.cell_data_time,
|
||||
[int],
|
||||
status_field=["eta"])
|
||||
status_field=["eta"],
|
||||
sort_func=eta_column_sort)
|
||||
self.add_func_column(_("Ratio"),
|
||||
listview.cell_data_ratio,
|
||||
[float],
|
||||
|
|
Loading…
Add table
Reference in a new issue