[Orbit-python-list] PyORBit
Status: Inactive
Brought to you by:
tack
From: James H. <ja...@da...> - 2002-11-26 12:27:18
|
Christian told me that people had been asking about PyORBit here, so I thought I would explain some of the design decisions. My main aim was to produce an ORBit2 binding for use with the GNOME 2.x python bindings. This is the reason for the "Where it makes sense, this binding tries to stay compatible with the Python language mapping" language. This does not mean that I am going to make it gratuitously incompatible (in some areas, PyORBit follows the standard more closely than o-p). PyORBit makes use of new style types. Since PyORBit was intended to be a binding for use by the GNOME bindings which already require Python >= 2.2, I didn't consider this a problem. IMHO, this has led to much simpler code. PyORBit makes use of ORBit2 typelibs. Typelib information is fairly central to the way ORBit2 works, so this made a lot of sense. It allowed me to make use of the ORBit_small_invoke_stub() method, which speeds up in-process method invocations, as it skips marshalling to/from IIOP representation. PyORBit supports invoking methods on in-process CORBA objects implemented in C. It also allows C code to invoke methods on in-process CORBA objects implemented in Python (modulo Python interpreter lock issues that I haven't looked into much yet). Compiling typelibs is not always necessary. If the server is implemented with ORBit2, PyORBit can download the interface description from the server, so no typelib is necessary. As for dynamic IDL loading, ORBit2 >= 2.5.0 has an extra libORBit-imodule library that can be used to parse IDL into interface descriptions. I haven't wrapped this yet because I wanted to stay compatible with ORBit2 2.4.x, so that it would work in a GNOME 2.0 setup. It will be added in a future release though. I currently support marshalling and demarshalling of void, short, ushort, long, ulong, enum, float, double, boolean, char, octet, any, TypeCode, objref, exception, struct, union, string, sequence, array, longlong, ulonglong, wchar and wstring (as Python unicode strings) types. Boolean types are converted to the Python True and False objects so with Python 2.3, they will print nicely. Interface attributes are also exposed as object properties. This was trivial to implement using new features found in Python 2.2. It essentially does the equivalent of "foo = property(_get_foo, _set_foo)", without worrying about messy __getattr__/__setattr__ implementations. Although PyORBit was designed for use with the gnome bindings, it should be generally useful. I welcome bug reports, which can be sent to the pygtk list or me for now. I should get around to adding a pyorbit product to bugzilla.gnome.org ... The latest version of PyORBit can be found at: http://ftp.gnome.org/pub/GNOME/sources/pyorbit/1.99/ James. -- Email: ja...@da... | Linux.conf.au http://linux.conf.au/ WWW: http://www.daa.com.au/~james/ | Jan 22-25 Perth, Western Australia. |