[or-cvs] r23393: {arm} fix: redrawing the log panel if the content height estimate (in arm/trunk/src: interface util)

Damian Johnson atagar1 at gmail.com
Sat Oct 2 22:36:42 UTC 2010


Author: atagar
Date: 2010-10-02 22:36:42 +0000 (Sat, 02 Oct 2010)
New Revision: 23393

Modified:
   arm/trunk/src/interface/controller.py
   arm/trunk/src/interface/logPanel.py
   arm/trunk/src/util/conf.py
Log:
fix: redrawing the log panel if the content height estimate is too far off (fixing numerous display bugs)
fix: refactoring error caused the help popup to crash



Modified: arm/trunk/src/interface/controller.py
===================================================================
--- arm/trunk/src/interface/controller.py	2010-10-02 20:21:56 UTC (rev 23392)
+++ arm/trunk/src/interface/controller.py	2010-10-02 22:36:42 UTC (rev 23393)
@@ -660,7 +660,7 @@
           regexLabel = "enabled" if panels["log"].regexFilter else "disabled"
           popup.addfstr(5, 41, "<b>f</b>: log regex filter (<b>%s</b>)" % regexLabel)
           
-          hiddenEntryLabel = "hidden" if panels["log"].isDuplicatesHidden else "visible"
+          hiddenEntryLabel = "visible" if panels["log"].showDuplicates else "hidden"
           popup.addfstr(6, 2, "<b>u</b>: duplicate log entries (<b>%s</b>)" % hiddenEntryLabel)
           popup.addfstr(6, 41, "<b>x</b>: clear event log")
           

Modified: arm/trunk/src/interface/logPanel.py
===================================================================
--- arm/trunk/src/interface/logPanel.py	2010-10-02 20:21:56 UTC (rev 23392)
+++ arm/trunk/src/interface/logPanel.py	2010-10-02 22:36:42 UTC (rev 23393)
@@ -53,6 +53,12 @@
 
 DUPLICATE_MSG = " [%i duplicate%s hidden]"
 
+# The height of the drawn content is estimated based on the last time we redrew
+# the panel. It's chiefly used for scrolling and the bar indicating its
+# position. Letting the estimate be too inaccurate results in a display bug, so
+# redraws the display if it's off by this threshold.
+CONTENT_HEIGHT_REDRAW_THRESHOLD = 3
+
 # static starting portion of common log entries, fetched from the config when
 # needed if None
 COMMON_LOG_MESSAGES = None
@@ -820,12 +826,15 @@
         
         lineCount += 1
     
-    self.lastContentHeight = lineCount + self.scroll - 1
+    # redraw the display if...
+    # - lastContentHeight was off by too much
+    # - we're off the bottom of the page
+    newContentHeight = lineCount + self.scroll - 1
+    forceRedraw = abs(self.lastContentHeight - newContentHeight) >= CONTENT_HEIGHT_REDRAW_THRESHOLD
+    forceRedraw |= newContentHeight > height and self.scroll + height - 1 > newContentHeight
     
-    # if we're off the bottom of the page then redraw the content with the
-    # corrected lastContentHeight
-    if self.lastContentHeight > height and self.scroll + height - 1 > self.lastContentHeight:
-      self.draw(subwindow, width, height)
+    self.lastContentHeight = newContentHeight
+    if forceRedraw: self.redraw(True)
     
     self.valsLock.release()
   

Modified: arm/trunk/src/util/conf.py
===================================================================
--- arm/trunk/src/util/conf.py	2010-10-02 20:21:56 UTC (rev 23392)
+++ arm/trunk/src/util/conf.py	2010-10-02 22:36:42 UTC (rev 23393)
@@ -50,6 +50,7 @@
   Arguments:
     configKey - configuration key to check
   """
+  
   for listKeyPrefix in LIST_KEYS:
     if configKey.startswith(listKeyPrefix):
       return True



More information about the tor-commits mailing list