[nyx/master] Drop select() return value

commit 3983cd7859aecc5a6fc419b4d5548cd329a2f5bc Author: Damian Johnson <atagar@torproject.org> Date: Thu Aug 11 09:03:51 2016 -0700 Drop select() return value The select method returned a boolean to indicate 'should we close the menu' but in effect this was just an 'is submenu' check. We already do that where select() is used so we can simplify this a bit. --- nyx/menu.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/nyx/menu.py b/nyx/menu.py index 4c85263..d1e0f97 100644 --- a/nyx/menu.py +++ b/nyx/menu.py @@ -63,6 +63,7 @@ class MenuItem(object): """ my_hierarchy = [self] + while my_hierarchy[-1].get_parent(): my_hierarchy.append(my_hierarchy[-1].get_parent()) @@ -71,8 +72,7 @@ class MenuItem(object): def select(self): """ - Performs the callback for the menu item, returning true if we should close - the menu and false otherwise. + Performs the callback for the menu item. """ if self._callback: @@ -80,8 +80,6 @@ class MenuItem(object): control.redraw() self._callback() - return True - def next(self): """ Provides the next option for the submenu we're in, raising a ValueError @@ -165,9 +163,6 @@ class Submenu(MenuItem): return not bool(self._children) - def select(self): - return False - class RadioMenuItem(MenuItem): """ @@ -199,8 +194,6 @@ class RadioMenuItem(MenuItem): if not self.is_selected(): self._group.action(self._arg) - return True - class RadioGroup(object): """ @@ -527,7 +520,8 @@ class MenuCursor: if not self._selection.is_empty(): self._selection = self._selection.get_children()[0] else: - self._is_done = self._selection.select() + self._selection.select() + self._is_done = True elif key.match('up'): self._selection = self._selection.prev() elif key.match('down'):
participants (1)
-
atagar@torproject.org