From bd3efd698a8e9ba9c2be3fdd0e838dfbebe2126a Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Fri, 9 Apr 2021 14:52:40 +0200 Subject: [PATCH] Add results output widget for anatric --- pyzebra/anatric.py | 8 ++++++++ pyzebra/app/panel_hdf_anatric.py | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pyzebra/anatric.py b/pyzebra/anatric.py index 1daf002..5a8c7d8 100644 --- a/pyzebra/anatric.py +++ b/pyzebra/anatric.py @@ -286,6 +286,14 @@ class AnatricConfig: self._tree.find("ReflectionPrinter").attrib["format"] = value + @property + def reflectionPrinter_file(self): + return self._tree.find("ReflectionPrinter").attrib["file"] + + @reflectionPrinter_file.setter + def reflectionPrinter_file(self, value): + self._tree.find("ReflectionPrinter").attrib["file"] = value + @property def algorithm(self): return self._tree.find("Algorithm").attrib["implementation"] diff --git a/pyzebra/app/panel_hdf_anatric.py b/pyzebra/app/panel_hdf_anatric.py index caa87dc..0d263cc 100644 --- a/pyzebra/app/panel_hdf_anatric.py +++ b/pyzebra/app/panel_hdf_anatric.py @@ -346,7 +346,7 @@ def create(): def process_button_callback(): with tempfile.TemporaryDirectory() as temp_dir: - temp_file = temp_dir + "/temp.xml" + temp_file = temp_dir + "/config.xml" config.save_as(temp_file) if doc.anatric_path: pyzebra.anatric(temp_file, anatric_path=doc.anatric_path) @@ -356,10 +356,14 @@ def create(): with open(config.logfile) as f_log: output_log.value = f_log.read() + with open(config.reflectionPrinter_file) as f_res: + output_res.value = f_res.read() + process_button = Button(label="Process", button_type="primary") process_button.on_click(process_button_callback) output_log = TextAreaInput(title="Logfile output:", height=320, width=465, disabled=True) + output_res = TextAreaInput(title="Result output:", height=320, width=465, disabled=True) output_config = TextAreaInput(title="Current config:", height=320, width=465, disabled=True) general_params_layout = column( @@ -383,12 +387,12 @@ def create(): tab_layout = row( general_params_layout, column(output_config, algorithm_params, row(process_button)), - output_log, + column(output_log, output_res), ) async def update_config(): with tempfile.TemporaryDirectory() as temp_dir: - temp_file = temp_dir + "/debug.xml" + temp_file = temp_dir + "/config.xml" config.save_as(temp_file) with open(temp_file) as f_config: output_config.value = f_config.read()