From 8f68590d96e94beba20698c1a8daf2149e14c5f1 Mon Sep 17 00:00:00 2001 From: Edan Bainglass Date: Wed, 30 Oct 2024 06:42:02 +0000 Subject: [PATCH] Install sssp and set up qe on startup --- src/aiidalab_qe/app/submission/__init__.py | 73 ++++++++++++---------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/src/aiidalab_qe/app/submission/__init__.py b/src/aiidalab_qe/app/submission/__init__.py index a142608d7..1409bac02 100644 --- a/src/aiidalab_qe/app/submission/__init__.py +++ b/src/aiidalab_qe/app/submission/__init__.py @@ -101,6 +101,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 @@ -139,40 +142,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"), @@ -341,3 +310,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()