Skip to content

Commit

Permalink
Merge branch 'main' into fix_605_hide_kill_button
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Apr 8, 2024
2 parents 3481cc0 + 8da3db9 commit cc2713d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
19 changes: 18 additions & 1 deletion src/aiidalab_qe/app/configuration/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,26 @@ def __init__(self, **kwargs):
ipw.HTML("Select which properties to calculate:"),
]
entries = get_entry_items("aiidalab_qe.properties", "outline")
setting_entries = get_entry_items("aiidalab_qe.properties", "setting")
for name, entry_point in entries.items():
self.properties[name] = entry_point()
self.property_children.append(self.properties[name])
if name in setting_entries:
reminder_text = ipw.HTML()
self.property_children.append(
ipw.HBox([self.properties[name], reminder_text])
)

# observer change to update the reminder text
def update_reminder_text(change, reminder_text=reminder_text, name=name):
if change["new"]:
reminder_text.value = (
f"""Customize {name} settings in the panel above if needed."""
)
else:
reminder_text.value = ""

self.properties[name].run.observe(update_reminder_text, "value")

self.property_children.append(self.properties_help)
self.children = [
self.structure_title,
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/common/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, **kwargs):
description=self.title,
indent=False,
value=False,
layout=ipw.Layout(max_width="50%"),
style={"description_width": "initial"},
)
self.description_html = ipw.HTML(
f"""<div style="line-height: 140%; padding-top: 0px; padding-bottom: 5px">
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/bands/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": PwBandsWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/pdos/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": PdosWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/xas/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": XspectraCrystalWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/xps/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": XpsWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
12 changes: 7 additions & 5 deletions src/aiidalab_qe/workflows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,23 @@ def get_builder_from_protocol(
if properties is None:
properties = []
builder.properties = orm.List(list=properties)
# clean workdir
clean_workdir = orm.Bool(parameters["advanced"]["clean_workdir"])
builder.clean_workdir = clean_workdir
# add plugin workchain
for name, entry_point in plugin_entries.items():
if name in properties:
plugin_builder = entry_point["get_builder"](
codes, structure, copy.deepcopy(parameters), **kwargs
)
# check if the plugin has a clean_workdir input
plugin_workchain = entry_point["workchain"]
if plugin_workchain.spec().has_input("clean_workdir"):
plugin_builder.clean_workdir = clean_workdir
setattr(builder, name, plugin_builder)
else:
builder.pop(name, None)

# XXX (unkcpz) I smell not proper design here since I have to look at
# configuration step to know what show be set here.
clean_workdir = parameters["advanced"]["clean_workdir"]
builder.clean_workdir = orm.Bool(clean_workdir)

return builder

def setup(self):
Expand Down

0 comments on commit cc2713d

Please sign in to comment.