Skip to content

Commit

Permalink
Add immediate side effect for da_active, too
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Oct 2, 2023
1 parent f0cdf7d commit d7c9f9b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pan3d/dataset_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(self, server=None, dataset_path=None, state=None, pangeo=False):
self.plotter.set_background("lightgrey")
self.dataset_path = None
self.dataset = None
self.da_active = None
self.mesh = None
self.actor = None

Expand Down Expand Up @@ -194,6 +195,8 @@ def set_dataset_path(self, dataset_path):

def set_data_array_active_name(self, da_active):
self.state.da_active = da_active
# immediate callback because order matters for this side-effect
self._on_change_da_active(da_active)

def set_data_array_axis_names(self, **kwargs):
if "x" in kwargs:
Expand Down Expand Up @@ -269,8 +272,13 @@ def _on_change_dataset_path(self, dataset_path, **kwargs):

@change("da_active")
def _on_change_da_active(self, da_active, **kwargs):
if da_active is None or not self.state.dataset_ready:
if (
da_active is None
or not self.state.dataset_ready
or da_active == self.da_active
):
return
self.da_active = da_active
da = self.data_array
self.state.ui_axis_drawer = True
self.state.ui_expanded_coordinates = []
Expand Down

0 comments on commit d7c9f9b

Please sign in to comment.