Skip to content

Commit

Permalink
Merge branch 'main' of github.com:glue-viz/glue-jupyter into scatter_…
Browse files Browse the repository at this point in the history
…options
  • Loading branch information
CyclingNinja committed Sep 16, 2024
2 parents da8f40b + ff6f473 commit 583d19d
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
28 changes: 28 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Full changelog

## v0.22.2 - 2024-09-03

<!-- Release notes generated using configuration in .github/release.yml at main -->
### What's Changed

#### Bug Fixes

* Disable scatter viewer density map image broadcast when not visible by @kecnry in https://github.com/glue-viz/glue-jupyter/pull/467

**Full Changelog**: https://github.com/glue-viz/glue-jupyter/compare/v0.22.1...v0.22.2

## v0.22.1 - 2024-08-20

<!-- Release notes generated using configuration in .github/release.yml at main -->
### What's Changed

#### Bug Fixes

* Remove debug panel in ipyvolume viewers by @Carifio24 in https://github.com/glue-viz/glue-jupyter/pull/457
* Updates for ipyvolume viewer issues by @Carifio24 in https://github.com/glue-viz/glue-jupyter/pull/456
* Fix issue with contour labels not updating after unit change by @astrofrog in https://github.com/glue-viz/glue-jupyter/pull/461

#### Other Changes

* Allow using non-SVG icons in toolbar by @Carifio24 in https://github.com/glue-viz/glue-jupyter/pull/465

**Full Changelog**: https://github.com/glue-viz/glue-jupyter/compare/v0.22.0...v0.22.1

## v0.22.0 - 2024-06-26

<!-- Release notes generated using configuration in .github/release.yml at main -->
Expand Down
1 change: 1 addition & 0 deletions glue_jupyter/bqplot/image/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs):
self.add_callback('level_mode', self._update_levels)
self.add_callback('levels', self._update_labels)
self.add_callback('attribute_display_unit', self._convert_units_c_limits, echo_old=True)
self._convert_units_c_limits(None, None)

self._update_levels()

Expand Down
2 changes: 2 additions & 0 deletions glue_jupyter/bqplot/image/tests/test_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def test_contour_units(

assert_allclose(image.state.layers[0].levels, [0.1, 0.3, 0.5, 0.7, 0.9])

image.state.layers[0].attribute_display_unit = 'mm'
image.state.layers[0].attribute_display_unit = 'km'
image.state.layers[0].attribute_display_unit = 'm'

assert_allclose(image.state.layers[0].levels, [100, 300, 500, 700, 900])
Expand Down
1 change: 1 addition & 0 deletions glue_jupyter/bqplot/scatter/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def __init__(self, view, viewer_state, layer_state=None, layer=None):
vmin=self.density_auto_limits.min,
vmax=self.density_auto_limits.max,
histogram2d_func=self.compute_density_map,
visible=False
)

self.view.figure.marks = list(self.view.figure.marks) + [
Expand Down
5 changes: 4 additions & 1 deletion glue_jupyter/bqplot/scatter/scatter_density_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(
stretch=None,
dpi=None,
external_padding=None,
visible=True,
):

# FIXME: need to use weakref to avoid circular references
Expand All @@ -91,6 +92,7 @@ def __init__(
self.vmin = vmin
self.vmax = vmax
self.stretch = stretch
self.visible = visible

if dpi is not None:
self.dpi = dpi
Expand All @@ -106,6 +108,7 @@ def __init__(
self.observe(self._update_rendered_image, "vmin")
self.observe(self._update_rendered_image, "vmax")
self.observe(self._update_rendered_image, "stretch")
self.observe(self._update_rendered_image, "visible")

self._scale_image = ColorScale()
self._scales = {
Expand Down Expand Up @@ -194,7 +197,7 @@ def _update_counts(self, *args, **kwargs):

def _update_rendered_image(self, *args, **kwargs):

if self._counts is None:
if self._counts is None or not self.visible:
self.image = EMPTY_IMAGE
return

Expand Down
12 changes: 10 additions & 2 deletions glue_jupyter/common/toolbar_vuetify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from mimetypes import guess_type
import os
import ipyvuetify as v
import traitlets
Expand Down Expand Up @@ -70,14 +71,21 @@ def _on_change_active_tool(self, change):
def add_tool(self, tool):
self.tools[tool.tool_id] = tool
# TODO: we should ideally just incorporate this check into icon_path directly.
ext = os.path.splitext(tool.icon)[1][1:] or "svg"
if os.path.exists(tool.icon):
path = tool.icon
else:
path = icon_path(tool.icon, icon_format='svg')
path = icon_path(tool.icon, icon_format=ext)

format = guess_type(path)[0]
image_prefix = "image/"
if format is None or not format.startswith(image_prefix):
raise ValueError(f"Invalid or unknown image MIME type for: {path}")
format = format[len(image_prefix):]
self.tools_data = {
**self.tools_data,
tool.tool_id: {
'tooltip': tool.tool_tip,
'img': read_icon(path, 'svg+xml')
'img': read_icon(path, format)
}
}

0 comments on commit 583d19d

Please sign in to comment.