Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add numbered viewer variables to be able to access multiple created viewers #41

Closed
wants to merge 1 commit into from

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Dec 6, 2024

Closes #40

Enable to access all the available viewers by adding a viewer{number} variables as needed. For example, if you create from a single script to viewers you will be able to access/interact with both: one via a viewer0 variable and the other one via viewer1. A preview:

multiconsole_support_vars

Notes

  • One thing that this implementation is not covering is to remove the variable referencing the viewer once the viewer is closed/deleted. So, with this implementation, you will be able to access the deleted viewer from another viewer/napari mainwindow instance and then getting an error when trying to do any operation with the closed/deleted viewer variable. Tried setting some clean up logic at the console closeEvent using either self.push (setting the respective numbered viewer variable to be something like None) or calling the shell reset_selective and drop_by_id methods but none of those calls helped as far as I was able to check 🤔 Any ideas to handle this are appreciated!

@dalthviz dalthviz marked this pull request as ready for review December 6, 2024 16:32
@Czaki
Copy link
Contributor

Czaki commented Dec 6, 2024

Would it be possible to save the current viewer number and remove the reference in closeEvent?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with viewer variable with multiple viewers and consolas
2 participants