-
-
Notifications
You must be signed in to change notification settings - Fork 672
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
Add app-level dialogs. #2669
Add app-level dialogs. #2669
Conversation
eb7c6eb
to
a1db4b8
Compare
@mhsmith There's something odd going on with the macOS M1 testbed... it's passing 100%, then reporting a failure. I'm guessing this is a segfault on cleanup or coverage; I need to investigate further. However, I'd be interested in your high level thoughts on this as an approach. What I've done here is the obvious approach - replicate the Window dialog APIs onto App. A different approach would be to expose
I'm not especially enthused about the spelling of either of these APIs... the former feels like creating a temporary object for no reason; the latter doesn't feel consistent with the rest of the Toga API. I'm open to other suggestions if you have them. That said - the one notable upside to It also gives us an opportunity to fully deprecate dialog |
I think that would be very useful, because the App and Window pages are already getting quite large.
|
07c95be
to
3675237
Compare
3675237
to
3659c18
Compare
At present, all dialogs are defined at the Window level. This means you need to have a window instance to display any dialog.
However, not all dialog requests are necessarily window specific; and with the introduction of session-based and background apps (#2651), there will be situations where there isn't a window to which a dialog can be attached.
This PR modifies the API for dialogs to allow for app-based dialogs. It does this by deprecating the older "functional" dialog methods on Window, in favor of surfacing the dialogs as public classes; these classes can be displayed by calling
await window.dialog(some dialog)
andapp.dialog(some dialog)
.On macOS and GTK, window-based dialogs are presented as "sheets" attached to the window; app-based dialogs are presented as free floating. Windows presents all dialogs at the app level. iOS and Android always have a window, so app-level dialogs are presented in that context.
This change necessitated a fairly major rework of dialog testing. The old API displayed the dialog on creation, but returned an object that could be awaited; the new API doesn't display the dialog until an async
show
method is invoked.PR Checklist: