I’m having problems adding a new annotation description using the annotations toolbar. When I click “Add Description”, I see the “New Description” dialogue appear briefly, but then it disappears. After this, I can’t interact with the raw browser at all - can’t even bring it in front of other windows by clicking on it. It’s almost like the New Description dialogue is still in front of it, but invisible. Has anyone else had this problem?
cc @larsoner, the gist is we have a user with the latest MNE and qt-browser on Windows, and when they open the Annotations dialog, it appears briefly, then disappears, and after that an interaction with the browser is impossible.
I tried to reproduce the issue but was not able to, inside and outside Spyder. I tested now on Windows 11, but I din’t run into this issue when I had still Windows 10 installed.
The dialogs which opens to add a new description is modal, which means that it opens and stays in front and prohibits interaction with the Main-Window until it’s closed.
It is unusual that the modal dialog disappears behind other windows, this should be managed by Qt and/or even Windows itself.
@amyt Could you run the following in Spyder please to test if the problem comes from the modal dialog:
Hi @marsipu, thanks for your thoughts on this. Seems like the modal dialog isn’t the problem, as your test runs fine.
Actually, @richard 's suggestion of running with block=True does work - the dialogue doesn’t disappear anymore and I’m able to add “bad” as a description and mark some segments. Also confirmed that the dialogue is still disappearing when not setting block=True.
My problem now is that the browser process doesn’t end when I close it, but only on the second try. I.e. if I start a fresh console and plot the data with block=True, then close the browser, the process ends fine. But then if I run the .plot function again (again with block=True), and close the window, the process doesn’t seem to end/the console is not responsive. Do you have any thoughts on this?
Hmm that seems to not make it able to end the process even the first time. Also, sometimes the data are shown with thick lines, but other times the browser opens with thin lines, not sure if this is a clue to something or unrelated. It doesn’t seem consistent with if I use matplotlib qt or not - that said, I think it never opens with thin lines unless I do use matplotlib qt. Also, I prefer the thin lines, so would be nice to make that stick!
And this is all from Spyder? What if you run the same script a) directly from the command line using python, and b) run the same script inside ipython, on the command line too?
Hello, you should have a shortcut to a “Prompt” next to the other MNE shortcuts. If you start this, it should put you on a command line with the MNE-Python Python environment properly initialized. From there, you can navigate to the folder containing your script (via cd) and run it e.g. via python myscript.py
Hi Richard. So when running the script a) from the command line, without block=True, the browser window just flashed up and exited. When running with block=True, it worked as it should - able to add an annotation description and mark some segments. The script ended when I closed the browser. Checked this a few times.
When running the script b) using ipython on the command line, without block=True, I have the original issue I reported of the “Add Description” dialogue disappearing quickly and I can’t interact with or close the browser. (Do you know the best way to close it and free up the memory if I didn’t want to exit out of ipython?) When running with block=True everything works fine! No hanging after closing the browser. Works successfully multiple times.
Thanks for your help so far!
Does this give you any more insight into what’s happening in Spyder? Great to have a working solution for now, but would be nice to be able to use Spyder for the plots tab etc.
Perfect, so this is working as intended!
(To prevent the browser from closing when using block=False, you need to run the script via python -i myscript.py; the -i is for “interactive mode”)
Ok, this is expected too!
The “hanging” when running in IPython with block=False should go away if you first run
%gui qt5
Can you try whether this also fixes your problem with Spyder?
Okay, so %gui qt5 enabled me to use the Add Description dialogue successfully using ipython from the command line with block=False. But it didn’t fix it in Spyder, nor did it fix the script not quitting on closing the browser with block=True… I feel like we’re getting somewhere though?