From 63329e719916f8765c99a5a0c37276454976ecf4 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 20 Nov 2013 19:31:04 +0000 Subject: [PATCH] Fix #265 : Add new Remaining column --- deluge/core/torrent.py | 2 ++ deluge/ui/console/modes/alltorrents.py | 8 +++++++- deluge/ui/console/modes/column.py | 1 + deluge/ui/gtkui/torrentview.py | 8 +++++--- deluge/ui/web/js/deluge-all/Keys.js | 4 ++-- deluge/ui/web/js/deluge-all/TorrentGrid.js | 9 +++++++++ 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index bf833f0bf..ba04b7fd4 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -732,6 +732,7 @@ class Torrent(object): "total_seeds": lambda: self.status.num_complete, "total_uploaded": lambda: self.status.all_time_upload, "total_wanted": lambda: self.status.total_wanted, + "total_remaining": lambda: self.status.total_wanted - self.status.total_wanted_done, "tracker": lambda: self.status.current_tracker, "trackers": lambda: self.trackers, "tracker_status": lambda: self.tracker_status, @@ -753,6 +754,7 @@ class Torrent(object): "last_seen_complete": lambda: self.status.last_seen_complete, "name": self.get_name, "pieces": self._get_pieces_info, + } def get_name(self): diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py index 07633f7e4..8afcdbbee 100644 --- a/deluge/ui/console/modes/alltorrents.py +++ b/deluge/ui/console/modes/alltorrents.py @@ -162,6 +162,7 @@ DEFAULT_PREFS = { "show_savepath":False, "show_downloaded":False, "show_uploaded":False, + "show_remaining":False, "show_owner":False, "show_downloading_time":False, "show_seeding_time":False, @@ -182,6 +183,7 @@ DEFAULT_PREFS = { "savepath_width":15, "downloaded_width":13, "uploaded_width":13, + "remaining_width":13, "owner_width":10, "downloading_time_width":10, "seeding_time_width":10, @@ -206,7 +208,7 @@ column_pref_names = ["queue","name","size","state", "progress","seeders","peers", "downspeed","upspeed","eta", "ratio","avail","added","tracker", - "savepath","downloaded","uploaded", + "savepath","downloaded","uploaded", "remaining", "owner","downloading_time","seeding_time"] prefs_to_names = { @@ -227,6 +229,7 @@ prefs_to_names = { "savepath":"Save Path", "downloaded":"Downloaded", "uploaded":"Uploaded", + "remaining":"Remaining", "owner":"Owner", "seeding_time":"Seeding Time", "downloading_time":"Active Time" @@ -244,8 +247,10 @@ column_names_to_state_keys = { "savepath": "save_path", "uploaded": "total_uploaded", "downloaded": "all_time_download", + "remaining":"total_remaining", "seeding_time":"seeding_time", "downloading_time":"active_time" + } reverse_sort_fields = [ @@ -258,6 +263,7 @@ reverse_sort_fields = [ "time_added", "total_uploaded", "all_time_download", + "total_remaining", "progress", "ratio", "seeding_time", diff --git a/deluge/ui/console/modes/column.py b/deluge/ui/console/modes/column.py index 26d10f6be..4e6f92787 100644 --- a/deluge/ui/console/modes/column.py +++ b/deluge/ui/console/modes/column.py @@ -65,6 +65,7 @@ columns = { "Save Path":(("save_path",), None), "Downloaded":(("all_time_download",), deluge.common.fsize), "Uploaded":(("total_uploaded",), deluge.common.fsize), + "Remaining":(("total_remaining",), deluge.common.fsize), "Owner":(("owner",),None), "Active Time":(("active_time",), deluge.common.ftime), "Seeding Time":(("seeding_time",), deluge.common.ftime) diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index b642076a7..6cfc80a59 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -355,10 +355,12 @@ class TorrentView(listview.ListView, component.Component): self.add_func_column(_("Uploaded"), listview.cell_data_size, [gobject.TYPE_UINT64], status_field=["total_uploaded"], default=False) + self.add_func_column(_("Remaining"), listview.cell_data_size, [gobject.TYPE_UINT64], + status_field=["total_remaining"], default=False) self.add_progress_column(_("Progress"), - status_field=["progress", "state"], - col_types=[float, str], - function=cell_data_progress) + status_field=["progress", "state"], + col_types=[float, str], + function=cell_data_progress) self.add_func_column(_("Seeders"), listview.cell_data_peer, [int, int], status_field=["num_seeds", "total_seeds"], sort_func=seed_peer_column_sort, default=False) diff --git a/deluge/ui/web/js/deluge-all/Keys.js b/deluge/ui/web/js/deluge-all/Keys.js index 459e8bcfe..fa48a90d7 100644 --- a/deluge/ui/web/js/deluge-all/Keys.js +++ b/deluge/ui/web/js/deluge-all/Keys.js @@ -44,7 +44,7 @@ Deluge.Keys = { * 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', * 'is_auto_managed', 'time_added', 'tracker_host', 'save_path', * 'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed', - * 'seeds_peers_ratio'] + * 'seeds_peers_ratio', 'total_remaining'] */ Grid: [ 'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds', @@ -52,7 +52,7 @@ Deluge.Keys = { 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', 'is_auto_managed', 'time_added', 'tracker_host', 'save_path', 'last_seen_complete', 'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed', - 'seeds_peers_ratio' + 'seeds_peers_ratio', 'total_remaining' ], /** diff --git a/deluge/ui/web/js/deluge-all/TorrentGrid.js b/deluge/ui/web/js/deluge-all/TorrentGrid.js index 50be33b03..3be20814b 100644 --- a/deluge/ui/web/js/deluge-all/TorrentGrid.js +++ b/deluge/ui/web/js/deluge-all/TorrentGrid.js @@ -237,6 +237,13 @@ sortable: true, renderer: fsize, dataIndex: 'total_uploaded' + }, { + header: _('Remaining'), + hidden: true, + width: 75, + sortable: true, + renderer: fsize, + dataIndex: 'total_remaining' }, { header: _('Down Limit'), hidden: true, @@ -260,6 +267,7 @@ dataIndex: 'seeds_peers_ratio' }], + meta: { root: 'torrents', idProperty: 'id', @@ -283,6 +291,7 @@ {name: 'save_path'}, {name: 'total_done', type: 'int'}, {name: 'total_uploaded', type: 'int'}, + {name: 'total_remaining', type: 'int'}, {name: 'max_download_speed', type: 'int'}, {name: 'max_upload_speed', type: 'int'}, {name: 'seeds_peers_ratio', type: 'float'}