From 1fc432bb0f72a5d84b09824b7beffabfa379c95a Mon Sep 17 00:00:00 2001 From: Max Erenberg Date: Sun, 5 Jun 2022 10:20:22 -0400 Subject: [PATCH] add hint to GetGroupResponseView --- .drone/common.sh | 4 ++-- ceo/tui/views/GetGroupResponseView.py | 2 ++ ceo/tui/views/PlainTextView.py | 5 +++++ ceo/tui/views/utils.py | 13 ++++++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.drone/common.sh b/.drone/common.sh index b798322..f59dbdd 100644 --- a/.drone/common.sh +++ b/.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 diff --git a/ceo/tui/views/GetGroupResponseView.py b/ceo/tui/views/GetGroupResponseView.py index 480af37..3bdbfef 100644 --- a/ceo/tui/views/GetGroupResponseView.py +++ b/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', ) diff --git a/ceo/tui/views/PlainTextView.py b/ceo/tui/views/PlainTextView.py index 821f2be..4709f38 100644 --- a/ceo/tui/views/PlainTextView.py +++ b/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, diff --git a/ceo/tui/views/utils.py b/ceo/tui/views/utils.py index 0f9bfae..e0599aa 100644 --- a/ceo/tui/views/utils.py +++ b/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)