From 374c03d7a545907f190f7ac1bd7dc9ea83ed11ce Mon Sep 17 00:00:00 2001 From: Ricky O'Steen <39831871+rosteen@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:32:44 -0400 Subject: [PATCH] Dev test fix take two (#8) * Fix failing dev test by using lim_helpers * Make equivalent change in reset_limits --- lcviz/state.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lcviz/state.py b/lcviz/state.py index ddf393e2..fbab96c8 100644 --- a/lcviz/state.py +++ b/lcviz/state.py @@ -1,4 +1,3 @@ -from echo import delay_callback import numpy as np from glue.viewers.scatter.state import ScatterViewerState @@ -24,9 +23,10 @@ def _reset_att_limits(self, ax): if not np.all(np.isfinite([ax_min, ax_max])): # pragma: no cover return - with delay_callback(self, f'{ax}_min', f'{ax}_max'): - setattr(self, f'{ax}_min', ax_min) - setattr(self, f'{ax}_max', ax_max) + lim_helper = getattr(self, f'{ax}_lim_helper') + lim_helper.lower = ax_min + lim_helper.upper = ax_max + lim_helper.update_values() def _reset_x_limits(self, *event): self._reset_att_limits('x') @@ -50,11 +50,15 @@ def reset_limits(self, *event): y_min = min(y_min, np.nanmin(y_data)) y_max = max(y_max, np.nanmax(y_data)) - with delay_callback(self, 'x_min', 'x_max', 'y_min', 'y_max'): - self.x_min = x_min - self.x_max = x_max - self.y_min = y_min - self.y_max = y_max - # We need to adjust the limits in here to avoid triggering all - # the update events then changing the limits again. - self._adjust_limits_aspect() + x_lim_helper = getattr(self, 'x_lim_helper') + x_lim_helper.lower = x_min + x_lim_helper.upper = x_max + + y_lim_helper = getattr(self, 'y_lim_helper') + y_lim_helper.lower = y_min + y_lim_helper.upper = y_max + + x_lim_helper.update_values() + y_lim_helper.update_values() + + self._adjust_limits_aspect()