[PyKDE] Status of panel applets?

Maurizio Colucci seguso.forever at tin.it
Fri Aug 27 20:35:55 BST 2004

Hello everybody,

On Monday 21 June 2004 23:11, Jim Bublitz wrote:
> On Monday 21 June 2004 22:07, Maurizio Colucci wrote:
> > Can I write a kicker applet completely in PyKDE? If so, could you please
> > give me some hint how to do it? (e.g., where do I put the init()
> > function, where do I copy the .py file, how do I cope with the
> > requirement of having a .la file...).
> >
> > If I can't, what is the least amount of C++ code I have to write?
> The status of panel applet support is a little murky at the moment. It was
> included in PyKDE-3.8, but removed from PyKDE-3.11 (and you don't want to
> go back to 3.8). It will eventually be part of an addon package separate
> from PyKDE (but requiring PyKDE), but the people (including me) doing the
> development haven't worked out the details yet.
> I have working code (including installation) and could probably send you
> something if you're in a real hurry (let me know). Otherwise, a general
> release is probably a month or more away (probably "more"). It requires sip
> 4.0, which is available in rc form now and final release soon.

This was two months ago. :-)

What is the current status of panel applets?

> Basically, the panel applet/extension (about the same for both) interface
> uses a single C++ lib to handle all instances of Python-based applets or
> extensions - you just need to install this, along with libpythonize.so,
> which is a very simple wrapper for the Python interpreter. You don't need
> to write any C++.
> There is an appletInstall.py application (needs some cleanup, but working)
> which will simplify installing Python-based panel applets. Assume you write
> someApplet.py: In someApplet.py, you need a factory function
> ("createApplet" - the code is pretty much the same for all cases) and a
> class sub-classed from KPanelApplet that actually implements your applet.
> What the installer does is:
> 1. Creates a .desktop file that references "libsomeApplet.so" and places it
> in the share/apps/kicker/applets directory along with your Python file.

Shouldn't I be able to write (part of) the .desktop file?
.desktop files usually contain important informations (icons, K-menu entries, 

> 2. Creates a symlink in the appropriate directory from libsomeApplet.so to
> libpykpanelapplet.so (the single applet interface lib)
> 3. Creates a fake libsomeApplet.la file in the approprieate directory
> (The installer does some file renaming too - your file will be installed as
> someApplet_py_applet.py - not usually a big deal).
> When kicker reads the .desktop file, it loads libpykpanelapplet (via the
> symlinked name and fake .la file). libpykpanelapplet has the required
> 'init' function which loads the Python interpreter supplied in the
> libpythonize.so lib (if not already loaded), loads the requested Python
> applet script into the interpreter, runs the factory function and returns a
> KPanelApplet * for your applet back to kicker. sip handles all of the
> Python<=>C++ conversions (in the createApplet function, which you can
> mostly just cut and paste).
> Because of the way Python<=>C++ conversions are now handled, applets may be
> a little more difficult to debug - I still have to look into that.

In C++ I find the program "appletproxy" very useful. It is a must for 
debugging. Essentially you run

 appletproxy /usr/share/kicker/applets/mydesktopfile.desktop

and you see your applet in a window, and this time you can see the stdout of 
your applet.


Maurizio Colucci

More information about the PyQt mailing list