diff --git a/src/aiidalab_qe_vibroscopy/app/model.py b/src/aiidalab_qe_vibroscopy/app/model.py index 46cb364..0df0759 100644 --- a/src/aiidalab_qe_vibroscopy/app/model.py +++ b/src/aiidalab_qe_vibroscopy/app/model.py @@ -6,6 +6,8 @@ from aiida_phonopy.data.preprocess import PreProcessData from aiida.plugins import DataFactory +import sys +import os HubbardStructureData = DataFactory("quantumespresso.hubbard_structure") from aiida_vibroscopy.calculations.spectra_utils import get_supercells_for_hubbard @@ -40,6 +42,24 @@ """ +def disable_print(func): + def wrapper(*args, **kwargs): + # Save the current standard output + original_stdout = sys.stdout + # Redirect standard output to os.devnull + sys.stdout = open(os.devnull, "w") + try: + # Call the function + result = func(*args, **kwargs) + finally: + # Restore the original standard output + sys.stdout.close() + sys.stdout = original_stdout + return result + + return wrapper + + class VibroConfigurationSettingsModel(ConfigurationSettingsModel, HasInputStructure): dependencies = [ "input_structure", @@ -163,6 +183,7 @@ def reset_symprec(self, _=None): "supercell_number_estimator" ) + @disable_print def _estimate_supercells(self, _=None): if self.input_structure: self.supercell_number_estimator = spinner_html diff --git a/src/aiidalab_qe_vibroscopy/app/settings.py b/src/aiidalab_qe_vibroscopy/app/settings.py index ac8943a..e697437 100644 --- a/src/aiidalab_qe_vibroscopy/app/settings.py +++ b/src/aiidalab_qe_vibroscopy/app/settings.py @@ -12,59 +12,10 @@ from aiidalab_qe.common.panel import ConfigurationSettingsPanel from aiidalab_qe_vibroscopy.app.model import VibroConfigurationSettingsModel -import sys -import os - from aiida.plugins import DataFactory HubbardStructureData = DataFactory("quantumespresso.hubbard_structure") -# spinner for waiting time (supercell estimations) -spinner_html = """ - -