Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 14 additions & 7 deletions src/aiidalab_qe/app/configuration/advanced/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def __init__(self, model: AdvancedConfigurationSettingsModel, **kwargs):
self._on_spin_type_change,
"spin_type",
)
self._model.observe(
self._on_blockers_change,
"blockers",
)

self.sub_settings: dict[str, ConfigurationSettingsPanel] = {
"general": self.general,
Expand Down Expand Up @@ -129,6 +133,16 @@ def _on_input_structure_change(self, _):
def _on_spin_type_change(self, _):
self._update_tabs()

def _on_advanced_tab_change(self, change):
Comment thread
yakutovicha marked this conversation as resolved.
tab: ConfigurationSettingsPanel = self.advanced_tabs.children[change["new"]] # type: ignore
tab.render()

def _on_reset_to_defaults_button_click(self, _):
self._reset()

def _on_blockers_change(self, _):
self._model.update_blockers()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triggering an update here sets the advanced model's blockers to the sum of all sub-advanced model blockers. This is later collected by a similar mechanism in the configuration step.


def _update_tabs(self):
if not self.rendered:
return
Expand All @@ -149,13 +163,6 @@ def _update_tabs(self):
# possible redirection to an un-rendered tab
self.advanced_tabs.selected_index = 0

def _on_advanced_tab_change(self, change):
tab: ConfigurationSettingsPanel = self.advanced_tabs.children[change["new"]] # type: ignore
tab.render()

def _on_reset_to_defaults_button_click(self, _):
self._reset()

def _reset(self):
self._model.reset()
for _, model in self._model.get_models():
Expand Down
16 changes: 9 additions & 7 deletions src/aiidalab_qe/app/configuration/advanced/pseudos/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,9 @@ def update_library_options(self):

self.update_family_parameters()

def get_cutoffs_by_index(self, index: int) -> list[float]:
return (
[self.cutoffs[0][index], self.cutoffs[1][index]]
if len(self.cutoffs[0]) > index
else [0.0, 0.0]
)

def update_functional(self):
if not self.dictionary or self.locked:
return
Comment thread
yakutovicha marked this conversation as resolved.
pseudos: list[UpfData] = []
for kind_name, uuid in self.dictionary.items():
kind = self.input_structure.get_kind(kind_name)
Expand All @@ -358,6 +353,13 @@ def update_functional(self):
self._defaults["functional"] = functional
self.functional = self._get_default("functional")

def get_cutoffs_by_index(self, index: int) -> list[float]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping update methods together 🙂

return (
[self.cutoffs[0][index], self.cutoffs[1][index]]
if len(self.cutoffs[0]) > index
else [0.0, 0.0]
)

def reset(self):
with self.hold_trait_notifications():
self.dictionary = self._get_default("dictionary")
Expand Down
1 change: 1 addition & 0 deletions src/aiidalab_qe/common/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def _on_confirmation_change(self, _):

def _on_blockers_change(self, _):
if self._model.state is not State.INIT:
self._model.update_blockers()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update triggers the accumulation of all configuration settings panel blockers.

self._model.update_blocker_messages()
self._model.update_state()

Expand Down
Loading