From 6dbadf877da47bb2c7a01dc12414e48559ff0616 Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Mon, 4 Feb 2008 20:26:11 +0000 Subject: [PATCH] mimic gtk status-bar->images --- deluge/ui/webui/webui_plugin/render.py | 6 ++++++ .../static/images/tango/connections.png | Bin 0 -> 456 bytes .../templates/advanced/part_stats.html | 17 +++++++++-------- deluge/ui/webui/webui_plugin/utils.py | 2 ++ 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 deluge/ui/webui/webui_plugin/static/images/tango/connections.png diff --git a/deluge/ui/webui/webui_plugin/render.py b/deluge/ui/webui/webui_plugin/render.py index f6fca2f94..c04ee42fc 100644 --- a/deluge/ui/webui/webui_plugin/render.py +++ b/deluge/ui/webui/webui_plugin/render.py @@ -115,6 +115,11 @@ def altrow(reset = False): irow = irow % 2 return "altrow%s" % irow +def deluge_int(val): + if val == -1 : + return _("Unlimited") + return val + template.Template.globals.update({ 'sort_head': template_sort_head, 'part_stats':template_part_stats, @@ -123,6 +128,7 @@ template.Template.globals.update({ '_': _ , #gettext/translations 'str': str, #because % in templetor is broken. 'int':int, + 'deluge_int':deluge_int, 'sorted': sorted, 'altrow':altrow, 'get_config': get_config, diff --git a/deluge/ui/webui/webui_plugin/static/images/tango/connections.png b/deluge/ui/webui/webui_plugin/static/images/tango/connections.png new file mode 100644 index 0000000000000000000000000000000000000000..b57c65c86a666d62dc2120e6410ddd6cfc142857 GIT binary patch literal 456 zcmV;(0XP1MP))` zICpaqaV&^KTSINZ*0wQ7;?Ncwnndx&yZ7Gjp1V)r6Pdkj9Y_!yXG%aZF*7|&I2!XT zR!h(5c`X@aKsXv>A$3hC@00Iq!5QIVsvB@#O0R#XK_eE^Gt5JejPqX_> zje=FH@FFH?cPyG8rc0yrSyeUSIfY>u=y{FGTdS9m0dO4W2SHUM%q<;y8r)rO0$?}Z zT{{?@03o_;@%XrlwNQA(?!jtD^Fvn{TB0mVyjB~uJD)ULZr0rKf!Ba(m%&r90#5gJ zSs8J$t}LfqosuMRlFMe4K~b$__@1<0uY2Z|{-$rwH+-)Epj}<~8l35QE&0ozPp7wb ycKr;JYpd&+rs>()X9au>D3{CpH -$if env == '0.6': - $:render.part_button('GET', '/config/', _('Settings'), 'tango/preferences-system.png') - -$_('Connections') : $stats.num_connections ($stats.max_num_connections) - -$_('Down Speed') : $stats.download_rate ($stats.max_download) - -$_('Up Speed') : $stats.upload_rate ($stats.max_upload) + $stats.num_connections ($deluge_int(stats.max_num_connections)) + + $stats.download_rate ($deluge_int(stats.max_download)) + + $stats.upload_rate ($deluge_int(stats.max_upload)) + +DHT: $stats.dht_nodes + +$:render.part_button('GET', '/config/', _('Settings'), 'tango/preferences-system.png') diff --git a/deluge/ui/webui/webui_plugin/utils.py b/deluge/ui/webui/webui_plugin/utils.py index e84e0d2ab..07d3f9d8b 100644 --- a/deluge/ui/webui/webui_plugin/utils.py +++ b/deluge/ui/webui/webui_plugin/utils.py @@ -122,6 +122,8 @@ def get_stats(): ws.async_proxy.get_num_connections(dict_cb("num_connections",stats)) ws.async_proxy.get_config_value(dict_cb('max_num_connections',stats) ,"max_connections_global") + ws.async_proxy.get_dht_nodes(dict_cb('dht_nodes',stats)) + ws.async_proxy.force_call(block=True)