mirror of
https://github.com/markqvist/NomadNet.git
synced 2024-10-01 01:26:07 -04:00
Keyboard navigation for fields
This commit is contained in:
parent
1a84e0c019
commit
e266719e2c
@ -31,6 +31,12 @@ You can `!`[submit`:/page/input_fields.mu`one|password|small]`! other fields, or
|
||||
|
||||
Or simply `!`[submit them all`:/page/input_fields.mu`*]`!.
|
||||
|
||||
Submission links can also `!`[include pre-configured variables`:/page/input_fields.mu`username|two|entitiy_id=4611|action=view]`!.
|
||||
|
||||
Or take all fields and `!`[pre-configured variables`:/page/input_fields.mu`*|entitiy_id=4611|action=view]`!.
|
||||
|
||||
Or only `!`[pre-configured variables`:/page/input_fields.mu`entitiy_id=4688|task=something]`!
|
||||
|
||||
-=
|
||||
|
||||
"""
|
||||
|
@ -158,6 +158,7 @@ def parse_line(line, state, url_delegate):
|
||||
if isinstance(o, tuple):
|
||||
if url_delegate != None:
|
||||
tw = LinkableText(o, align=state["align"], delegate=url_delegate)
|
||||
tw.in_columns = True
|
||||
else:
|
||||
tw = urwid.Text(o, align=state["align"])
|
||||
|
||||
@ -621,6 +622,7 @@ class LinkableText(urwid.Text):
|
||||
self.delegate = delegate
|
||||
self._cursor_position = 0
|
||||
self.key_timeout = 3
|
||||
self.in_columns = False
|
||||
if self.delegate != None:
|
||||
self.delegate.last_keypress = 0
|
||||
|
||||
@ -697,16 +699,23 @@ class LinkableText(urwid.Text):
|
||||
elif key == "right":
|
||||
old = self._cursor_position
|
||||
self._cursor_position = self.find_next_part_pos(self._cursor_position, part_positions)
|
||||
|
||||
if self._cursor_position == old:
|
||||
self._cursor_position = 0
|
||||
return "down"
|
||||
if self.in_columns:
|
||||
return "right"
|
||||
else:
|
||||
self._cursor_position = 0
|
||||
return "down"
|
||||
|
||||
self._invalidate()
|
||||
|
||||
elif key == "left":
|
||||
if self._cursor_position > 0:
|
||||
self._cursor_position = self.find_prev_part_pos(self._cursor_position, part_positions)
|
||||
self._invalidate()
|
||||
if self.in_columns:
|
||||
return "left"
|
||||
else:
|
||||
self._cursor_position = self.find_prev_part_pos(self._cursor_position, part_positions)
|
||||
self._invalidate()
|
||||
|
||||
else:
|
||||
if self.delegate != None:
|
||||
|
Loading…
Reference in New Issue
Block a user