[Pythonmac-SIG] How to make an apt except Drag and Drop

Christopher Barker Chris.Barker at noaa.gov
Thu Mar 8 19:32:40 CET 2007


Hi all,

I'm working on making an app accept drag and drop of files. It appears 
to do that I need to put the right incantations into the plist in the 
app bundle.

Py2app helps out a lot with that, but now I need to figure out what 
incantations I need.

The case at hand is a text editor, so I want:

- It should accept ALL text files for editing.

- It shouldn't impose its icon on anything.

- Maybe it should accept all files -- you never really know, and it 
really bugs me when an app won't accept a file that the OS thinks it 
doesn't know what to do with -- if I get Garbage, I get Garbage.

This is what I've tried:

Plist = dict(CFBundleDocumentTypes= [dict(CFBundleTypeExtensions=["*"],
                                           CFBundleTypeRole="Editor"),
                                     ]
              )

That does seem to allow it to accept all files. What if I did just want 
text? There's no way to specify all the possible extensions.

I've noticed that there is:

CFBundleTypeName

Which I could set to: "kUTTypeText"

would that do it? And is the ByndleTypeName and BundleTypeExtensions an 
AND or OR relationship?

This is all a bit confusing, as I thought OS-X figured out file types 
from combination of extensions, old Type and creator codes, and the *nix 
"file" utility. I that case, couldn't I just set a Mime-type or 
something, and let the OS (or is the Finder?) figure out extensions, 
etc. Is that what CFBundleTypeName does?

Is there anything else I should do?

This is a wxPython App, by the way but I don't think that effects this 
issue.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the Pythonmac-SIG mailing list