Feature #1646: Add columns for per torrent upload and download speed limits

This commit is contained in:
runeks 2011-05-22 01:21:55 +01:00 committed by Calum Lind
parent 1f73476dc3
commit 766c48e3ca
2 changed files with 13 additions and 0 deletions

View File

@ -102,6 +102,15 @@ def cell_data_date(column, cell, model, row, data):
"""Display value as date, eg 05/05/08"""
cell.set_property('text', deluge.common.fdate(model.get_value(row, data)))
def cell_data_speed_limit(column, cell, model, row, data):
"""Display value as a speed, eg. 2 KiB/s"""
speed = model.get_value(row, data)
speed_str = ""
if speed > 0:
speed_str = deluge.common.fspeed(speed * 1024)
cell.set_property('text', speed_str)
class ListViewColumnState:
"""Used for saving/loading column state"""
def __init__(self, name, position, width, visible, sort, sort_order):

View File

@ -235,6 +235,10 @@ class TorrentView(listview.ListView, component.Component):
status_field=["download_payload_rate"])
self.add_func_column(_("Up Speed"), listview.cell_data_speed, [float],
status_field=["upload_payload_rate"])
self.add_func_column(_("Down Limit"), listview.cell_data_speed_limit, [float],
status_field=["max_download_speed"])
self.add_func_column(_("Up Limit"), listview.cell_data_speed_limit, [float],
status_field=["max_upload_speed"])
self.add_func_column(_("ETA"), listview.cell_data_time, [int],
status_field=["eta"], sort_func=eta_column_sort)
self.add_func_column(_("Ratio"), listview.cell_data_ratio, [float],