fix displaying the protocol speed in the webui

also update the update_ui method in json_api so it gets the status more like how the gtkui does
This commit is contained in:
Damien Churchill 2009-10-27 11:39:53 +00:00
parent d27d7c6733
commit d6e18f7729
2 changed files with 25 additions and 6 deletions

View File

@ -120,11 +120,11 @@
updateStat('traffic', {
value: {
value: stats.download_rate - stats.payload_download_rate,
value: stats.download_protocol_rate,
formatter: Deluge.Formatters.speed
},
limit: {
value: stats.upload_rate - stats.payload_upload_rate,
value: stats.upload_protocol_rate,
formatter: Deluge.Formatters.speed
},
format: '{0}/{1}'

View File

@ -473,12 +473,21 @@ class WebApi(JSONComponent):
def got_connections(connections):
ui_info["stats"]["num_connections"] = connections
def got_dht_nodes(nodes):
ui_info["stats"]["dht_nodes"] = nodes
def got_stats(stats):
ui_info["stats"].update(stats)
ui_info["stats"]["upload_rate"] = stats["payload_upload_rate"]
ui_info["stats"]["download_rate"] = stats["payload_download_rate"]
ui_info["stats"]["download_protocol_rate"] = stats["download_rate"] - stats["payload_download_rate"]
ui_info["stats"]["upload_protocol_rate"] = stats["upload_rate"] - stats["payload_upload_rate"]
def got_filters(filters):
ui_info["filters"] = filters
def got_health(health):
ui_info["stats"]["has_incoming_connections"] = health
def got_torrents(torrents):
ui_info["torrents"] = torrents
@ -491,14 +500,24 @@ class WebApi(JSONComponent):
d2 = client.core.get_filter_tree()
d2.addCallback(got_filters)
d3 = client.core.get_session_status(["payload_download_rate", "payload_upload_rate",
"dht_nodes", "has_incoming_connections", "download_rate", "upload_rate"])
d3 = client.core.get_session_status([
"payload_download_rate",
"payload_upload_rate",
"download_rate",
"upload_rate"
])
d3.addCallback(got_stats)
d4 = client.core.get_num_connections()
d4.addCallback(got_connections)
dl = DeferredList([d1, d2, d3, d4], consumeErrors=True)
d5 = client.core.get_dht_nodes()
d5.addCallback(got_dht_nodes)
d6 = client.core.get_health()
d6.addCallback(got_health)
dl = DeferredList([d1, d2, d3, d4, d5, d6], consumeErrors=True)
dl.addCallback(on_complete)
return d