Mercurial > urwid-satext
changeset 98:8bf5a35450f0
Fixed getFocusDirection direction when inversed, and FocusFrame focus order.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Sep 2014 18:10:30 +0200 |
parents | 8f5afab948a0 |
children | b2fee87c1d5a |
files | urwid_satext/sat_widgets.py |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/urwid_satext/sat_widgets.py Mon Sep 08 15:42:25 2014 +0200 +++ b/urwid_satext/sat_widgets.py Mon Sep 08 18:10:30 2014 +0200 @@ -39,7 +39,7 @@ if not inversed: direction = 1 if key in (a_key['FOCUS_SWITCH'], a_key['FOCUS_UP']) else -1 else: - direction = -1 if key in (a_key['FOCUS_SWITCH'], a_key['FOCUS_DOWN']) else 1 + direction = -1 if key in (a_key['FOCUS_SWITCH'], a_key['FOCUS_UP']) else 1 rotate = key == a_key['FOCUS_SWITCH'] return direction, rotate @@ -1173,6 +1173,7 @@ class FocusFrame(urwid.Frame): """Frame-like which manage SàT Focus Keys""" + ordered_positions = ('footer', 'body', 'header') def keypress(self, size, key): ret = super(FocusFrame, self).keypress(size, key) @@ -1180,12 +1181,10 @@ return if key in FOCUS_KEYS: - direction, rotate = getFocusDirection(key, inversed=True) + direction, rotate = getFocusDirection(key) - selectables = [] # keep positions which exists and have a selectable widget - for position in reversed(self): - if self.contents[position][0].selectable(): - selectables.append(position) + positions = [pos for pos in self.ordered_positions if pos in self] + selectables = [pos for pos in positions if self.contents[pos][0].selectable()] # keep positions which exists and have a selectable widget if not selectables: # no widget is selectable, we just return return