Skip to content

Conversation

@yrkim98
Copy link
Collaborator

@yrkim98 yrkim98 commented Sep 19, 2025

Purpose

This fixes layer_change napari event being deprecated.

Some background- we developed the plugin to respond to a napari layer_change event. Napari used to emit this event on any change to the layer list or any items inside napari's layer list, and we used this event to respond to sync our FileInputWidget up with the list of images available on the napari layer list.

Now, napari seems to have gotten rid of the more general layer_change event for more fine grained events that fire based on different changes to the layer list.

The four events we need to be aware of are:

  • layers.events.inserted (image added)
  • layers.events.removed (image removed)
  • layers.events.moved (layer reordered)
  • layers.events.changed (an existing layer modified)

Changes

I made the smallest change possible, which was directly replacing the layer_change event with the four events above that the plugin needs to be aware of when responding to changes in the layer list.

A more ideal change would be to create dedicated handlers which respond to these changes individually, but this is a much bigger refactor. for now this keeps the plugin happy with the latest version of napari

Since we made this change, we can no longer use layer_change events and we have to drop support for all napari versions < 0.6.2, which means we need to drop python 3.9 support as well (since napari==0.6.2 only supports python 3.10 and above)

Testing

Tested by installing fresh on windows, and running a full curation -> training -> prediction -> thresholding run.

How to review

Small change

@yrkim98
Copy link
Collaborator Author

yrkim98 commented Sep 19, 2025

test pass locally but fail on ci, checking

Copy link
Collaborator

@hughes036 hughes036 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments about event super and using new fake more effectively.

@yrkim98 yrkim98 merged commit 9ef8d80 into main Sep 22, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants