Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a widget.on_close() method #2670

Open
adamltyson opened this issue May 7, 2021 · 6 comments
Open

Support a widget.on_close() method #2670

adamltyson opened this issue May 7, 2021 · 6 comments
Labels
feature New feature or request
Milestone

Comments

@adamltyson
Copy link

馃殌 Feature

Support a method that is run when the widget is closed in napari.

Motivation

I want to mess with the viewer (hide buttons etc.), but reset everything if my plugin is closed.

Alternatives

Using viewer.window._qt_window.destroyed.connect(my_callback)

@tlambert03
Copy link
Member

tlambert03 commented May 7, 2021

ahh... you what. I totally missed the part about this being just your widget (and not the full viewer). The need for a clear API is no different... but the workaround is a bit different (let me test some stuff)

@kevinyamauchi
Copy link
Contributor

+1, this would be super useful to me as well!

@adamltyson
Copy link
Author

My bad, I just blindly copied and pasted.

@goanpeca
Copy link
Contributor

goanpeca commented May 7, 2021

Hi @adamltyson, what do you exactly mean by closing a widget in napari 馃檭 ?

  • Clicking the x on the Dock? (This does not actually close a widget, just hides it)
  • Selecting the Remove Dock Widgets from the Window Menu?

@adamltyson
Copy link
Author

I originally meant clicking the x (didn't know it only hid the widget).

@sofroniewn sofroniewn added this to the 0.4.9 milestone May 7, 2021
@sofroniewn sofroniewn added the feature New feature or request label May 7, 2021
@sofroniewn sofroniewn modified the milestones: 0.4.9, 0.4 Jun 2, 2021
@sofroniewn
Copy link
Contributor

This should be closed by #3184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants