On 6 Oct, 2011, at 19:07, Mel Walker wrote: > I have a utility application that should not be relaunched on login, so I > figure I'd better call [NSApp -disableRelaunchOnLogin] in the code, as > recommended for 10.7. The problem I'm having is that the code runs back to > 10.5. In Objective-C I would just call respondsToSelector:, but I'm having > trouble with getting the syntax correct. Google searches are not helping; > perhaps it's just too early in the morning. :-) > > (1) Could someone either point me to a good piece of sample code that would > show me the kind of thing I need to do, or
NSApp.instancesRespondToSelector_(b'disableRelaunchOnLogin') can be used to
check the application instance responds to the selector
> (2) show me a preferred Pythonic way to do the same thing?
Using this method would be fine, you could also use:
try:
anNSApp.disableRelaunchOnLogin()
except AttributeError:
pass
I'd use an explicit test to get slightly cleaner code, and code that's closer
to a common Cocoa pattern.
Ronald
>
> --
> Mel
>
> _______________________________________________
> Pythonmac-SIG maillist - [email protected]
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
