From 152c2bb9a6279632a686f6c60e2e99345208c42f Mon Sep 17 00:00:00 2001 From: Xing Wang Date: Mon, 21 Oct 2024 18:15:04 +0200 Subject: [PATCH] Allow user to hide the header of the Wizard App (#638) This PR adds `show_header` property to allow the user to hide the header --- aiidalab_widgets_base/wizard.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/aiidalab_widgets_base/wizard.py b/aiidalab_widgets_base/wizard.py index 074433769..0c633683d 100644 --- a/aiidalab_widgets_base/wizard.py +++ b/aiidalab_widgets_base/wizard.py @@ -88,7 +88,7 @@ class WizardAppWidget(ipw.VBox): selected_index = tl.Int(allow_none=True) - def __init__(self, steps, **kwargs): + def __init__(self, steps, show_header=True, **kwargs): # The number of steps must be greater than one # for this app's logic to make sense. if len(steps) < 2: @@ -142,11 +142,20 @@ def __init__(self, steps, **kwargs): ) self.next_button.on_click(self._on_click_next_button) - header = ipw.HBox( + self.header = ipw.HBox( children=[self.back_button, self.reset_button, self.next_button] ) + self.show_header = show_header - super().__init__(children=[header, self.accordion], **kwargs) + super().__init__(children=[self.header, self.accordion], **kwargs) + + @property + def show_header(self): + return self.header.layout.display != "none" + + @show_header.setter + def show_header(self, value): + self.header.layout.display = "flex" if value else "none" def _update_titles(self): for i, (title, widget) in enumerate(zip(self.titles, self.accordion.children)):