Feature #1646: Add columns for per torrent upload and download speed limits
This commit is contained in:
parent
1f73476dc3
commit
766c48e3ca
|
@ -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):
|
||||
|
|
|
@ -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],
|
||||
|
|
Loading…
Reference in New Issue