Rewrite TUI #52

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

View File

@ -104,7 +104,7 @@ class AddUserController(Controller):
data = resp.json()
self.model.full_name = data.get('cn', '')
self.model.first_name = data.get('given_name', '')
self.model.last_name = data.get('sn')
self.model.last_name = data.get('sn', '')
self.model.program = data.get('program', '')
self.model.forwarding_address = data.get('mail_local_addresses', [''])[0]
self.app.run_in_main_loop(self._on_lookup_user_success)

View File

@ -19,5 +19,6 @@ class GetGroupResponseView(PlainTextView):
])
self.set_lines(
lines,
scrollable=True,
on_next=self.controller.get_next_menu_callback('Welcome'),
)

View File

@ -13,6 +13,7 @@ class PlainTextView(View):
self,
lines,
align='center',
scrollable=False,
min_width=None,
on_back=None,
on_next=None,
@ -23,11 +24,18 @@ class PlainTextView(View):
min_width = App.WIDTH
else:
min_width = max(map(len, lines))
if scrollable:
body = urwid.ListBox(urwid.SimpleListWalker([
urwid.Text(line, align=align)
for line in lines
]))
else:
body = urwid.Filler(
urwid.Text('\n'.join(lines), align=align)
)
self.original_widget = wrap_in_frame(
urwid.Padding(
urwid.Filler(
urwid.Text('\n'.join(lines), align=align)
),
body,
align='center',
width=('relative', App.REL_WIDTH_PCT),
min_width=min_width,