mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-05-07 16:45:04 -04:00
Text UI navigation
This commit is contained in:
parent
23a0f43758
commit
c0699070b2
2 changed files with 70 additions and 13 deletions
|
@ -107,8 +107,17 @@ class MainDisplay():
|
|||
def update_active_shortcuts(self):
|
||||
self.frame.contents["footer"] = (self.sub_displays.active().shortcuts().widget, None)
|
||||
|
||||
def quit(self, sender=None):
|
||||
raise urwid.ExitMainLoop
|
||||
|
||||
|
||||
class MenuColumns(urwid.Columns):
|
||||
def keypress(self, size, key):
|
||||
if key == "tab" or key == "down":
|
||||
self.handler.frame.set_focus("body")
|
||||
|
||||
return super(MenuColumns, self).keypress(size, key)
|
||||
|
||||
class MenuDisplay():
|
||||
def __init__(self, app, handler):
|
||||
self.app = app
|
||||
|
@ -118,9 +127,11 @@ class MenuDisplay():
|
|||
button_conversations = (17, MenuButton("Conversations", on_press=handler.show_conversations))
|
||||
button_directory = (13, MenuButton("Directory", on_press=handler.show_directory))
|
||||
button_map = (7, MenuButton("Map", on_press=handler.show_map))
|
||||
button_quit = (8, MenuButton("Quit", on_press=handler.quit))
|
||||
|
||||
# buttons = [menu_text, button_conversations, button_node, button_directory, button_map]
|
||||
buttons = [menu_text, button_conversations, button_network]
|
||||
columns = urwid.Columns(buttons, dividechars=1)
|
||||
buttons = [menu_text, button_conversations, button_network, button_quit]
|
||||
columns = MenuColumns(buttons, dividechars=1)
|
||||
columns.handler = handler
|
||||
|
||||
self.widget = urwid.AttrMap(columns, "menubar")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue