1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-23 23:52:40 +01:00

Put edit box and button in list box with source

This makes it much easier to focus them, just scroll down.
This commit is contained in:
Ivan Habunek 2023-02-02 09:43:17 +01:00
parent cc1809db31
commit 5606d95c93

View File

@ -13,25 +13,19 @@ class StatusSource(urwid.Padding):
"""Shows status data, as returned by the server, as formatted JSON."""
def __init__(self, status):
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.save_button = Button("Save", on_press=self.save_json)
self.status_text = urwid.Text("")
walker = urwid.SimpleFocusListWalker([
urwid.Text(self.source),
urwid.BoxAdapter(urwid.SolidFill(" "), 2),
self.filename_edit,
Button("Save", on_press=self.save_json)
])
frame = urwid.Frame(
body=list,
footer=urwid.Pile(
[
urwid.BoxAdapter(urwid.SolidFill(" "), 2),
self.filename_edit,
self.save_button,
self.status_text,
]
),
body=urwid.ListBox(walker),
footer=self.status_text
)
super().__init__(frame)