als...
Content-type: text/plain

Author: damoxc

Revision: 5884

Log:
        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

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-10-27 11:16:55 UTC (rev 5883)
+++ branches/1.2_RC/ChangeLog   2009-10-27 11:39:53 UTC (rev 5884)
@@ -11,6 +11,7 @@
        * Fix setting file priorities when adding
        * HTML escape the field values on the details tab
        * Fix #215, make infinite eta values display in the correct order
+       * Fix displaying the protocol upload speed
 
 === Deluge 1.2.0_rc2 (25 October 2009) ===
 ==== GtkUI ====

Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.Statusbar.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.Statusbar.js        2009-10-27 
11:16:55 UTC (rev 5883)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.Statusbar.js        2009-10-27 
11:39:53 UTC (rev 5884)
@@ -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}'

Modified: branches/1.2_RC/deluge/ui/web/json_api.py
===================================================================
--- branches/1.2_RC/deluge/ui/web/json_api.py   2009-10-27 11:16:55 UTC (rev 
5883)
+++ branches/1.2_RC/deluge/ui/web/json_api.py   2009-10-27 11:39:53 UTC (rev 
5884)
@@ -473,11 +473,20 @@
         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 @@
         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)
+        
+        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], consumeErrors=True)
+        dl = DeferredList([d1, d2, d3, d4, d5, d6], consumeErrors=True)
         dl.addCallback(on_complete)
         return d
 

Modified: trunk/deluge/ui/web/js/Deluge.Statusbar.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Statusbar.js  2009-10-27 11:16:55 UTC (rev 
5883)
+++ trunk/deluge/ui/web/js/Deluge.Statusbar.js  2009-10-27 11:39:53 UTC (rev 
5884)
@@ -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}'

Modified: trunk/deluge/ui/web/json_api.py
===================================================================
--- trunk/deluge/ui/web/json_api.py     2009-10-27 11:16:55 UTC (rev 5883)
+++ trunk/deluge/ui/web/json_api.py     2009-10-27 11:39:53 UTC (rev 5884)
@@ -473,11 +473,20 @@
         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 @@
         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)
+        
+        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], consumeErrors=True)
+        dl = DeferredList([d1, d2, d3, d4, d5, d6], consumeErrors=True)
         dl.addCallback(on_complete)
         return d
 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to