summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruneks <runesvend@gmail.com>2011-05-22 00:21:55 (GMT)
committer Calum Lind <calumlind+deluge@gmail.com>2011-05-22 20:04:59 (GMT)
commit766c48e3ca573105991c3a6d40cb0b98dedd8539 (patch)
tree6ffcf8a50ff8793f765a9244e7fb877aeb0fb044
parent1f73476dc3e9bdb1de819771613e1f6b284feb19 (diff)
downloaddeluge-766c48e3ca573105991c3a6d40cb0b98dedd8539.zip
deluge-766c48e3ca573105991c3a6d40cb0b98dedd8539.tar.gz
deluge-766c48e3ca573105991c3a6d40cb0b98dedd8539.tar.bz2
Feature #1646: Add columns for per torrent upload and download speed limits
-rw-r--r--deluge/ui/gtkui/listview.py9
-rw-r--r--deluge/ui/gtkui/torrentview.py4
2 files changed, 13 insertions, 0 deletions
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index 11df17a..4227b57 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -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):
diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py
index 7428434..898bc38 100644
--- a/deluge/ui/gtkui/torrentview.py
+++ b/deluge/ui/gtkui/torrentview.py
@@ -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],