Put edit box and button in list box with source

This makes it much easier to focus them, just scroll down.
pull/308/head
Ivan Habunek 2023-02-02 09:43:17 +01:00
rodzic cc1809db31
commit 5606d95c93
1 zmienionych plików z 9 dodań i 15 usunięć

Wyświetl plik

@ -13,25 +13,19 @@ class StatusSource(urwid.Padding):
"""Shows status data, as returned by the server, as formatted JSON.""" """Shows status data, as returned by the server, as formatted JSON."""
def __init__(self, status): def __init__(self, status):
self.source = json.dumps(status.data, indent=4) self.source = json.dumps(status.data, indent=4)
walker = urwid.SimpleFocusListWalker([
urwid.Text(self.source)
])
list = urwid.ListBox(walker)
self.filename_edit = EditBox(caption="Filename: ", edit_text="status.json") self.filename_edit = EditBox(caption="Filename: ", edit_text="status.json")
self.save_button = Button("Save", on_press=self.save_json)
self.status_text = urwid.Text("") self.status_text = urwid.Text("")
frame = urwid.Frame( walker = urwid.SimpleFocusListWalker([
body=list, urwid.Text(self.source),
footer=urwid.Pile(
[
urwid.BoxAdapter(urwid.SolidFill(" "), 2), urwid.BoxAdapter(urwid.SolidFill(" "), 2),
self.filename_edit, self.filename_edit,
self.save_button, Button("Save", on_press=self.save_json)
self.status_text, ])
]
), frame = urwid.Frame(
body=urwid.ListBox(walker),
footer=self.status_text
) )
super().__init__(frame) super().__init__(frame)