Set the about message on client initialization

Inherently better than being a public field to be set later.
Achieves a more declarative API.
This commit is contained in:
Carlos Nihelton 2022-05-26 07:36:12 -03:00
parent 3c27982939
commit c6fedfb8e1
No known key found for this signature in database
GPG Key ID: 6FE346D245197E9A
2 changed files with 6 additions and 6 deletions

View File

@ -120,13 +120,13 @@ class SubiquityClient(TuiApplication):
variant_to_controllers: Dict[str, List[str]] = {}
def __init__(self, opts):
def __init__(self, opts, about_msg=None):
if is_linux_tty():
self.input_filter = KeyCodesFilter()
else:
self.input_filter = DummyKeycodesFilter()
self.help_menu = HelpMenu(self)
self.help_menu = HelpMenu(self, about_msg)
super().__init__(opts)
self.interactive = None
self.server_updated = None

View File

@ -396,7 +396,7 @@ class HelpMenu(PopUpLauncher):
def __init__(self, app, about_msg=None):
self.app = app
self.about_message = about_msg
self._about_message = about_msg
self.btn = header_btn(_("Help"), on_press=self._open)
self.ssh_info = None
self.current_help = None
@ -454,14 +454,14 @@ class HelpMenu(PopUpLauncher):
return template.format(**info)
def about(self, sender=None):
if not self.about_message:
self.about_message = self._default_about_msg()
if not self._about_message:
self._about_message = self._default_about_msg()
self._show_overlay(
SimpleTextStretchy(
self.app,
_("About the installer"),
self.about_message))
self._about_message))
def ssh_help(self, sender=None):
texts = ssh_help_texts(self.ssh_info)