From 99a0d2c75d7354fc8574b0aeda91f11636ec2fb4 Mon Sep 17 00:00:00 2001 From: Tom David Mueller Date: Tue, 19 Nov 2024 10:43:48 +0100 Subject: [PATCH 1/5] only describe parameters that have been set --- src/workflow/StreamlitUI.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/workflow/StreamlitUI.py b/src/workflow/StreamlitUI.py index 254d4343..1e13de8e 100644 --- a/src/workflow/StreamlitUI.py +++ b/src/workflow/StreamlitUI.py @@ -1080,12 +1080,15 @@ def dict_to_markdown(d: dict): # Add key-value pairs as list items markdown.append(f">> {key}: **{value}**\n") - markdown.append("**General**") - dict_to_markdown(general) - markdown.append("**OpenMS TOPP Tools**\n") - dict_to_markdown(topp) - markdown.append("**Python Scripts**") - dict_to_markdown(python) + if len(general) > 0: + markdown.append("**General**") + dict_to_markdown(general) + if len(topp) > 0: + markdown.append("**OpenMS TOPP Tools**\n") + dict_to_markdown(topp) + if len(python) > 0: + markdown.append("**Python Scripts**") + dict_to_markdown(python) return "\n".join(markdown) def export_parameters_markdown(self): From ae8ea27de0724f849e912c0c07b8e162fbb5f82f Mon Sep 17 00:00:00 2001 From: Tom David Mueller Date: Tue, 19 Nov 2024 10:49:11 +0100 Subject: [PATCH 2/5] cleanup --- src/workflow/StreamlitUI.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/workflow/StreamlitUI.py b/src/workflow/StreamlitUI.py index 1e13de8e..a50f2787 100644 --- a/src/workflow/StreamlitUI.py +++ b/src/workflow/StreamlitUI.py @@ -957,7 +957,6 @@ def parameter_section(self, custom_parameter_function) -> None: help="Export parameter, can be used to import to this workflow.", use_container_width=True, ) - with cols[1]: text = self.export_parameters_markdown() st.download_button( "📑 Method summary", From b33c9fd8b04a2f203e502ab539c4244a1199affe Mon Sep 17 00:00:00 2001 From: Tom David Mueller Date: Tue, 19 Nov 2024 11:39:49 +0100 Subject: [PATCH 3/5] retain advanced parameters --- src/workflow/ParameterManager.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/workflow/ParameterManager.py b/src/workflow/ParameterManager.py index 7dd25be6..d1d7236c 100644 --- a/src/workflow/ParameterManager.py +++ b/src/workflow/ParameterManager.py @@ -37,6 +37,11 @@ def save_parameters(self) -> None: for k, v in st.session_state.items() if k.startswith(self.param_prefix) } + + # Merge with parameters from json + # Advanced parameters are only in session state if the view is active + json_params = json_params | self.get_parameters_from_json() + # get a list of TOPP tools which are in session state current_topp_tools = list( set( @@ -49,7 +54,8 @@ def save_parameters(self) -> None: ) # for each TOPP tool, open the ini file for tool in current_topp_tools: - json_params[tool] = {} + if tool not in json_params: + json_params[tool] = {} # load the param object param = poms.Param() poms.ParamXMLFile().load(str(Path(self.ini_dir, f"{tool}.ini")), param) From ce66c9a3809c354e8ec8486b8a58556639a4488e Mon Sep 17 00:00:00 2001 From: Tom David Mueller Date: Thu, 21 Nov 2024 12:03:49 +0100 Subject: [PATCH 4/5] fix file selection bug --- src/workflow/ParameterManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workflow/ParameterManager.py b/src/workflow/ParameterManager.py index d1d7236c..3c5d36de 100644 --- a/src/workflow/ParameterManager.py +++ b/src/workflow/ParameterManager.py @@ -40,7 +40,7 @@ def save_parameters(self) -> None: # Merge with parameters from json # Advanced parameters are only in session state if the view is active - json_params = json_params | self.get_parameters_from_json() + json_params = self.get_parameters_from_json() | json_params # get a list of TOPP tools which are in session state current_topp_tools = list( From 6c700e39c54dc7ed0a18dc7c8b717aa91a0bbd36 Mon Sep 17 00:00:00 2001 From: Tom David Mueller Date: Thu, 21 Nov 2024 12:03:49 +0100 Subject: [PATCH 5/5] fix file selection bug --- src/workflow/ParameterManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/workflow/ParameterManager.py b/src/workflow/ParameterManager.py index d1d7236c..3c5d36de 100644 --- a/src/workflow/ParameterManager.py +++ b/src/workflow/ParameterManager.py @@ -40,7 +40,7 @@ def save_parameters(self) -> None: # Merge with parameters from json # Advanced parameters are only in session state if the view is active - json_params = json_params | self.get_parameters_from_json() + json_params = self.get_parameters_from_json() | json_params # get a list of TOPP tools which are in session state current_topp_tools = list(