From 44377f5f65671363a5ead522204fb04d6344452f Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 26 Jan 2021 17:27:09 -0500 Subject: [PATCH 1/2] frontend/package.json: proclaim compatibility with @jupyter-widgets/base 4.x It looks like we need this for the ipywidget to work in JupyterLab 3.x. --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index faf2df39..b7d892f6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,7 +4,7 @@ "url": "https://github.com/WorldWideTelescope/pywwt/issues" }, "dependencies": { - "@jupyter-widgets/base": "^2 || ^3", + "@jupyter-widgets/base": "^2 || ^3 || ^4", "underscore": "^1" }, "description": "AAS WorldWide Telescope from Python", From 17783828eb938d41058631e594c59aa22320d88a Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 26 Jan 2021 18:15:48 -0500 Subject: [PATCH 2/2] pywwt/annotation.py: fix sizing of circles upon creation I noticed that if you specified the radius of a circle annotation in its constructor, the units weren't working. It seems that the validation function was being skipped the way that we were applying the constructor settings. Easily worked around. --- pywwt/annotation.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pywwt/annotation.py b/pywwt/annotation.py index 8a3dc7f0..3093b9ff 100644 --- a/pywwt/annotation.py +++ b/pywwt/annotation.py @@ -45,7 +45,16 @@ def __init__(self, parent=None, **kwargs): self.parent._send_msg(event='annotation_create', id=self.id, shape=self.shape) - super(Annotation, self).__init__(**kwargs) + + # Normally we would pass the kwargs off to super().__init__(), but it + # seems that doing so bypasses the validation functions, which (at a + # minimum) causes problems for circles because it doesn't normalize + # their radius measurements to the proper units. Just apply the settings + # manually, which invokes the validation machinery properly. + super(Annotation, self).__init__() + + for k, v in kwargs.items(): + setattr(self, k, v) self.parent._annotation_set.add(self) @@ -103,7 +112,7 @@ class Circle(Annotation): line_width = AstropyQuantity(1 * u.pixel, help='Assigns line width in pixels ' '(:class:`~astropy.units.Quantity`)').tag(wwt='lineWidth') - radius = AstropyQuantity(80 * u.pixel, + radius = AstropyQuantity(1 * u.degree, help='Sets the radius for the circle ' '(:class:`~astropy.units.Quantity`)').tag(wwt='radius')