Re: [Pythonmac-SIG] Some new tools: plistservices, userdefaults,
and CFPython
by Bob Ippolito other posts by this author
Sep 5 2003 11:15PM messages near this date
[Pythonmac-SIG] Some new tools: plistservices, userdefaults,
and CFPython
|
Re: [Pythonmac-SIG] Some new tools: plistservices, userdefaults,
and CFPython
On Thursday, Sep 4, 2003, at 19:31 America/New_York, Sarwat Khan wrote:
> Hi all,
>
> I released some stuff today that should interest you guys.
> plistservices and userdefaults are Python modules. CFPython is a
> library to make working with the Python C API and CoreFoundation
> easier.
>
> plistservices is like plistlib in that it supports reading and writing
> of property list data, but unlike the version included with Python 2.3
> it supports plists of any time (not just dictionaries). Most
> importantly plistservices includes an ISO 8601 parser to create
> datetime objects, so you don't need to install PyXML to use property
> lists that use dates. However, plistservices requires Python 2.3.
>
> plistservices is very Cocoa-like in its interface; it's intended to be
> used like NSPropertyListSerialization. plistservices includes Date
> (datetime.datetime), Data, and TimeInterval classes to make it easier
> to work with code or data that was intended for Cocoa or PyObjC.
>
> userdefaults is a Python interface to CFPreferences (or
> NSUserDefaults). This lets you read and write your script's
> preferences to the current user's ~/Library/Preferences folder as well
> as access system preferences (such as NSCurrencySymbol or
> com.apple.sound.beep.sound).
>
> CFPython was used to implement userdefaults and is a translator
> between PyObject<=>CFTypeRef. It's more functional than the
> pycfbridge.c included with the Python 2.3 source, however. Currently
> it only supports translation of property list types, as that was all I
> was interested in implementing. It's a very useful library however, as
> it lets you write all your logic using Cocoa or Carbon and then
> perform the data translations as necessary when you need to supply or
> get data from Python.
I dunno if it's more functional than the pycfbridge... I've been able
to get away with using the bridge's conversion functions and crossing
my fingers and hoping what I wanted to get pops out.
Some quick suggestions:
You should probably rewrite the module to use the existing pycfbridge
for interoperability, like PyObjC and my LaunchServices do.
Since you have this context object that gets passed to _every
function_, you should encapsulate that functionality in a python class
and make all the functions in the module instance methods of that class.
Create a distutils setup.py script to make life for other developers
easier. It wouldn't be hard to make one, considering you have a single
source file to contend with and one framework to link to.
-bob
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@[...].org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Thread:
Sarwat Khan
Bob Ippolito
Sarwat Khan
Bob Ippolito
|