[Pythonmac-SIG] noob question: handling protocols and files

Bob Ippolito bob at redivi.com
Sat Aug 6 05:01:28 CEST 2005


On Aug 5, 2005, at 4:51 PM, Kevin Dangoor wrote:

> I've been looking through the docs on Apple's site a bit today, and
> I'm not entirely certain where I *should* be looking. All I need is a
> pointer to the correct terminology for what I'm trying to do (and if
> PyObjC offers any specific bits that I should be aware of), and I
> should be good to go from there.
>
> I'm trying to figure out how to make my app open something the user
> has requested to open from another app. My app is registered nicely
> via LaunchServices with a trivial addition to Info.plist. I'm using
> CFBundleURLTypes to register a URL scheme.
>
> So, once that is registered, how do I actually get the incoming URL?

You may have to do that with a get URL apple event handler, see here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ 
Scriptability/Concepts/ScriptabilityOverview.html
(you shouldn't need any Carbon)

Speaking of which, it might be cool if someone submitted a patch to  
the PyDocURLProtocol example to make it handle the "pydoc" URL scheme  
from other applications, rather than just its own WebKit view.
https://svn.red-bean.com/pyobjc/trunk/pyobjc/Examples/WebKit/ 
PyDocURLProtocol

> I've gathered that the application delegate gets called when the user
> wants to open a file. Is a subclass of NibClassBuilder.AutoBaseClass
> an application delegate?

The application delegate is the object wired up to the delegate of  
the NSApplication instance.. it has nothing to do with what the  
superclass is.  NibClassBuilder.AutoBaseClass reads the nib file to  
determine what the superclass is.

-bob



More information about the Pythonmac-SIG mailing list