Skip to content

Commit

Permalink
menu plugin: Add separate return button
Browse files Browse the repository at this point in the history
While working with submenus, its rather inconvenient to move back to
the parent menu. The first button in the line should always be the most
commonly used one in the given context. And while this is "build" for
the main menu, "return" is most common when in a submenu.

To achieve this behavior, add a dedicated return button to submenus
rather than redefining the exit button. Furthermore, the ESC hotkey
gets context dependent semantic: exit when in the main menu, otherwise
return.

Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
jan-kiszka committed Oct 6, 2023
1 parent 9ac789a commit 5c76548
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kas/plugins/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,14 @@ def show_menu(self, title, top_node, is_submenu=False):
buttons = [
('Build', 'build', 'B'),
('Save & Exit', 'save', 'S'),
(' Exit ', 'exit', 'ESC'),
(' Exit ', 'exit', 'E'),
(' Help ', 'help', 'h')
]
if is_submenu:
buttons[3] = (' Return ', 'return', 'ESC')
buttons.insert(0, (' Return ', 'return', 'ESC'))
buttonbar = ButtonBar(self.screen, buttons)
if not is_submenu:
buttonbar.hotkeys['ESC'] = 'exit'
listbox = Listbox(height, scroll=scroll, returnExit=1)
count = 0
for string, _ in items:
Expand Down

0 comments on commit 5c76548

Please sign in to comment.