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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor window closing and app exit handling #980

Merged
merged 50 commits into from
May 29, 2021
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
ea28928
Re-add on_exit handling and showing second window to winforms backend
obulat Jul 22, 2020
c5c8232
Add Secondary window and on_exit testing to dialogs app
obulat Jul 23, 2020
7f88423
Fix incorrect question dialog result
obulat Jul 23, 2020
452aa49
Add cancel_exit parameter to app.on_exit
obulat Jul 23, 2020
7b2bdac
Fix dialogs app
obulat Jul 23, 2020
c77bfbe
Fix flake8 error
obulat Jul 23, 2020
c015b2c
Add window on_close handler for secondary windows
obulat Jul 23, 2020
64806ed
Fix pep8 violation
obulat Jul 23, 2020
1987af2
Add initial value for window._on_close
obulat Jul 23, 2020
70540fb
Change window_count to secondary_window_count in Dialogs example app
obulat Jul 27, 2020
c214df8
Add `windows` set-like object to app
obulat Jul 29, 2020
8dcf638
Update window tests to add `app.windows +=` for adding window to app
obulat Aug 6, 2020
9a175c7
Rework handling of window closing
obulat Aug 7, 2020
189945f
Update tests, replace window on_close with toga_on_close
obulat Aug 7, 2020
36b2252
Transfer `on_close` handler logic (removing window from app.windows a…
obulat Aug 10, 2020
2842bff
Remove stray print and obsolete TODO
obulat Aug 10, 2020
7dfabf0
Fix pep8 violation
obulat Aug 10, 2020
7ced499
Add methods to pass tests
obulat Aug 19, 2020
246ef5c
Merge branch 'master' into winforms-on-exit
saroad2 Sep 27, 2020
cd5996a
Call on_exit when exiting an app using the exit() method
saroad2 Sep 27, 2020
42ab90c
Revert "Call on_exit when exiting an app using the exit() method"
saroad2 Sep 27, 2020
f3643a8
Merge remote-tracking branch 'origin/master' into winforms-on-exit
Mar 27, 2021
33d4921
Merge branch 'master' of https://github.com/beeware/toga into winform…
obulat Apr 14, 2021
cf6d32b
Add tests for window and app
obulat Apr 14, 2021
5d64c23
Fix flake8 error
obulat Apr 14, 2021
6d0c7d3
Remove interface window when closing it in cocoa
obulat Apr 14, 2021
fe53938
Add dummy factory to tests
obulat Apr 14, 2021
9b945cf
Fix app window iteration tests
obulat Apr 14, 2021
beea045
Refactor window close / app exit handling in cocoa
obulat May 8, 2021
f8ac0b1
Refactor winforms on_close / on_exit handlers
obulat May 8, 2021
dc12978
Readd on_close to MainWindow to pass tests
obulat May 8, 2021
d937748
Rename toga.Window.on_close to toga_on_close
obulat May 8, 2021
5fa9a35
Rename on_close to toga_on_close for MainWindow
obulat May 8, 2021
b36ce6b
Rename on_close to toga_on_close for MainWindow in gtk
obulat May 8, 2021
01e6cec
Rename on_close to toga_on_close for MainWindow in winforms
obulat May 8, 2021
17ff511
Add test_app_contains_window test
obulat May 8, 2021
62313e5
Fix exit handling; make on_close/on_exit return Boolean
obulat May 10, 2021
3099f96
Fix Winforms cancelling exit/window close events
obulat May 13, 2021
fa3891b
Improve demonstrations for on_close behavior.
freakboy3742 May 15, 2021
105c388
Enable on_close handler for main window.
freakboy3742 May 15, 2021
a8dbfc9
Correct behavior for cocoa on_close handling.
freakboy3742 May 15, 2021
e2a2593
Corrected impl on_close handling on gtk and winforms.
freakboy3742 May 15, 2021
ebf3c88
Disable setting on_close for main window
obulat May 23, 2021
2b871ec
Fix Winforms windows cancelling closing
obulat May 23, 2021
c791b9b
Fix failing test
obulat May 23, 2021
6b21942
Cleanups and clarifications of dialogs example app.
freakboy3742 May 29, 2021
4fc1e1d
Added inline documentation to explain logic.
freakboy3742 May 29, 2021
a61f936
Factored on_exit handling into the interface layer to ensure consiste…
freakboy3742 May 29, 2021
04ed041
Use platform-prefix naming for event handlers.
freakboy3742 May 29, 2021
cabef46
toga_on_close is an implementation detail.
freakboy3742 May 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/winforms/toga_winforms/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ def show(self):
)
self.interface.content.refresh()

self.native.Show()
if self.interface is self.interface.app._main_window:
self.native.FormClosing += self.winforms_form_closing

def winforms_FormClosing(self, event, handler):
if self.interface is not self.interface.app._main_window:
self.native.Show()

def winforms_form_closing(self, event, handler):
if self.interface.app.on_exit:
self.interface.app.on_exit(self.interface.app)

Expand Down