Skip to content

Commit

Permalink
Simplify update layout even further
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Oct 16, 2023
1 parent 6fc5c78 commit b83ec59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 3 additions & 6 deletions vizro-core/src/vizro/actions/_actions_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
8 changes: 3 additions & 5 deletions vizro-core/src/vizro/models/_components/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit b83ec59

Please sign in to comment.