From 3beb8147f733cdef458e4c3272f0ef794d55f275 Mon Sep 17 00:00:00 2001 From: Iisakki Rotko Date: Wed, 11 Dec 2024 16:45:26 +0100 Subject: [PATCH 1/2] fix: use last focused/resized view to determine shape of BqplotImageView --- glue_jupyter/bqplot/image/viewer.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/glue_jupyter/bqplot/image/viewer.py b/glue_jupyter/bqplot/image/viewer.py index 40444015..211968c8 100644 --- a/glue_jupyter/bqplot/image/viewer.py +++ b/glue_jupyter/bqplot/image/viewer.py @@ -1,3 +1,5 @@ +from datetime import datetime + from glue.viewers.image.composite_array import CompositeArray from bqplot_image_gl.viewlistener import ViewListener @@ -81,9 +83,17 @@ def _reset_limits(self, old, new): self.state.reset_limits() def _on_view_change(self, *args): - views = sorted(self._vl.view_data) + # Order view_data by focused_at and then resized_at, latest change first + views = sorted( + self._vl.view_data.values(), + key=lambda x: ( + datetime.fromisoformat(x['focused_at']), + datetime.fromisoformat(x['resized_at']) + ), + reverse=True + ) if len(views) > 0: - first_view = self._vl.view_data[views[0]] + first_view = views[0] self.shape = (int(first_view['height']), int(first_view['width'])) self._composite_image.update() else: From 16300998916b8712aac89a92bd2fa380332a3d9c Mon Sep 17 00:00:00 2001 From: Iisakki Rotko Date: Fri, 27 Dec 2024 11:33:44 +0100 Subject: [PATCH 2/2] chore: bump bqplot-image-gl dependency --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index fb5b793e..043e54b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,7 @@ install_requires = ipywidgets>=7.4.0 ipyvue>=1.2.0,<2 ipyvuetify>=1.2.0,<2 - bqplot-image-gl>=1.5.0 + bqplot-image-gl>=1.6.0 bqplot>=0.12.17 bqplot-gl scikit-image