Fix #265 : Add new Remaining column

This commit is contained in:
Calum Lind 2013-11-20 19:31:04 +00:00
commit 63329e7199
6 changed files with 26 additions and 6 deletions

View file

@ -732,6 +732,7 @@ class Torrent(object):
"total_seeds": lambda: self.status.num_complete, "total_seeds": lambda: self.status.num_complete,
"total_uploaded": lambda: self.status.all_time_upload, "total_uploaded": lambda: self.status.all_time_upload,
"total_wanted": lambda: self.status.total_wanted, "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, "tracker": lambda: self.status.current_tracker,
"trackers": lambda: self.trackers, "trackers": lambda: self.trackers,
"tracker_status": lambda: self.tracker_status, "tracker_status": lambda: self.tracker_status,
@ -753,6 +754,7 @@ class Torrent(object):
"last_seen_complete": lambda: self.status.last_seen_complete, "last_seen_complete": lambda: self.status.last_seen_complete,
"name": self.get_name, "name": self.get_name,
"pieces": self._get_pieces_info, "pieces": self._get_pieces_info,
} }
def get_name(self): def get_name(self):

View file

@ -162,6 +162,7 @@ DEFAULT_PREFS = {
"show_savepath":False, "show_savepath":False,
"show_downloaded":False, "show_downloaded":False,
"show_uploaded":False, "show_uploaded":False,
"show_remaining":False,
"show_owner":False, "show_owner":False,
"show_downloading_time":False, "show_downloading_time":False,
"show_seeding_time":False, "show_seeding_time":False,
@ -182,6 +183,7 @@ DEFAULT_PREFS = {
"savepath_width":15, "savepath_width":15,
"downloaded_width":13, "downloaded_width":13,
"uploaded_width":13, "uploaded_width":13,
"remaining_width":13,
"owner_width":10, "owner_width":10,
"downloading_time_width":10, "downloading_time_width":10,
"seeding_time_width":10, "seeding_time_width":10,
@ -206,7 +208,7 @@ column_pref_names = ["queue","name","size","state",
"progress","seeders","peers", "progress","seeders","peers",
"downspeed","upspeed","eta", "downspeed","upspeed","eta",
"ratio","avail","added","tracker", "ratio","avail","added","tracker",
"savepath","downloaded","uploaded", "savepath","downloaded","uploaded", "remaining",
"owner","downloading_time","seeding_time"] "owner","downloading_time","seeding_time"]
prefs_to_names = { prefs_to_names = {
@ -227,6 +229,7 @@ prefs_to_names = {
"savepath":"Save Path", "savepath":"Save Path",
"downloaded":"Downloaded", "downloaded":"Downloaded",
"uploaded":"Uploaded", "uploaded":"Uploaded",
"remaining":"Remaining",
"owner":"Owner", "owner":"Owner",
"seeding_time":"Seeding Time", "seeding_time":"Seeding Time",
"downloading_time":"Active Time" "downloading_time":"Active Time"
@ -244,8 +247,10 @@ column_names_to_state_keys = {
"savepath": "save_path", "savepath": "save_path",
"uploaded": "total_uploaded", "uploaded": "total_uploaded",
"downloaded": "all_time_download", "downloaded": "all_time_download",
"remaining":"total_remaining",
"seeding_time":"seeding_time", "seeding_time":"seeding_time",
"downloading_time":"active_time" "downloading_time":"active_time"
} }
reverse_sort_fields = [ reverse_sort_fields = [
@ -258,6 +263,7 @@ reverse_sort_fields = [
"time_added", "time_added",
"total_uploaded", "total_uploaded",
"all_time_download", "all_time_download",
"total_remaining",
"progress", "progress",
"ratio", "ratio",
"seeding_time", "seeding_time",

View file

@ -65,6 +65,7 @@ columns = {
"Save Path":(("save_path",), None), "Save Path":(("save_path",), None),
"Downloaded":(("all_time_download",), deluge.common.fsize), "Downloaded":(("all_time_download",), deluge.common.fsize),
"Uploaded":(("total_uploaded",), deluge.common.fsize), "Uploaded":(("total_uploaded",), deluge.common.fsize),
"Remaining":(("total_remaining",), deluge.common.fsize),
"Owner":(("owner",),None), "Owner":(("owner",),None),
"Active Time":(("active_time",), deluge.common.ftime), "Active Time":(("active_time",), deluge.common.ftime),
"Seeding Time":(("seeding_time",), deluge.common.ftime) "Seeding Time":(("seeding_time",), deluge.common.ftime)

View file

@ -355,10 +355,12 @@ class TorrentView(listview.ListView, component.Component):
self.add_func_column(_("Uploaded"), listview.cell_data_size, self.add_func_column(_("Uploaded"), listview.cell_data_size,
[gobject.TYPE_UINT64], [gobject.TYPE_UINT64],
status_field=["total_uploaded"], default=False) 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"), self.add_progress_column(_("Progress"),
status_field=["progress", "state"], status_field=["progress", "state"],
col_types=[float, str], col_types=[float, str],
function=cell_data_progress) function=cell_data_progress)
self.add_func_column(_("Seeders"), listview.cell_data_peer, [int, int], self.add_func_column(_("Seeders"), listview.cell_data_peer, [int, int],
status_field=["num_seeds", "total_seeds"], status_field=["num_seeds", "total_seeds"],
sort_func=seed_peer_column_sort, default=False) sort_func=seed_peer_column_sort, default=False)

View file

@ -44,7 +44,7 @@ Deluge.Keys = {
* 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', * 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies',
* 'is_auto_managed', 'time_added', 'tracker_host', 'save_path', * 'is_auto_managed', 'time_added', 'tracker_host', 'save_path',
* 'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed', * 'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed',
* 'seeds_peers_ratio']</pre> * 'seeds_peers_ratio', 'total_remaining']</pre>
*/ */
Grid: [ Grid: [
'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds', 'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
@ -52,7 +52,7 @@ Deluge.Keys = {
'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies',
'is_auto_managed', 'time_added', 'tracker_host', 'save_path', 'last_seen_complete', 'is_auto_managed', 'time_added', 'tracker_host', 'save_path', 'last_seen_complete',
'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed', 'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed',
'seeds_peers_ratio' 'seeds_peers_ratio', 'total_remaining'
], ],
/** /**

View file

@ -237,6 +237,13 @@
sortable: true, sortable: true,
renderer: fsize, renderer: fsize,
dataIndex: 'total_uploaded' dataIndex: 'total_uploaded'
}, {
header: _('Remaining'),
hidden: true,
width: 75,
sortable: true,
renderer: fsize,
dataIndex: 'total_remaining'
}, { }, {
header: _('Down Limit'), header: _('Down Limit'),
hidden: true, hidden: true,
@ -260,6 +267,7 @@
dataIndex: 'seeds_peers_ratio' dataIndex: 'seeds_peers_ratio'
}], }],
meta: { meta: {
root: 'torrents', root: 'torrents',
idProperty: 'id', idProperty: 'id',
@ -283,6 +291,7 @@
{name: 'save_path'}, {name: 'save_path'},
{name: 'total_done', type: 'int'}, {name: 'total_done', type: 'int'},
{name: 'total_uploaded', type: 'int'}, {name: 'total_uploaded', type: 'int'},
{name: 'total_remaining', type: 'int'},
{name: 'max_download_speed', type: 'int'}, {name: 'max_download_speed', type: 'int'},
{name: 'max_upload_speed', type: 'int'}, {name: 'max_upload_speed', type: 'int'},
{name: 'seeds_peers_ratio', type: 'float'} {name: 'seeds_peers_ratio', type: 'float'}