[tor-commits] r24295: {arm} Adding config option for the connection panel refresh rate. (in arm/trunk: . src/interface/connections)

Damian Johnson atagar1 at gmail.com
Thu Mar 3 04:32:17 UTC 2011


Author: atagar
Date: 2011-03-03 04:32:17 +0000 (Thu, 03 Mar 2011)
New Revision: 24295

Modified:
   arm/trunk/armrc.sample
   arm/trunk/src/interface/connections/connPanel.py
Log:
Adding config option for the connection panel refresh rate.



Modified: arm/trunk/armrc.sample
===================================================================
--- arm/trunk/armrc.sample	2011-03-03 04:16:21 UTC (rev 24294)
+++ arm/trunk/armrc.sample	2011-03-03 04:32:17 UTC (rev 24295)
@@ -155,6 +155,11 @@
 # ---------------------------------
 # oldPanel
 #   includes the old connection panel in the interface
+# refreshRate
+#   rate at which the connection panel contents is redrawn (if higher than the
+#   connection resolution rate then reducing this won't casue new data to
+#   appear more frequently - just increase the rate at which the uptime field
+#   is updated)
 # newPanel
 #   includes the new connection panel in the interface
 # showColumn.*
@@ -162,6 +167,7 @@
 
 features.connection.oldPanel true
 features.connection.newPanel false
+features.connection.refreshRate 10
 features.connection.showColumn.fingerprint true
 features.connection.showColumn.nickname true
 features.connection.showColumn.destination true

Modified: arm/trunk/src/interface/connections/connPanel.py
===================================================================
--- arm/trunk/src/interface/connections/connPanel.py	2011-03-03 04:16:21 UTC (rev 24294)
+++ arm/trunk/src/interface/connections/connPanel.py	2011-03-03 04:32:17 UTC (rev 24295)
@@ -9,10 +9,8 @@
 from interface.connections import listings
 from util import connections, enum, log, panel, torTools, uiTools
 
-REDRAW_RATE = 10 # TODO: make a config option
+DEFAULT_CONFIG = {"features.connection.refreshRate": 10}
 
-DEFAULT_CONFIG = {}
-
 # height of the detail panel content, not counting top and bottom border
 DETAILS_HEIGHT = 7
 
@@ -33,7 +31,8 @@
     #self.sortOrdering = DEFAULT_SORT_ORDER
     self._config = dict(DEFAULT_CONFIG)
     if config:
-      config.update(self._config)
+      config.update(self._config, {
+        "features.connection.refreshRate": 1})
       
       # TODO: test and add to the sample armrc
       #self.sortOrdering = config.getIntCSV("features.connections.order", self.sortOrdering, 3, 0, 6)
@@ -99,7 +98,7 @@
     while not self._halt:
       currentTime = time.time()
       
-      if self._isPaused or currentTime - lastDraw < REDRAW_RATE:
+      if self._isPaused or currentTime - lastDraw < self._config["features.connection.refreshRate"]:
         self._cond.acquire()
         if not self._halt: self._cond.wait(0.2)
         self._cond.release()
@@ -107,7 +106,7 @@
         # updates content if their's new results, otherwise just redraws
         self._update()
         self.redraw(True)
-        lastDraw += REDRAW_RATE
+        lastDraw += self._config["features.connection.refreshRate"]
   
   def draw(self, width, height):
     self.valsLock.acquire()



More information about the tor-commits mailing list