Browse Source

add hint to GetGroupResponseView

pull/67/head
Max Erenberg 2 months ago
parent
commit
1fc432bb0f
  1. 4
      .drone/common.sh
  2. 2
      ceo/tui/views/GetGroupResponseView.py
  3. 5
      ceo/tui/views/PlainTextView.py
  4. 13
      ceo/tui/views/utils.py

4
.drone/common.sh

@ -10,10 +10,10 @@ rm /tmp/resolv.conf
mkdir -p /run/ceod
# mock out systemctl
ln -s /bin/true /usr/local/bin/systemctl
ln -sf /bin/true /usr/local/bin/systemctl
# mock out 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
cp .drone/mock_kubectl /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl

2
ceo/tui/views/GetGroupResponseView.py

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

5
ceo/tui/views/PlainTextView.py

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

13
ceo/tui/views/utils.py

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

Loading…
Cancel
Save