QTreeWidget from list of path like strings
See original GitHub issueI was about to code something up as a one off (and probably still wise for me to start there) but then I thought it might be ultimately a nice re-usable piece of Qt code we’d want to provide to plugin devs. I have a list of paths (they happen to come from inside a zip file from a url, but really they could also come from anywhere) - a small snapshot looks like
['RxRx19a/',
'RxRx19a/LICENSE',
'RxRx19a/images/',
'RxRx19a/images/VERO-1/',
'RxRx19a/images/VERO-1/Plate1/',
'RxRx19a/images/VERO-1/Plate1/AC41_s4_w3.png',
'RxRx19a/images/VERO-1/Plate1/G38_s3_w1.png',....]
and I’d like to use a QTreeWidget to browse them as described in posts like this one on stackoverflow.
When i select a path with a png
I’d then like to trigger some calls that will lead to a new image being displayed in the viewer - i.e. turning napari into a little file browser for this remote zip. It might also be nice to have similar browser capability for local files too.
Curious what you think of this @tlambert03 or if you have any tips before I got going? I’d say this is more of a hobby use of napari rather than a top development priority, but always fun to be trying to push it in new ways 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (14 by maintainers)
Following up I made a new cool demo doing a similar thing but with my local file browser.
Clears and loads new image data via
viewer.open_path
/viewer.open
when selected. Makes for fun browsing!!! Should probably remove the open/ cancel buttons@JacksonMaxfield this is a different use case I think. Both a file browser and a world browser can live side by side in the napari plugin ecosystem. 😊 In the case of magicgui, I think we mostly want to support standard or quasi-standard widgets. Note that above the whole thing is a QFileDialog, so we can’t really go in and move things around.