[Pythonmac-SIG] How to make an apt except Drag and Drop
Daniel Lord
daniellord at mac.com
Sun Mar 11 00:14:58 CET 2007
Christopher,
I found an example in a wiki that works perfectly accepting objects
before and after startup.
http://wiki.wxpython.org/index.cgi/Optimizing_for_Mac_OS_X
Towards the end there is a sample wxPython applications and a
setup.py file.
Be aware that you need to replace a line in the setup.py:
change "from setuptools import setup"
to "from distutils.core import setup"
but with that one change it worked perfectly for me.
My system is OS X 10.4.8 python 2.5 MacbookPro core 2 Duo
Daniel
On Mar 8, 2007, at 10:32, Christopher Barker wrote:
> 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
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
More information about the Pythonmac-SIG
mailing list