add hint to GetGroupResponseView
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Max Erenberg 2022-06-05 10:20:22 -04:00
parent 2678bdf16e
commit 1fc432bb0f
4 changed files with 17 additions and 7 deletions

View File

@ -10,10 +10,10 @@ rm /tmp/resolv.conf
mkdir -p /run/ceod mkdir -p /run/ceod
# mock out systemctl # mock out systemctl
ln -s /bin/true /usr/local/bin/systemctl ln -sf /bin/true /usr/local/bin/systemctl
# mock out acme.sh # mock out acme.sh
mkdir -p /root/.acme.sh mkdir -p /root/.acme.sh
ln -s /bin/true /root/.acme.sh/acme.sh ln -sf /bin/true /root/.acme.sh/acme.sh
# mock out kubectl # mock out kubectl
cp .drone/mock_kubectl /usr/local/bin/kubectl cp .drone/mock_kubectl /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl chmod +x /usr/local/bin/kubectl

View File

@ -21,4 +21,6 @@ class GetGroupResponseView(PlainTextView):
lines, lines,
scrollable=True, scrollable=True,
on_next=self.controller.get_next_menu_callback('Welcome'), on_next=self.controller.get_next_menu_callback('Welcome'),
linebox=True,
subtitle='Press the Down key to move focus',
) )

View File

@ -18,6 +18,8 @@ class PlainTextView(View):
on_back=None, on_back=None,
on_next=None, on_next=None,
flash_text=None, flash_text=None,
linebox=False,
subtitle=None,
): ):
if min_width is None: if min_width is None:
if align == 'center': if align == 'center':
@ -33,6 +35,8 @@ class PlainTextView(View):
body = urwid.Filler( body = urwid.Filler(
urwid.Text('\n'.join(lines), align=align) urwid.Text('\n'.join(lines), align=align)
) )
if linebox:
body = urwid.LineBox(body)
self.original_widget = wrap_in_frame( self.original_widget = wrap_in_frame(
urwid.Padding( urwid.Padding(
body, body,
@ -41,6 +45,7 @@ class PlainTextView(View):
min_width=min_width, min_width=min_width,
), ),
self.model.title, self.model.title,
subtitle=subtitle,
on_back=on_back, on_back=on_back,
on_next=on_next, on_next=on_next,
flash_text=flash_text, flash_text=flash_text,

View File

@ -22,6 +22,7 @@ def decorate_button(button):
def wrap_in_frame( def wrap_in_frame(
widget, widget,
title, title,
subtitle=None,
on_back=None, on_back=None,
on_next=None, on_next=None,
next_btn=None, next_btn=None,
@ -53,7 +54,7 @@ def wrap_in_frame(
footer_height = 2 footer_height = 2
elif message_text is not None: elif message_text is not None:
footer = urwid.Pile([message_text, footer]) footer = urwid.Pile([message_text, footer])
footer_height = 6 # ??? footer_height = 7 # ???
footer_height += 1 # add 1 for the bottom padding footer_height += 1 # add 1 for the bottom padding
footer = urwid.Filler(footer, valign='bottom', bottom=1) footer = urwid.Filler(footer, valign='bottom', bottom=1)
body = urwid.Pile([widget, (footer_height, footer)]) body = urwid.Pile([widget, (footer_height, footer)])
@ -63,8 +64,10 @@ def wrap_in_frame(
flash_text = urwid.WidgetDisable(flash_text) flash_text = urwid.WidgetDisable(flash_text)
footer = urwid.Filler(flash_text, valign='bottom', bottom=1) footer = urwid.Filler(flash_text, valign='bottom', bottom=1)
body = urwid.Pile([body, (2, footer)]) body = urwid.Pile([body, (2, footer)])
header = urwid.Pile([ header_elems = [urwid.Text(('bold', title), align='center')]
urwid.Text(('bold', title), align='center'), if subtitle is not None:
urwid.Divider() header_elems.append(urwid.Text(subtitle, align='center'))
]) else:
header_elems.append(urwid.Divider())
header = urwid.Pile(header_elems)
return urwid.Frame(body, header) return urwid.Frame(body, header)