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

David Boddie david at boddie.org.uk
Tue Sep 5 21:56:40 BST 2006


On Tuesday 05 September 2006 18:49:35 +0200, Joachim Werner wrote:

> Am Donnerstag, 31. August 2006 23:35 schrieb David Boddie:

> > Or you could just write it in Python rather than merely prototyping it.
> > ;-)
>
> If all the heavy lifting is done outside the Python glue code, this may be
> a real option.

You'll have to profile the prototype and see if it's fast enough.

> > If you get stuck, I can probably send you something to help you get
> > started, but it won't use the standard DistUtils infrastructure like the
> > PyKDE Extensions do.
>
> I actually had quite some success over the weekend with this stuff you have
> put on your website:
>
> http://www.boddie.org.uk/david/Projects/Python/KDE/Software/thumbcreators-2
>005-09-19.tar.gz
>
> I have a working Thumb Creator now that gets the thumbnail from a remote
> server via XML-RPC.

That's good to hear.

> I am expecting the KFilePlugin to work very similar to the ThumbCreator
> stuff.
>
> BTW: My experience was that this kind of stuff is relatively hard to debug.
> I had to ask your KDE guys for the tip to start kinit in a console window,
> so I see the output of the plugin.

Yes, it's the same for kicker, too. If you create a panel applet and want to
get reasonable error reporting, you need to type something like this in a
console:

  killall kicker
  kdeinit kicker

Another problem you may encounter is that processes for file-related tasks
seem to get cached or kept running in KDE, and that can get really
frustrating when you're constantly trying to improve something.

> And the actual problem turned out to be that your setup.py install is not
> x86-64-clean and installed into the 32bit tree. ;-)
>
> After copying the stuff to the right place things worked.

Can you send me a patch that fixes the setup.py script?

> I'll check Simon's stuff, too. I might need the kioslave template anyway.
>
> That said, is there the slightest chance that KDE 4 gets plugin interfaces
> that accept plain Python (or Ruby or whatever) code without needing to wrap
> it into a C++ stub DLL?

I don't know. You'll have to ask the right people. ;-)

I hope they'll think a bit more about other languages when they add plugin
support to components in KDE 4 than they did for KDE 3. On the other hand,
as long as we can create our own plugins that embed a Python interpreter,
we don't need to worry too much about that.

David




More information about the PyQt mailing list