From 3f5a0d7eb68eaea54c41ea6fdfe88bfd366e2f28 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 8 Mar 2024 15:19:03 -0500 Subject: [PATCH] manually port changed logic from slice plugin refactor to new plugin from PR https://github.com/spacetelescope/jdaviz/pull/2715 --- jdaviz/configs/default/plugins/export/export.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jdaviz/configs/default/plugins/export/export.py b/jdaviz/configs/default/plugins/export/export.py index 0e98dcdb4d..b08913c1b6 100644 --- a/jdaviz/configs/default/plugins/export/export.py +++ b/jdaviz/configs/default/plugins/export/export.py @@ -130,7 +130,7 @@ def _on_cubeviz_data_added(self, msg): # NOTE: This needs revising if we allow loading more than one cube. if isinstance(msg.viewer, BqplotImageView): if len(msg.data.shape) == 3: - self.i_end = msg.data.shape[-1] - 1 # Same as max_slice in Slice plugin + self.i_end = msg.data.shape[-1] - 1 @observe('multiselect', 'viewer_multiselect') def _sync_multiselect_traitlets(self, event): @@ -251,7 +251,7 @@ def _save_movie(self, viewer, i_start, i_end, fps, filename, rm_temp_files): raise ValueError("movie support disabled") slice_plg = self.app._jdaviz_helper.plugins["Slice"]._obj - orig_slice = slice_plg.slice + orig_slice = viewer.slice temp_png_files = [] i = i_start video = None @@ -264,7 +264,7 @@ def _save_movie(self, viewer, i_start, i_end, fps, filename, rm_temp_files): if self.movie_interrupt: break - slice_plg._on_slider_updated({'new': i}) + slice_plg.vue_play_next() cur_pngfile = Path(f"._cubeviz_movie_frame_{i}.png") # TODO: skip success snackbars when exporting temp movie frames? self.save_figure(viewer, filename=cur_pngfile, filetype="png", show_dialog=False) @@ -378,8 +378,9 @@ def save_movie(self, viewer, filename, filetype, i_start=None, i_end=None, fps=N slice_plg = self.app._jdaviz_helper.plugins["Slice"]._obj if i_start < 0: # pragma: no cover i_start = 0 - if i_end > slice_plg.max_slice: # pragma: no cover - i_end = slice_plg.max_slice + max_slice = len(slice_plg.valid_values_sorted) - 1 + if i_end > max_slice: # pragma: no cover + i_end = max_slice if i_end <= i_start: raise ValueError(f"No frames to write: i_start={i_start}, i_end={i_end}")