[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r23436: {arm} fix: forcing log panel redraw if estimating the content high (in arm/trunk/src: . interface)



Author: atagar
Date: 2010-10-07 02:25:24 +0000 (Thu, 07 Oct 2010)
New Revision: 23436

Modified:
   arm/trunk/src/__init__.py
   arm/trunk/src/armrc.defaults
   arm/trunk/src/interface/logPanel.py
Log:
fix: forcing log panel redraw if estimating the content hight meant we incorrectly showed/hid the scroll bar



Modified: arm/trunk/src/__init__.py
===================================================================
--- arm/trunk/src/__init__.py	2010-10-06 21:31:19 UTC (rev 23435)
+++ arm/trunk/src/__init__.py	2010-10-07 02:25:24 UTC (rev 23436)
@@ -2,5 +2,5 @@
 Scripts involved in validating user input, system state, and initializing arm.
 """
 
-__all__ = ["starter", "prereq"]
+__all__ = ["starter", "prereq", "version"]
 

Modified: arm/trunk/src/armrc.defaults
===================================================================
--- arm/trunk/src/armrc.defaults	2010-10-06 21:31:19 UTC (rev 23435)
+++ arm/trunk/src/armrc.defaults	2010-10-07 02:25:24 UTC (rev 23436)
@@ -14,7 +14,7 @@
 features.colorInterface true
 
 # Set this if you're running in a chroot jail or other environment where tor's
-# resources (log, state, etc) have an unreported prefix in their path.
+# resources (log, state, etc) should have a prefix in their paths.
 features.pathPrefix
 
 # If set, arm appends any log messages it reports while running to the given
@@ -28,7 +28,7 @@
 #   show borders with dates for entries from previous days
 # showDuplicateEntries
 #   shows all log entries if true, otherwise collapses similar entries with an
-#   indicator for how much is hidden
+#   indicator for how much is being hidden
 # entryDuration
 #   number of days log entries are kept before being dropped (if zero then
 #   they're kept until cropped due to caching limits)

Modified: arm/trunk/src/interface/logPanel.py
===================================================================
--- arm/trunk/src/interface/logPanel.py	2010-10-06 21:31:19 UTC (rev 23435)
+++ arm/trunk/src/interface/logPanel.py	2010-10-07 02:25:24 UTC (rev 23436)
@@ -425,8 +425,8 @@
     formatted calls of a callback function.
     
     Arguments:
-      callback   - function accepting a LogEntry, called when an event of these
-                   types occur
+      callback - function accepting a LogEntry, called when an event of these
+                 types occur
     """
     
     TorCtl.PostEventListener.__init__(self)
@@ -766,7 +766,8 @@
     
     # draws left-hand scroll bar if content's longer than the height
     msgIndent, dividerIndent = 0, 0 # offsets for scroll bar
-    if self.lastContentHeight > height - 1:
+    isScrollBarVisible = self.lastContentHeight > height - 1
+    if isScrollBarVisible:
       msgIndent, dividerIndent = 3, 2
       self.addScrollBar(self.scroll, self.scroll + height - 1, self.lastContentHeight, 1)
     
@@ -880,14 +881,17 @@
     # - we're off the bottom of the page
     newContentHeight = lineCount + self.scroll - 1
     contentHeightDelta = abs(self.lastContentHeight - newContentHeight)
-    forceRedraw, forceRedrawReason = False, ""
+    forceRedraw, forceRedrawReason = True, ""
     
     if contentHeightDelta >= CONTENT_HEIGHT_REDRAW_THRESHOLD:
-      forceRedraw = True
       forceRedrawReason = "estimate was off by %i" % contentHeightDelta
     elif newContentHeight > height and self.scroll + height - 1 > newContentHeight:
-      forceRedraw = True
       forceRedrawReason = "scrolled off the bottom of the page"
+    elif not isScrollBarVisible and newContentHeight > height - 1:
+      forceRedrawReason = "scroll bar wasn't previously visible"
+    elif isScrollBarVisible and newContentHeight <= height - 1:
+      forceRedrawReason = "scroll bar shouldn't be visible"
+    else: forceRedraw = False
     
     self.lastContentHeight = newContentHeight
     if forceRedraw:
@@ -1045,7 +1049,6 @@
     
     """
     
-    self.valsLock.acquire()
     cacheSize = self._config["cache.logPanel.size"]
     if len(eventListing) > cacheSize: del eventListing[cacheSize:]
     
@@ -1061,6 +1064,4 @@
       
       # removes entries older than the ttl
       if breakpoint != None: del eventListing[breakpoint:]
-    
-    self.valsLock.release()