jluethi / napari-feature-visualization

Visualizing feature measurements on label images in napari
BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

Get warnings to show up in the napari gui #12

Closed jluethi closed 3 years ago

jluethi commented 3 years ago

Currently warnings only show up in the console. Get them into the napari notification system

haesleinhuepf commented 3 years ago

Maybe you know,, but just in case you were wondering how to do this: you can do this using

import warnings
warnings.warn("Hello world")

:-)

jluethi commented 3 years ago

Hey @haesleinhuepf Thanks for the input! I understand that this is how it's supposed to work, but haven't been able to actually get this working on my setup. Given that this seems to be the idea for how to do it, I am using the warnings system. But my warnings only show up in the napari console (if opened) or the jupyter notebook (if the console wasn't opened). Have you had that before? I haven't really traced it yet, just wanted to take a note here of the issue :) Bildschirmfoto 2021-05-20 um 10 56 53 Bildschirmfoto 2021-05-20 um 10 57 21

haesleinhuepf commented 3 years ago

Do the warnings show up, when the console is closed? I'm asking because I saw a bug earlier that the warnings hide behind a dock-widget on the bottom :-)

jluethi commented 3 years ago

No, even when I remove the dockwidgets from the main window, the warnings only show up below the Jupyterlab cell I use to run napari. But it looks like this is some jupyterlab + napari issue. I never see any messages pop up when launching it from jupyterlab (even error messages), but I do see the error messages as napari notification if I launch napari from the command line separately. I'll report that as an issue :)

jluethi commented 3 years ago

I reported it here: https://github.com/napari/napari/issues/2749

jluethi commented 3 years ago

This wasn't a bug, but a design decision. Wrote a small wrapper to handle this using the notifications functionality directly:

from napari.utils.notifications import show_info
show_info("i'm a message")

See https://github.com/napari/napari/issues/2749 for details Closed with https://github.com/jluethi/napari-feature-visualization/commit/29250cf61a69e92e126160e30a5ca4e4c04a9284