[tor-commits] [arm/master] fix: Never show conn details if panel's empty

atagar at torproject.org atagar at torproject.org
Tue May 10 05:10:22 UTC 2011


commit ea8799aab65ad6509972ddebcdd0c3eb7f3e9769
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon May 9 19:14:28 2011 -0700

    fix: Never show conn details if panel's empty
    
    The connection panel could get stuck in the 'show connection details' mode if
    the panel's contents became empty while we were showing something. This
    wouldn't crash (like with the issue addressed in the previous fix), but the
    panel title would be wrong. This reverts the 'show details' flag if we don't
    have any contents.
---
 src/cli/connections/connPanel.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/cli/connections/connPanel.py b/src/cli/connections/connPanel.py
index 36687ac..8ecffc2 100644
--- a/src/cli/connections/connPanel.py
+++ b/src/cli/connections/connPanel.py
@@ -151,7 +151,7 @@ class ConnectionPanel(panel.Panel, threading.Thread):
       if self._showDetails: pageHeight -= (DETAILS_HEIGHT + 1)
       isChanged = self._scroller.handleKey(key, self._entryLines, pageHeight)
       if isChanged: self.redraw(True)
-    elif uiTools.isSelectionKey(key) and self._entries:
+    elif uiTools.isSelectionKey(key):
       self._showDetails = not self._showDetails
       self.redraw(True)
     elif key == ord('s') or key == ord('S'):
@@ -248,6 +248,9 @@ class ConnectionPanel(panel.Panel, threading.Thread):
   def draw(self, width, height):
     self.valsLock.acquire()
     
+    # if we don't have any contents then refuse to show details
+    if not self._entries: self._showDetails = False
+    
     # extra line when showing the detail panel is for the bottom border
     detailPanelOffset = DETAILS_HEIGHT + 1 if self._showDetails else 0
     isScrollbarVisible = len(self._entryLines) > height - detailPanelOffset - 1





More information about the tor-commits mailing list