From b83ec59b16a3133b3810190e85d44348521cfb6a Mon Sep 17 00:00:00 2001 From: Maximilian Schulz Date: Mon, 16 Oct 2023 19:51:39 +0200 Subject: [PATCH] Simplify update layout even further --- vizro-core/src/vizro/actions/_actions_utils.py | 9 +++------ vizro-core/src/vizro/models/_components/graph.py | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/vizro-core/src/vizro/actions/_actions_utils.py b/vizro-core/src/vizro/actions/_actions_utils.py index 5932bb0a0..f399052cc 100644 --- a/vizro-core/src/vizro/actions/_actions_utils.py +++ b/vizro-core/src/vizro/actions/_actions_utils.py @@ -194,12 +194,9 @@ def _get_modified_page_charts( outputs = {} for target in targets: - if hasattr(model_manager[target], "_update_theme_call"): - outputs[target] = model_manager[target]._update_theme_call( - theme_bool=ctd_theme["value"], data_frame=filtered_data[target], **parameterized_config[target] - ) - else: - outputs[target] = model_manager[target](data_frame=filtered_data[target], **parameterized_config[target]) + outputs[target] = model_manager[target](data_frame=filtered_data[target], **parameterized_config[target]) + if hasattr(outputs[target], "update_layout"): + outputs[target].update_layout(template="vizro_dark" if ctd_theme["value"] else "vizro_light") # LN: needs to be refactored so plotly-independent or extendable - DONE # MS: is the common theme to be targetable? diff --git a/vizro-core/src/vizro/models/_components/graph.py b/vizro-core/src/vizro/models/_components/graph.py index c47220865..992690185 100644 --- a/vizro-core/src/vizro/models/_components/graph.py +++ b/vizro-core/src/vizro/models/_components/graph.py @@ -127,16 +127,14 @@ def update_graph_theme(theme_selector_on: bool): patched_figure["layout"]["template"] = themes.dark if theme_selector_on else themes.light return patched_figure - def _update_theme_call(self, theme_bool, **kwargs): - """Define __call__ method that includes theme update if applicable.""" - return self.__call__(**kwargs).update_layout(template="vizro_dark" if theme_bool else "vizro_light") - def _get_action_callback_output(self): - return Output( + return Output( # maybe just do the string? check with Petar, is that component_id=self.id, component_property="figure", allow_duplicate=True, ) + + # do private attribute with a value # def _get_click_trigger_property(self): # """Define trigger property for click interaction"""