Merge pull request #243 from CanonicalLtd/mwhudson/enter-next-field
have enter advance to the next focus item in piles and listboxes
This commit is contained in:
commit
64ec13fc98
|
@ -95,8 +95,11 @@ class TabCyclingMixin:
|
||||||
else:
|
else:
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
enter_advancing_command_map = urwid.command_map.copy()
|
||||||
|
enter_advancing_command_map['enter'] = 'next selectable'
|
||||||
|
|
||||||
class TabCyclingPile(TabCyclingMixin, urwid.Pile):
|
class TabCyclingPile(TabCyclingMixin, urwid.Pile):
|
||||||
|
_command_map = enter_advancing_command_map
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class TabCyclingColumns(TabCyclingMixin, urwid.Columns):
|
class TabCyclingColumns(TabCyclingMixin, urwid.Columns):
|
||||||
|
@ -104,6 +107,7 @@ class TabCyclingColumns(TabCyclingMixin, urwid.Columns):
|
||||||
|
|
||||||
|
|
||||||
class TabCyclingListBox(urwid.ListBox):
|
class TabCyclingListBox(urwid.ListBox):
|
||||||
|
_command_map = enter_advancing_command_map
|
||||||
# It feels like it ought to be possible to write TabCyclingMixin
|
# It feels like it ought to be possible to write TabCyclingMixin
|
||||||
# so it works for a ListBox as well, but it seems to be just
|
# so it works for a ListBox as well, but it seems to be just
|
||||||
# awkward enough to make the repeated code the easier and clearer
|
# awkward enough to make the repeated code the easier and clearer
|
||||||
|
|
Loading…
Reference in New Issue