[PyKDE] Panel applets with PyKDE/Python

Jim Bublitz jbublitz at nwinternet.com
Mon Aug 18 22:54:00 BST 2003


I've been promising to do something with this for quite a while 
and finally got to it.

I spent some time this weekend playing around with the 
possibility of writing panel applets for KDE (kicker) in Python 
using PyKDE. David Boddie has made some preliminary code 
available which I stole from shamelessly and with mostly a 
little reorganization got it somewhat working.

The problem (you knew there was one) is that every panel applet 
would require it's own .so library, and those are hard to write 
in Python. I can come up with a template for those, but it's 
more work than I want to do and not the cleanest solution.

What I did is delegate the task - I filed a feature request with 
KDE to change the way panel applets are specified (.desktop 
file) and loaded, so that PyKDE can have a single .so that will 
load any Python-based panel applet by having an identifying 
field placed in the .desktop file for the applet. It's only a 
very small code change, but of course won't be available until 
the next KDE release if they agree to make the change.

The implementation is fairly simple - you write a one line 
factory function in Python that is called by kicker and calls 
your panel applet constructor and returns the panel applet 
object to kicker. You also need to derive your applet from 
PyKPanelApplet, which is a subclass of KPanelApplet with a one 
line destructor change and one additional method on the C++ 
side. All of this can be built into PyKDE, so you never have to 
do any C++ at all.

In the meantime I'll clean up what I have, send a copy to David 
for review and improvement, and maybe even document it.

If anyone is interested, I can post the KDE bug number and you 
can all go to bugs.kde.org and vote for it.

Jim




More information about the PyQt mailing list