napari-matplotlib icon indicating copy to clipboard operation
napari-matplotlib copied to clipboard

EmitterGroup object has no attribute contrast_limits errors

Open K-Meech opened this issue 10 months ago • 1 comments

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

  • File > Open Sample > napari builtins > Cells (3D + 2Ch)
  • Plugins > napari matplotlib > Histogram
  • Open napari python console
  • Run commands:
nuclei = viewer.layers["nuclei"].data
mask = nuclei > 8266
viewer.add_labels(mask)

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'

K-Meech avatar Apr 23 '24 15:04 K-Meech

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...

dstansby avatar May 03 '24 14:05 dstansby