[PyKDE] KFilePlugins, using Python from C++ code and vice versa

Joachim Werner joe at novell.com
Thu Aug 31 11:59:20 BST 2006


Hi,

quite a while ago I asked if anybody had working examples of KFilePlugins 
written in Python, but I got no answer. I guess the reason was that there are 
no such examples.

So let me rephrase the problem:

What I want to do is prototype a metadata pluging for KDE that can fetch file 
metadata from a server instead of reading the files.

E.g., if I open a folder with dozens of large digital photographs in JPEG 
format, what will happen is that Konqueror, or actually the KFilePlugin that 
is registered for jpeg, reads the EXIF metadata (the info about when, with 
what lens, aperture etc. the photo was taken) from the file and generates a 
thumbnail. If the folder is on a remote drive this will create quite a lot of 
traffic and take quite a while if you have low bandwidth.

But if the file plugin could just ask the server for the metadata and get the 
metadata and thumbnail from the server, things would be faster and need less 
bandwidth.

The client-server part is easy. In my prototype I'm using a Python xmlrpc 
server and client. On the server side I can call kfile (the command line 
client for accessing file plugins) from Python. So that's no issue either.

But on the client I'd now like to replace the existing file plugins by a 
remote metadata proxy that redirects the API calls to the remote server.

KFilePlugins are available in PyKDE, but the missing piece for me is how to 
register them. Usually, KFilePlugins are referenced by name in a .desktop 
file, and the matching dynamic library is loaded when needed.

So the question is how I can do that with PyKDE. Do I have to write a wrapper 
dynamic library in C++ that calls my Python code? If yes, how? (An example 
would be fine.)

Cheers

Joachim

-- 
Joachim Werner <joe at suse.de>
Project Manager Contracts, Migration, SDK
Novell, Linux R&D Nuernberg




More information about the PyQt mailing list