[tor-commits] [arm/master] Moving graph panel resizing to the graph panel

atagar at torproject.org atagar at torproject.org
Fri May 13 05:09:38 UTC 2011


commit 62a0e17f2ff9d3d44d82ca43360fa6da8eb21d54
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu May 12 19:04:41 2011 -0700

    Moving graph panel resizing to the graph panel
---
 src/cli/controller.py          |   15 ---------------
 src/cli/graphing/graphPanel.py |   17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/cli/controller.py b/src/cli/controller.py
index dc82d65..035ef07 100644
--- a/src/cli/controller.py
+++ b/src/cli/controller.py
@@ -919,21 +919,6 @@ def drawTorMonitor(stdscr, startTime, loggedEvents, isBlindMode):
         panel.CURSES_LOCK.release()
       
       panels["graph"].redraw(True)
-    elif page == 0 and key in (ord('n'), ord('N'), ord('m'), ord('M')):
-      # Unfortunately modifier keys don't work with the up/down arrows (sending
-      # multiple keycodes. The only exception to this is shift + left/right,
-      # but for now just gonna use standard characters.
-      
-      if key in (ord('n'), ord('N')):
-        panels["graph"].setGraphHeight(panels["graph"].graphHeight - 1)
-      else:
-        # don't grow the graph if it's already consuming the whole display
-        # (plus an extra line for the graph/log gap)
-        maxHeight = panels["graph"].parent.getmaxyx()[0] - panels["graph"].top
-        currentHeight = panels["graph"].getHeight()
-        
-        if currentHeight < maxHeight + 1:
-          panels["graph"].setGraphHeight(panels["graph"].graphHeight + 1)
     else:
       for pagePanel in getPanels(page + 1):
         isKeystrokeConsumed = pagePanel.handleKey(key)
diff --git a/src/cli/graphing/graphPanel.py b/src/cli/graphing/graphPanel.py
index 0c52f6f..c419119 100644
--- a/src/cli/graphing/graphPanel.py
+++ b/src/cli/graphing/graphPanel.py
@@ -256,7 +256,22 @@ class GraphPanel(panel.Panel):
   
   def handleKey(self, key):
     isKeystrokeConsumed = True
-    if key == ord('s') or key == ord('S'):
+    if key in (ord('n'), ord('N'), ord('m'), ord('M')):
+      # Unfortunately modifier keys don't work with the up/down arrows (sending
+      # multiple keycodes). The only exception to this is shift + left/right,
+      # but for now just gonna use standard characters.
+      
+      if key in (ord('n'), ord('N')):
+        self.setGraphHeight(self.graphHeight - 1)
+      else:
+        # don't grow the graph if it's already consuming the whole display
+        # (plus an extra line for the graph/log gap)
+        maxHeight = self.parent.getmaxyx()[0] - self.top
+        currentHeight = self.getHeight()
+        
+        if currentHeight < maxHeight + 1:
+          self.setGraphHeight(self.graphHeight + 1)
+    elif key == ord('s') or key == ord('S'):
       # provides a menu to pick the graphed stats
       availableStats = self.stats.keys()
       availableStats.sort()





More information about the tor-commits mailing list