Ticket #1646: speed_limit_column.patch

File speed_limit_column.patch, 1.8 KB (added by Rune K. Svendsen, 13 years ago)
  • deluge/ui/gtkui/listview.py

    diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
    index 9a2aed9..c233eb0 100644
    a b def cell_data_date(column, cell, model, row, data):  
    103103    """Display value as date, eg 05/05/08"""
    104104    cell.set_property('text', deluge.common.fdate(model.get_value(row, data)))
    105105
     106def cell_data_speed_limit(column, cell, model, row, data):
     107    """Display value as a speed, eg. 2 KiB/s"""
     108    speed = model.get_value(row, data)
     109    speed_str = ""
     110    if speed > 0:
     111        speed_str = "%s %s" % (
     112                speed, _("KiB/s"))
     113
     114    cell.set_property('text', speed_str)
     115
    106116class ListViewColumnState:
    107117    """Used for saving/loading column state"""
    108118    def __init__(self, name, position, width, visible, sort, sort_order):
  • deluge/ui/gtkui/torrentview.py

    diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py
    index 46d9dbc..9623112 100644
    a b def __init__(self):  
    231231                             status_field=["download_payload_rate"])
    232232        self.add_func_column(_("Up Speed"), listview.cell_data_speed, [float],
    233233                             status_field=["upload_payload_rate"])
     234        self.add_func_column(_("Down Limit"), listview.cell_data_speed_limit, [float],
     235                             status_field=["max_download_speed"])
     236        self.add_func_column(_("Up Limit"), listview.cell_data_speed_limit, [float],
     237                             status_field=["max_upload_speed"])
    234238        self.add_func_column(_("ETA"), listview.cell_data_time, [int],
    235239                             status_field=["eta"], sort_func=eta_column_sort)
    236240        self.add_func_column(_("Ratio"), listview.cell_data_ratio, [float],