Hey all, I'm making progress on my Mail.app plugin.
Anyway, an oddity I have noticed (maybe this is not an oddity, it could
very well be the way things are intended)
Anyway, I've written the bundle class in ObjC, upon initalize, it calls
some methods which, among other things, creates all the instances
GMailAccount (you can have multiple Gmail accounts). It does this
via a Class (+) method.
GMailAccount is an extention in python of the MailAccount class (which
had the Class methods I am calling)
I cannot just do this:
[GMailAccount createAccountWithDictionary: dict] because the compiler
doesn't know that GMailAccount is a class, since I have no interface to
I can give the compiler a:
Since when python inits, it complains, "objc.error: Class already
exists in Objective-C runtime"
So, as a workaround I have done this:
[NSClassFromString(@"GMailAccount") createAccountWithDictionary: dict]
which works (sort of, more on that later)
It occurs to me that perhaps I can move the @class directive to AFTER
the PyObjC bridge has initalized (after [[PythonGlue alloc] init]),
but what I've got going now works, so I don't really want to change it.
The caveat from above was that I had to explicitly code a
createAccountWithDictionary_ method in the python part, as such:
NSLog("Init with Dict: %s" % dict)
self = super(GMailAccount, self).createAccountWithDictionary_(dict)
which, as you can see, simply calls the super. Shouldn't this whole
thing be automatic?
Also, I am having trouble with booleans, there are (ObjC) methods that
I need to call with the python equivalent of ObjC's YES and NO.
putting in YES or TRUE doesn't work. And putting in an interger (1)
doesn't seem to set the boolean.
Thanks for all the hard work! The whole PyObjC thing is pretty damn
slick, now that I have started using it. :)
Moshe Katz-Hyman | Larry King: "What, Professor, puzzles you
moshe@... | most? What do you think about
mokatz@... | most?"
215-356-2792 | Stephen Hawking: "Women." -- LKL-W