Re: [Pyobjc-dev] Passing objects between PyObjc and SWIG
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2008-03-21 16:29:29
|
On 21 Mar, 2008, at 6:08, Kyle Johnson wrote: > On Thu, Mar 20, 2008 at 7:05 AM, Ronald Oussoren <ron...@ma... > > wrote: >> >> On 20 Mar, 2008, at 11:27, Kyle Johnson wrote: >>> So basically, I need to code something which converts the PyObjc >>> internal type to a SWIG-understandable internal type. >> >> Those types are automaticly generated. >> >> You can use the __cobject__() method on all Objective-C or >> CoreFoundation objects to get a Python CObject that wraps the raw >> pointer. That might be easier to convert to something that swig >> might >> understand. > > > Thank you for the info, Ronald. I think I'm going in the right > direction with this now. > > I think there may be some wrapping still going on though with > __cobject__ as I'm getting invalid context errors from Core Graphics > (via Cairo). You are the first user of this API, but looking at the code I'd say say that the implementation of __cobject__ is obviously correct. Are your Cairo wrappers available somewhere? This would be easier to debug if I had access to the code. BTW. If you don't mind having a hard dependency on PyObjC you could drop SWIG and use PyObjC instead, with some luck without writing a line of C code. PyObjC can use the bridgesupport files generated by gen_bridge_metadata(1) on Leopard, and it should be possible to use that tool to generate an XML description of the cairo API's. Ronald |