-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Fix document mode on macOS #2866
Fix document mode on macOS #2866
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.
This looks like it's on the right track; a note inline about the specifics of the implementation.
core/src/toga/app.py
Outdated
and len(self.windows) == 0 | ||
and self.documents.types != [] | ||
): | ||
asyncio.create_task(self.documents.request_open()) |
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.
This looks like the right general idea, but:
- It's the wrong place for the code. This should be part of the
create_initial_window
method. - This logic should only be triggered on macOS (or, more strictly, on platforms where
CLOSE_ON_LAST_WINDOW=True
). On other platforms (Windows, GTK), we need to open a default document, not invokerequest_open
. - There's also an interaction with command line handling. At present, Cocoa uses
HANDLES_COMMAND_LINE
to shortcut the_create_initial_window
handling; I think this means thatHANDLES_COMMAND_LINE
should only used to shortcut the argv handling.
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
I have modified The linux-wayland focus related test failures are unrelated to this PR and cannot be reproduced on my local machine. I thought maybe they are related to document based apps, but testing on my local machine, there is no unexpected dialog being shown during the test that would disrupt the widget focus during the tests. |
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 refactoring of create_initial_window
was really close, but not quite there. There's two very distinct things happening in that method - handling the command line arguments; and ensuring that there is an open window. Your version combined the two; I've split them into two separate parts.
The Wayland test failure is a transient thing that has started in the last couple of days (#2871); we're still trying to work out what is going on there.
Thanks for the patch!
Thanks for the quick response. Also, could you tell me why in the initial commit of the PR, the tests complained about |
|
Apps that specify both
document_types
and amain_window
no longer display the "Document Selection" dialog on startup in macOS.Fixes #2860
PR Checklist: