[PyKDE] Plugins in Python

Jim Bublitz jbublitz at nwinternet.com
Thu Aug 7 22:44:00 BST 2003


On Thursday August 7 2003 10:02, Roland Schulz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----

> On Thursday 07 August 2003 18:33, Jonathan Gardner wrote:
> > On Wednesday 06 August 2003 03:34, Roland Schulz wrote:

> > > how much work would it be, to make it possible to write Qt
> > > Plugins in Python? I think this be especilly useful,
> > > because one could create Custom Widgets with Plugins in
> > > Python. In case we could fix the Plugin Loader so it also
> > > loads Python libs, probably no change to Qt Designer would
> > > be required.

> > Have you searched the archives? I vaguely remember several
> > seperate discussions on this topic over the past year and a
> > bit.

> You're right. I didn't searched enough.

> Jim, you wrote 15 months ago, that you're planning to work on
> this. How far did you get?

I haven't gotten anywhere at all with it. What I had working was 
plugins for KSpread which is a more open plugin interface than 
Qt's appears to be. I've only looked at Qt's plugin docs this 
morning, so don't much about it.

Generally, there are a couple things that should be common to all 
"plugin" type interfaces (KOffice plugins, panel applets, Qt 
plugins, whatever):

The first you've already noted - you need to pull in the Python 
interpreter somehow and be able to communicate with it.

The second is that plugins need to know something about the API 
they're plugging into, and there needs to be a "bridge" between 
the C++ API and the Python code. You can do this with bindings, 
but, for example for KSpread, the bindings would be huge and 
difficult to use. The other alternative is a "thin wrapper" that 
exposes the internals of the API to Python - these are pretty 
easy to write on the one hand and can be customized to provide a 
usable programming environment on the other hand. You can still 
use sip to generate the bindings lib for this wrapper.

This would be a great project for someone to take the initiative 
on - as I've said in the past, if no one else does it, I'd like 
to get to it eventually, but 'eventually' may be a long time in 
the future. You could also track down some of the stuff David 
Boddie's been doing with KControl and panel applets (posts to 
the list over the last few months - May and June?), as it's 
probably similar in nature. As part of getting PyKDE on track, 
I'd like to include some of that stuff in the future, but even 
that's still a few weeks off before I get a chance to look at it 
thoroughly.

Jim




More information about the PyQt mailing list