|
|
|
PYTHON bindings for DCOP
|
|
|
|
========================
|
|
|
|
|
|
|
|
These are the new-style Python DCOP bindings. The way in which the bindings are
|
|
|
|
implemented has changed since KDE 3.1.1.
|
|
|
|
|
|
|
|
|
|
|
|
How they work
|
|
|
|
=============
|
|
|
|
|
|
|
|
The code is divided into two parts:
|
|
|
|
|
|
|
|
pcop.cpp - the C++ interface between Python and DCOP - generates shared library pcop.so
|
|
|
|
which can be imported by Python
|
|
|
|
|
|
|
|
pydcop.py - the Python interface to pcop.cpp
|
|
|
|
|
|
|
|
pcop.cpp includes a header file marshal_funcs.h, which is generated from
|
|
|
|
a data file called marshal_funcs.data by a converter script, gen_marshal_funcs.py
|
|
|
|
|
|
|
|
marshal_funcs.data contains the basic code necessary to marshal and demarshal the different
|
|
|
|
types that DCOP can handle. For example, it codes how to convert a TQString for use by Python
|
|
|
|
(in this case, a Python string) and the reverse - what the user may supply in Python when
|
|
|
|
DCOP retquires a TQString. In addition to the fundemental types, more complex QT classes are
|
|
|
|
coded, such as TQRect (which converts to a Python tuple ( (x1,y1), (x2,y2) ) ).
|
|
|
|
|
|
|
|
Documentation is auto-generated out of marshal_funcs.data, creating file marshal_funcs_doc.html,
|
|
|
|
which details how each DCOP type (e.g. TQString, TQRect, int, QCStringList) is represented in Python.
|
|
|
|
|
|
|
|
In this implementation, each DCOP type is represented by a basic Python type - numeric, tuple, etc.
|
|
|
|
There are no "QT bindings" necessary.
|
|
|
|
|
|
|
|
These bindings allow you to code Python to act as a DCOP client (querying and/or controlling
|
|
|
|
other DCOP applications), or as a DCOP server. This means that you can DCOP-enable Python applications
|
|
|
|
even if they are not QT based.
|
|
|
|
|
|
|
|
If you want to use DCOP in the context of a Python QT application, then there are DCOP bindings included in
|
|
|
|
the PyQT and PyKDE bindings available from:
|
|
|
|
|
|
|
|
http://www.riverbankcomputing.co.uk/
|
|
|
|
|
|
|
|
Examples
|
|
|
|
========
|
|
|
|
|
|
|
|
There are some example Python programs in the test directory.
|
|
|
|
|
|
|
|
Known problems
|
|
|
|
=============
|
|
|
|
|
|
|
|
There is currently a bug which means you must import both pcop and pydcop in your Python programs.
|
|
|
|
This means that a Python program using dcoppython must include:
|
|
|
|
|
|
|
|
import pcop
|
|
|
|
import pydcop
|
|
|
|
|
|
|
|
In that order. If you don't import pcop, a seg fault occurs when the interpreter exits. This, of course, will be
|
|
|
|
fixed once I find out what the hell's going on.
|
|
|
|
|
|
|
|
Authors
|
|
|
|
=======
|
|
|
|
|
|
|
|
The original Python DCOP bindings were written by Torben Weis (weis@kde.org).
|
|
|
|
The current implementation, based on Torben's worked, was written by Julian Rockey (kde@jrockey.com).
|
|
|
|
Julian is also the current maintainer.
|
|
|
|
|
|
|
|
|