mirror of
https://github.com/ihabunek/toot
synced 2024-12-25 00:20:55 +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:
parent
cc1809db31
commit
5606d95c93
@ -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("")
|
||||||
|
|
||||||
|
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(
|
frame = urwid.Frame(
|
||||||
body=list,
|
body=urwid.ListBox(walker),
|
||||||
footer=urwid.Pile(
|
footer=self.status_text
|
||||||
[
|
|
||||||
urwid.BoxAdapter(urwid.SolidFill(" "), 2),
|
|
||||||
self.filename_edit,
|
|
||||||
self.save_button,
|
|
||||||
self.status_text,
|
|
||||||
]
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
super().__init__(frame)
|
super().__init__(frame)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user