Skip to content

Commit

Permalink
Fix pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Jul 24, 2024
1 parent 7b9d3b1 commit d74908c
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions aiidalab_ispg/app/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,20 @@ def __init__(self, progress_bar, children=None, **kwargs):
button_style="danger",
icon="times-circle",
disabled=True,
# layout=ipw.Layout(width="120px", height="40px"),
)
self.kill_button.on_click(self._on_click_kill_button)

workflow_btns = ipw.HBox([self.tree_toggle, self.kill_button])
self.tree_toggle.layout.width = "70%"

super().__init__(
children=[progress_bar, workflow_btns, self.process_tree, self.node_view, *children],
children=[
progress_bar,
workflow_btns,
self.process_tree,
self.node_view,
*children,
],
**kwargs,
)

Expand Down Expand Up @@ -252,14 +257,16 @@ def _observe_tree_toggle(self, change):
self.tree_toggle.icon = "folder"

def _update_kill_button(self):
"""Update the layout of the kill button."""
# Show the button only when the process is running
if self.process_uuid is None or self.state is not self.State.ACTIVE:
self.kill_button.layout.display = "none"
self.kill_button.disabled = True
else:
"""Update the layout of the kill button.
Show the button only when the process is running
"""
if self.process_uuid is not None and self.state is self.State.ACTIVE:
self.kill_button.layout.display = "block"
self.kill_button.disabled = False
else:
self.kill_button.layout.display = "none"
self.kill_button.disabled = True

def _on_click_kill_button(self, _=None):
"""Callback for the kill button.
Expand Down

0 comments on commit d74908c

Please sign in to comment.