commit 7d486ef3d970b0185e0659ed558f2cbe24e0dc10 Author: Damian Johnson atagar@torproject.org Date: Fri Mar 25 09:03:25 2016 -0700
Stacktrace when resizing graph
Bug spotted by yurb. --- nyx/curses.py | 7 ++++--- nyx/panel/graph.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/nyx/curses.py b/nyx/curses.py index 67305c6..8e41bb3 100644 --- a/nyx/curses.py +++ b/nyx/curses.py @@ -378,7 +378,8 @@ def is_wide_characters_supported():
def draw(func, left = 0, top = 0, width = None, height = None): """ - Renders subwindow using the given draw function. + Renders a subwindow. This calls the given draw function with a + :class:`~nyx.curses._Subwindow`.
:param function func: draw function for rendering the subwindow :param int left: left position of the panel @@ -401,11 +402,11 @@ def draw(func, left = 0, top = 0, width = None, height = None):
curses_subwindow = CURSES_SCREEN.subwin(subwindow_height, subwindow_width, top, left) curses_subwindow.erase() - func(Subwindow(subwindow_width, subwindow_height, curses_subwindow)) + func(_Subwindow(subwindow_width, subwindow_height, curses_subwindow)) curses_subwindow.refresh()
-class Subwindow(object): +class _Subwindow(object): """ Subwindow that can be drawn within.
diff --git a/nyx/panel/graph.py b/nyx/panel/graph.py index 212ee85..510fa14 100644 --- a/nyx/panel/graph.py +++ b/nyx/panel/graph.py @@ -16,6 +16,7 @@ import copy import time
import nyx.controller +import nyx.curses import nyx.panel import nyx.popups import nyx.tracker @@ -484,7 +485,9 @@ class GraphPanel(nyx.panel.Panel): # don't grow the graph if it's already consuming the whole display # (plus an extra line for the graph/log gap)
- max_height = self.parent.getmaxyx()[0] - self.top + with nyx.curses.raw_screen() as stdscr: + max_height = stdscr.getmaxyx()[0] - self.top + current_height = self.get_height()
if current_height < max_height + 1:
tor-commits@lists.torproject.org