Ensure that programmatically closing the main window triggers on_exit handling #2643
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Derived from #2244
If you programmatically close a window, and the window is the main window, this doesn't trigger
on_exit()
handling (which could, in theory, reject the close).This also means that a MainWindow can now have an
on_close
handler.This PR moves the MainWindow class to
window.py
, in preparation for additional changes related to window handling.Reviewing note: I've found the
Window
example app very helpful in manual testing of this; it contains a MainWindow that has an on_exit handler, as well as an option to create child windows, one of which has on_close handling.PR Checklist: