From f78760101f100b3532a0e7e84cdf771b0cac8fc9 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 25 Sep 2019 13:22:19 +1200 Subject: [PATCH] Move guidance on what to do next on filesystem screen out of the footer. --- subiquity/ui/views/filesystem/filesystem.py | 42 +++++++++++++++------ 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/subiquity/ui/views/filesystem/filesystem.py b/subiquity/ui/views/filesystem/filesystem.py index de4a0e82..a459768e 100644 --- a/subiquity/ui/views/filesystem/filesystem.py +++ b/subiquity/ui/views/filesystem/filesystem.py @@ -474,12 +474,32 @@ class FilesystemView(BaseView): self.lb = ListBox(body) self.lb.base_widget.offset_rows = 2 - frame = screen( + super().__init__(screen( self.lb, self._build_buttons(), - focus_buttons=self.model.can_install()) - super().__init__(frame) + focus_buttons=self.model.can_install())) + self.frame = self._w.base_widget + self.showing_guidance = False self.refresh_model_inputs() + def _guidance(self): + todos = [] + if not self.model.is_root_mounted(): + todos.append(_("Mount a filesystem at /")) + if self.model.needs_bootloader_partition(): + todos.append(_("Select a boot disk")) + if not todos: + return None + rows = [ + TableRow([Text("")]), + TableRow([ + Text("To continue you need to:"), + Text(todos[0]), + ]), + ] + for todo in todos[1:]: + rows.append(TableRow([Text(""), Text(todo)])) + return TablePile(rows) + def _build_buttons(self): self.done = Toggleable(done_btn(_("Done"), on_press=self.done)) @@ -511,15 +531,15 @@ class FilesystemView(BaseView): self.lb.base_widget._select_first_selectable() can_install = self.model.can_install() self.done.enabled = can_install - if can_install: - self.controller.ui.set_footer( - _("Select Done to begin the installation.")) + if self.showing_guidance: + del self.frame.contents[0] + guidance = self._guidance() + if guidance: + self.frame.contents.insert( + 0, (guidance, self.frame.options('pack'))) + self.showing_guidance = True else: - if self.model.needs_bootloader_partition(): - self.controller.ui.set_footer(self.footer) - elif not self.model.is_root_mounted(): - self.controller.ui.set_footer( - _("You need to mount a device at / to continue.")) + self.showing_guidance = False def create_raid(self, button=None): self.show_stretchy_overlay(RaidStretchy(self))