summaryrefslogtreecommitdiff
path: root/alot/walker.py
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2016-12-18 10:35:05 +0100
committerLucas Hoffmann <l-m-h@web.de>2017-02-25 13:19:10 +0100
commit237499e631741dbb3837e5ef99cc66f842e8a92e (patch)
treefbb92338d5e7ebf10fd937b60f0bb620c59cae17 /alot/walker.py
parenteb9fcf11b77b9a6bebb835cfd9235fcc2fe56423 (diff)
Turn alot.walker.PipeWalker.focus into a property
Diffstat (limited to 'alot/walker.py')
-rw-r--r--alot/walker.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/alot/walker.py b/alot/walker.py
index 11296473..c1a23feb 100644
--- a/alot/walker.py
+++ b/alot/walker.py
@@ -16,18 +16,20 @@ 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)
- def get_focus(self):
- return self._get_at_pos(self.focus)
+ @property
+ def focus(self):
+ return self._get_at_pos(self._focus)
- def set_focus(self, focus):
- self.focus = focus
+ @focus.setter
+ def focus(self, value):
+ self._focus = value
self._modified()
def get_next(self, start_from):
@@ -37,9 +39,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: