Rewrite TUI #52

Merged
merenber merged 7 commits from tui-urwid into master 2022-05-22 14:09:48 -04:00
4 changed files with 9 additions and 10 deletions
Showing only changes of commit fe27ee7259 - Show all commits

View File

@ -4,11 +4,11 @@ from queue import SimpleQueue
class App:
REL_WIDTH_PCT = 60
REL_HEIGHT_PCT = 60
REL_HEIGHT_PCT = 70
# On a full-screen (1366x768) gnome-terminal window,
# I had 168 cols and 36 rows
WIDTH = int(0.6 * 168)
HEIGHT = int(0.6 * 36)
HEIGHT = int(0.7 * 36)
def __init__(self, loop, main_widget):
self.loop = loop

View File

@ -15,13 +15,11 @@ def main():
main_widget = urwid.Padding(urwid.Text(''), left=2, right=2)
top = urwid.Overlay(
main_widget,
urwid.SolidFill('\N{MEDIUM SHADE}'),
urwid.AttrMap(urwid.SolidFill(' '), 'background'),
align='center',
width=('relative', App.REL_WIDTH_PCT),
valign='middle',
height=('relative', App.REL_HEIGHT_PCT),
# On a full-screen (1366x768) gnome-terminal window,
# I had 168 cols and 36 rows
min_width=App.WIDTH,
min_height=App.HEIGHT,
)
@ -32,6 +30,7 @@ def main():
('bold', 'bold', ''),
('green', 'light green', ''),
('red', 'light red', ''),
('background', 'standout,light cyan', ''),
],
# Disable the mouse (makes it hard to copy text from the screen)
handle_mouse=False,

View File

@ -22,14 +22,10 @@ class WelcomeView(ColumnView):
on_press=self.controller.get_next_menu_callback(model_class.name),
)
rows.append((left_col_elem, decorate_button(button)))
extra_widgets = [
urwid.Divider(),
urwid.Text('Press q or Esc to quit')
]
self.set_rows(
rows,
right_col_weight=3,
extra_widgets=extra_widgets,
no_back_button=True,
no_next_button=True,
)
self.flash_text.set_text('Press q or Esc to quit')

View File

@ -59,6 +59,10 @@ def wrap_in_frame(
body = urwid.Pile([widget, (footer_height, footer)])
else:
body = widget
if flash_text is not None:
flash_text = urwid.WidgetDisable(flash_text)
footer = urwid.Filler(flash_text, valign='bottom', bottom=1)
body = urwid.Pile([body, (2, footer)])
header = urwid.Pile([
urwid.Text(('bold', title), align='center'),
urwid.Divider()