-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
Modify dialogs to allow for async usage. #1464
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The open_file_dialog
and the select_folder_dialog
do not exist in Android's window.py which will probably raise an error when called. We should add these methods with a "not implemented" code or implement my file/folder chooser PR. Implementing my file/folder chooser might be problematic because we get back an URI and not a file path.
Codecov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An elegant solution. Though my first instinct was: what black magic makes this work, how can a dialog be both awaitable and return a result in a regular call?
In the end, the effect of being able to await to get the result, or to set a on_result
handler, works well. The doc strings however mislead me with their "Returns" documentation. In fact, the toga.Window
dialog methods all return awaitables...
Modifies dialogs to allow for async usage.
This is primarily driven by the Android use case, which doesn't have a synchronous mode of dialog presentation; however, it also allows for simplification of dialogs on other platforms (like iOS) which require some gymnastics to support async.
This allows for both async and sync usage of dialogs. i.e., the following are all legal
Builds on:
PR Checklist: