Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to hide the header of the Wizard App #638

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions aiidalab_widgets_base/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
AndresOrtegaGuerrero marked this conversation as resolved.
Show resolved Hide resolved

@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)):
Expand Down