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

This commit is contained in:
Calum Lind 2011-05-22 22:35:20 +01:00
parent 974f48380f
commit b0599313bc
2 changed files with 13 additions and 0 deletions

View File

@ -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):

View File

@ -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],