Skip to content

Commit

Permalink
Add show_header property
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Oct 8, 2024
1 parent 32e81d1 commit 40e7916
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 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, hide_header=False, **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 @@ -145,11 +145,18 @@ def __init__(self, steps, hide_header=False, **kwargs):
self.header = ipw.HBox(
children=[self.back_button, self.reset_button, self.next_button]
)
self.show_header = show_header

if hide_header:
self.header.layout.display = "none"
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)):
icon = self.ICONS.get(widget.state, str(widget.state).upper())
Expand Down

0 comments on commit 40e7916

Please sign in to comment.