Feature #1646: Add columns for per torrent upload and download speed limits
This commit is contained in:
parent
974f48380f
commit
b0599313bc
|
@ -111,6 +111,15 @@ def cell_data_date_or_never(column, cell, model, row, data):
|
|||
else:
|
||||
cell.set_property('text', _("Never"))
|
||||
|
||||
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):
|
||||
|
|
|
@ -239,6 +239,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