Open jfoster17 opened 1 year ago
NB -- this will also apply to RegionScatterLayers (once they are implemented). We can fix both at once.
I would guess that changing the offending line to polar = getattr(layer._viewer_state, 'using_polar', False)
should be enough to fix this, but I admittedly haven't tried it.
That would deal with this particular error, but there are other calls to layer._viewer_state
in this to fix.
Ah yeah, looks like there are similar calls for other scatter viewer state properties (full sphere, degrees)
I don't know when exactly this broke, but this is clearly something that I didn't check on when I added the support for the full-sphere and angle unit functionality. I can confirm that doing e.g.
polar = getattr(layer._viewer_state, 'using_polar', False)
full_sphere = getattr(layer._viewer_state, 'using_full_sphere', False)
degrees = getattr(layer._viewer_state, 'using_degrees', False)
will make things work for a scatter layer in an image viewer.
I'm not sure what adding support for region layers would entail - if the behavior for those is significantly different we could use a dispatch function for the layer export. Not ideal, but we do need some kind of check on the viewer state so we can properly handle any pretransforms that the exporting viewer is using.
Describe the bug The "Save Python script..." option fails for an ImageViewer with a Scatter layer on top.
To Reproduce Steps to reproduce the behavior such as:
Details:
python --version
): Python 3.10glue --version
): 1.14Additional context I'm not sure when/if this previously worked. It seems like much of the logic in
python_export_scatter_layer
assumes that we are exporting a standalone ScatterViewer (many calls to layer._viewer_state). The hacky fix would be to disable this option for an image viewer with additional non-image layers on top.