From 5606d95c9345973a198a5ac478d25e2560b01f88 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Thu, 2 Feb 2023 09:43:17 +0100 Subject: [PATCH] Put edit box and button in list box with source This makes it much easier to focus them, just scroll down. --- toot/tui/overlays.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/toot/tui/overlays.py b/toot/tui/overlays.py index 33b1d8b..1988eaf 100644 --- a/toot/tui/overlays.py +++ b/toot/tui/overlays.py @@ -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)