From 720d386efc57b5664ffb43aadf3f541434e0ae18 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Wed, 1 Mar 2017 09:11:59 +0100 Subject: Revert "Turn alot.walker.PipeWalker.focus into a property" This reverts commit 237499e631741dbb3837e5ef99cc66f842e8a92e. --- alot/walker.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'alot/walker.py') diff --git a/alot/walker.py b/alot/walker.py index a26b2926..4f9efb70 100644 --- a/alot/walker.py +++ b/alot/walker.py @@ -20,20 +20,18 @@ class PipeWalker(urwid.ListWalker): self.kwargs = kwargs self.containerclass = containerclass self.lines = [] - self._focus = 0 + self.focus = 0 self.empty = False self.direction = -1 if reverse else 1 def __contains__(self, name): return self.lines.__contains__(name) - @property - def focus(self): - return self._get_at_pos(self._focus) + def get_focus(self): + return self._get_at_pos(self.focus) - @focus.setter - def focus(self, value): - self._focus = value + def set_focus(self, focus): + self.focus = focus self._modified() def get_next(self, start_from): @@ -43,9 +41,9 @@ class PipeWalker(urwid.ListWalker): return self._get_at_pos(start_from - self.direction) def remove(self, obj): - next_focus = self._focus % len(self.lines) - if self._focus == len(self.lines) - 1 and self.empty: - next_focus = self._focus - 1 + next_focus = self.focus % len(self.lines) + if self.focus == len(self.lines) - 1 and self.empty: + next_focus = self.focus - 1 self.lines.remove(obj) if self.lines: -- cgit v1.2.3