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 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7*pj^6T^PXNr}OT51_lPs z0*}aI1_o{+5N5n|x9$%E0|R@Br>`sfH6{Tu7U?S|n%o%}7(+c>978Nl&z)rGeKyNi@?yb4oet+{ z=iGzWwi$Xnx*#S!%jM&--QVxMpSRopf$+?|xw0MtGU;9phK9zr-WF1yb;7*Qzo^ue zOmVP~N>(iO)p#;3@|w8$PFDsd-WGutC$5br4G%D~Fz|nO&Dp&=uqncS^KYNtrqIf#$S?-^m!zH2?>3Hu6lip%I-y}Nk+MSP$*BdgY9}M2e -$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)