-
Notifications
You must be signed in to change notification settings - Fork 24
Fix pseudo state and blockers propagation #1526
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, | ||
|
|
@@ -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): | ||
| 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() | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Triggering an update here sets the advanced model's |
||
|
|
||
| def _update_tabs(self): | ||
| if not self.rendered: | ||
| return | ||
|
|
@@ -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(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
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) | ||
|
|
@@ -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]: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.