-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update viewer variable when changing focused console (multiple consoles sharing the same kernel handling) #42
base: main
Are you sure you want to change the base?
Conversation
…es sharing the same kernel)
looks good |
So, I think this is better than the status quo so I'm happy for it to go in. However, now that we have a full namespace capture, I don't think we need to inject The import napari
viewer = napari.Viewer(title='viewer 1')
viewer2 = napari.Viewer(title='viewer 2')
napari.run() Now, we can't access I know it's a big change to drop the special variable, but we could do so gradually. Suggestions (can be taken individually, or simply ignored 😅):
What do folks think? |
My issue appears to be related to pyqt6: #40 (comment) Something I noticed:
The console button in v1 was toggling the console of v2! SO things are quite entangled now. Also I think every snippet we have anywhere does Honestly, I didn't even know about the magic viewer until now. I thought it was a thing in the case of launching napari from the command line.
|
I do not agree. Some plugins may spawn the next viewer instance (ex PartSeg allows for this) so you may have more than one viewer without script. |
We do already have |
Another idea, in case the main need is to be able to access any viewer from any console (and even if no variable is assigned to the viewer when creating it), is to create a |
I think that you are referring to napari/napari#5664 |
@Czaki I don't follow, can you elaborate on this use case? |
@dalthviz if you don't mind, lets make the pyqt6 fix |
The are not without names, but they are certainly in different Python frames: in one case, you launch the viewer in code, and in the other, you click a button within the first viewer and get a new viewer — the variable pointing to it is never going to be in the same namespace as the first viewer. As a totally inaccurate example, one would be "viewer" and the other would be somewhere like "viewer.window._qt_window._dock_widgets.getChildren()[0]". I think users would rather type |
In general, the use case is to compare the same datataset with different annotations. |
Closes #40
Closes #41 (superseded)
Follow up of the idea at #40 (comment)
Example script:
Run via
python script.py
A preview: