From c6fedfb8e10ebfdadd6244cc1764afcead3809f5 Mon Sep 17 00:00:00 2001 From: Carlos Nihelton Date: Thu, 26 May 2022 07:36:12 -0300 Subject: [PATCH] Set the about message on client initialization Inherently better than being a public field to be set later. Achieves a more declarative API. --- subiquity/client/client.py | 4 ++-- subiquity/ui/views/help.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/subiquity/client/client.py b/subiquity/client/client.py index 1f49d078..2dde8384 100644 --- a/subiquity/client/client.py +++ b/subiquity/client/client.py @@ -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 diff --git a/subiquity/ui/views/help.py b/subiquity/ui/views/help.py index 6af9d795..9c55a682 100644 --- a/subiquity/ui/views/help.py +++ b/subiquity/ui/views/help.py @@ -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)