ubuntu-pro: add overlay to show how to register

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-06-03 18:58:55 +02:00
parent f62550528e
commit 9e96711ecd
1 changed files with 44 additions and 0 deletions

View File

@ -269,6 +269,11 @@ class UbuntuProView(BaseView):
""" Display an overlay that shows information about Ubuntu Pro. """
self.show_stretchy_overlay(AboutProWidget(self))
def show_how_to_register(self) -> None:
""" Display an overlay that shows instructions to register to
Ubuntu Pro. """
self.show_stretchy_overlay(HowToRegisterWidget(self))
def show_invalid_token(self) -> None:
""" Display an overlay that indicates that the user-supplied token is
invalid. """
@ -375,6 +380,45 @@ class AboutProWidget(Stretchy):
self.parent.remove_overlay()
class HowToRegisterWidget(Stretchy):
""" Widget showing some instructions to register to Ubuntu Pro.
+-------------------- How to register --------------------+
| |
| You can register for a free Ubuntu One account and get |
| a personal token for up to 3 machines. |
| |
| To register an account, visit ubuntu.com/pro on another |
| device. |
| |
| [ Continue ] |
+---------------------------------------------------------+
"""
def __init__(self, parent: UbuntuProView) -> None:
""" Initializes the widget."""
self.parent = parent
ok = ok_btn(label=_("Continue"), on_press=lambda unused: self.close())
title = _("How to register")
header = _("You can register for a free Ubuntu One account and get a"
" personal token for up to 3 machines.")
widgets: List[Widget] = [
Text(header),
Text(""),
Text("To register an account, visit ubuntu.com/pro on another"
" device."),
Text(""),
button_pile([ok]),
]
super().__init__(title, widgets, stretchy_index=2, focus_index=4)
def close(self) -> None:
""" Close the overlay. """
self.parent.remove_overlay()
class ShowServicesWidget(Stretchy):
""" Widget to show the activable services for UA subscription.
+------------------ Activable Services -------------------+