matplotlib / napari-matplotlib

Linking napari layers with Matplotlib plots
https://napari-matplotlib.github.io/
BSD 3-Clause "New" or "Revised" License
37 stars 20 forks source link

EmitterGroup object has no attribute contrast_limits errors #259

Closed K-Meech closed 1 month ago

K-Meech commented 4 months ago

With the latest napari-matplotlib and napari, I'm seeing some odd errors while the histogram is open: AttributeError: 'EmitterGroup' object has no attribute 'contrast_limits'. This error doesn't appear when running the same commands below without the histogram open.

To reproduce

Error

File ~\anaconda3\envs\napari-env-matplot-testing\lib\site-packages\napari_matplotlib\histogram.py:59, in HistogramWidget.on_update_layers(self)
     57 super().on_update_layers()
     58 for layer in self.viewer.layers:
---> 59     layer.events.contrast_limits.connect(self._update_contrast_lims)

File ~\anaconda3\envs\napari-env-matplot-testing\lib\site-packages\napari\utils\events\event.py:978, in EmitterGroup.__getattr__(self, name)
    977 def __getattr__(self, name) -> EventEmitter:
--> 978     return object.__getattribute__(self, name)

AttributeError: 'EmitterGroup' object has no attribute 'contrast_limits'
dstansby commented 4 months ago

Thanks for the report and easy reproduction instructions! I think I tracked it down and have a fix, just need to battle with tech debt since I last did a release...