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

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



commit ea8799aab65ad6509972ddebcdd0c3eb7f3e9769
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits