[Pythonmac-SIG] Launching a python app with an associated document
Mike Covill
mcovill at mac.com
Fri Jun 30 20:54:22 CEST 2006
Does anyone have experience creating a pure python app (no Cocoa
integration) which is associated with a document extension?
We would like to be able to launch our application by double-clicking
an associated document (associated using CFBundleDocumentTypes in the
info.plist) and having the data in the document loaded into the
python app. I have added the following code to our setup.py file:
plist = dict(
CFBundleDocumentTypes = [
dict(
CFBundleTypeExtensions=["madf",],
CFBundleTypeName="myApp Data File",
CFBundleTypeRole="Editor",
CFBundleTypeIconFile='myAppDocument.icns',
),
]
)
py2app_options = dict(...,
plist=plist,
)
the application now launches when we double-click on the document,
but I have yet to find how we might feed the contents of the document
to an appropriate reader function inside our app. We had a look at
the sys.argv list passed in to main.py thinking the name of the
document might be in there but this doesn't seem to be the case. We
also checked os.environ.
Thanks for any help or pointers to relevant info,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20060630/95dbae61/attachment.htm
More information about the Pythonmac-SIG
mailing list