-
Notifications
You must be signed in to change notification settings - Fork 44
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
Cannot get NSWindowDelegate protocol(s) applicationDidFinishLaunching: to work #485
Comments
bump |
I have what may be the same problem with |
You need to specifically call NSApplication's
If you go that route, you also need to add a _ to the end of You could also instead change the AppDelegate to a subclass of NSApplication, then define |
My problem turned out to be a matter of scope for the |
@SKaplanOfficial 's explanations looks like the most likely fix to me. I'd advise against subclassing NSApplicaition unless you really have to, the preferred pattern for this in Cocoa is to use the application delegate for this. |
Describe the bug
I wouldn't want to put this completely as a bug per se, but I have modeled after the pyobj-c examples exactly to the best of my ability, and I am not sure what to make of this situation looking at the PyObj-C protcols support page either.
When I am creating my AppDelegate.py I add the NSWindowDelegate protocols methods such as applicationDidFinishLaunching: and applicationShouldHandleReopen:hasVisibleWindows:, but I they don't seem to trigger or anything when they are supposed too. I have the correct named parameters they take in the docs as well, I have looked around the internet for a bit but I can't find any good answers specifically in PyObj-C contexts. Do I need to be doing something else? A decorator?
Platform information
To Reproduce
Use my AppDelegate.py, WindowController.py, my main.py, any anything else from my repo to see what I have fully setup.
Expected behavior
Have
applicationDidFinishLaunching:
print my message when the app launches, and haveapplicationShouldHandleReopen:hasVisibleWindows:
trigger my print statement as well when my dock icon is clicked on, at least according to here.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: