ilastik/ilastik-napari

Plugin broken in recent napari version

Closed this issue ยท 7 comments

jni commented

It appears we've moved some of the private Qt resources that napari-ilastik was using:

In [2]: import napari_ilastik.plugin
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-6903497af003> in <module>
----> 1 import napari_ilastik.plugin

~/conda/envs/all/lib/python3.8/site-packages/napari_ilastik/plugin.py in <module>
      4 import sparse
      5 from napari import Viewer
----> 6 from napari._qt.containers.layers import QtLayerList
      7 from napari.layers import Image, Labels, Layer
      8 from napari.qt.threading import thread_worker

ModuleNotFoundError: No module named 'napari._qt.containers.layers'

Not sure what the best fix is but thought I'd note it down.

jni commented

Ideally we should have a discussion about why you're using a private API and whether we could provide some public functionality to suit your needs, though! ๐Ÿ˜Š

Hi @sofroniewn and @jni! Sorry for not fixing this earlier. It was left as-is from the demo day.

I need QtLayerList for displaying and selecting layers in several Qt combo boxes, see napari/napari#2493 (comment).

Judging by the underscored name, napari._qt.containers is a private module, but I think this QtLayerList or something similar will be useful for other people as well. It would be great to have this provided as a public API.

jni commented

@emilmelnikov we can alias Qt things that we want to be public in napari.qt, but my question is why you want this instead of the base viewer.layers model (the type is napari.components.layerlist.LayerList)?

@emilmelnikov we can alias Qt things that we want to be public in napari.qt, but my question is why you want this instead of the base viewer.layers model (the type is napari.components.layerlist.LayerList)?

I needed one of QAbstractItemModel to plug into Qt widgets. As far as I understand, LayerList mimics Python list, which is awesome to use from Python, but, unfortunately, you cannot use it as a data source in Qt views.

I guess this is something that we could also think about pulling out into supeqt - see https://github.com/napari/superqt/issues/6 but it runs into the same questions about our own event system @tlambert03

it runs into the same questions about our own event system @tlambert03

well, this is kind of what got me started on making psygnal ๐Ÿ˜„
I do want to make those QtViews more public. i think they're nice objects... and I know @alisterburt wanted them too. So, maybe?