# HG changeset patch # User Goffi # Date 1410192630 -7200 # Node ID 8bf5a35450f08bceeb5cce6d59770215ca691d81 # Parent 8f5afab948a0369e64f456bdd687a17444412d23 Fixed getFocusDirection direction when inversed, and FocusFrame focus order. diff -r 8f5afab948a0 -r 8bf5a35450f0 urwid_satext/sat_widgets.py --- 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