Skip to content

Commit

Permalink
Install sssp and set up qe on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Oct 30, 2024
1 parent e4a225d commit 61f6d35
Showing 1 changed file with 39 additions and 36 deletions.
75 changes: 39 additions & 36 deletions src/aiidalab_qe/app/submission/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ def __init__(self, model: SubmissionModel, qe_auto_setup=True, **kwargs):
# "input_parameters",
# )

self.qe_auto_setup = qe_auto_setup

plugin_codes: PluginCodes = get_entry_items("aiidalab_qe.properties", "code")
plugin_codes |= {
"dft": {
Expand All @@ -101,6 +99,9 @@ def __init__(self, model: SubmissionModel, qe_auto_setup=True, **kwargs):

self.rendered = False

self._install_sssp(qe_auto_setup)
self._set_up_qe(qe_auto_setup)

def render(self):
if self.rendered:
return
Expand Down Expand Up @@ -139,40 +140,6 @@ def render(self):
)
self.submit_button.on_click(self._on_submission)

self.sssp_installation = PseudosInstallWidget(auto_start=False)
ipw.dlink(
(self.sssp_installation, "busy"),
(self._model, "installing_sssp"),
)
ipw.dlink(
(self.sssp_installation, "installed"),
(self._model, "installing_sssp"),
lambda installed: not installed,
)
ipw.dlink(
(self.sssp_installation, "installed"),
(self._model, "sssp_installed"),
)
if self.qe_auto_setup:
self.sssp_installation.refresh()

self.qe_setup = QESetupWidget(auto_start=False)
ipw.dlink(
(self.qe_setup, "busy"),
(self._model, "installing_qe"),
)
ipw.dlink(
(self.qe_setup, "installed"),
(self._model, "installing_qe"),
lambda installed: not installed,
)
ipw.dlink(
(self.qe_setup, "installed"),
(self._model, "qe_installed"),
)
if self.qe_auto_setup:
self.qe_setup.refresh()

self.submission_blocker_messages = ipw.HTML()
ipw.dlink(
(self._model, "submission_blocker_messages"),
Expand Down Expand Up @@ -341,3 +308,39 @@ def _update_state(self, _=None):
self.state = self.State.READY
else:
self.state = self.state.CONFIGURED

def _install_sssp(self, qe_auto_setup):
self.sssp_installation = PseudosInstallWidget(auto_start=False)
ipw.dlink(
(self.sssp_installation, "busy"),
(self._model, "installing_sssp"),
)
ipw.dlink(
(self.sssp_installation, "installed"),
(self._model, "installing_sssp"),
lambda installed: not installed,
)
ipw.dlink(
(self.sssp_installation, "installed"),
(self._model, "sssp_installed"),
)
if qe_auto_setup:
self.sssp_installation.refresh()

def _set_up_qe(self, qe_auto_setup):
self.qe_setup = QESetupWidget(auto_start=False)
ipw.dlink(
(self.qe_setup, "busy"),
(self._model, "installing_qe"),
)
ipw.dlink(
(self.qe_setup, "installed"),
(self._model, "installing_qe"),
lambda installed: not installed,
)
ipw.dlink(
(self.qe_setup, "installed"),
(self._model, "qe_installed"),
)
if qe_auto_setup:
self.qe_setup.refresh()

0 comments on commit 61f6d35

Please sign in to comment.