[PyKDE] IOSlaves in Python?

David Boddie david at boddie.org.uk
Thu Jun 26 19:44:00 BST 2003


On Thursday 26 June 2003 01:40, Jim Bublitz wrote:

> On Wednesday June 25 2003 16:43, David Boddie wrote:

> > Is it possible to create IOSlaves using Python and PyKDE?

[...]

> I'm not familiar with the actual mechanics of the slave itself -
> I'd look for a documented KDE example with C++ code and work
> from that if possible.

There are quite a few small examples in the kioslave subdirectory in
kdebase, including the minimal "about" slave. As usual, a direct
translation reveals some differences between the way these things
work in different environments.

> This may be way off target, but it seems you should be able to
> derive from SlaveBase (or TCPSlaveBase) and instantiate that
> object, and then use Connection and SlaveInterface to
> communicate with it. It should work within a single program or
> between programs.

Yes, I'll reevaluate this approach. The problem is that I got confused
(see below).

> The problem with panel applets is that you need to create a
> libtool lib for the loading mechanism, which can't be done (at
> least not easily) from Python. I don't think that's necessary
> with IOSlaves, but I'm really not familiar with how the
> on-demand loading mechanism and mgmt operate, or even the
> details of communicating.

All the IOSlaves I've seen (in the kdebase/kioslaves directory) all
appear to compile to .so libraries with associated .la linking files.
I don't know how flexible the mechanism is for loading IOSlaves so
it may be possible to substitute an executable there instead; a .py
file won't work, it seems.

Perhaps they don't need to be started using the same mechanism anyway.
That might be a way round it.

> It appears all the necessary machinery should be available in
> PyKDE (unless there's a requirement for lib loading similar to
> panel applets). The only other qualification on that is that
> some of the socket related stuff in KDE isn't implemented, but I
> don't think that applies here.

Not for my purposes, anyway.

> Can you expand more on the shared library you mentioned creating?
> If there is a C++ lib req'd, I might have some ideas in that
> direction given more particulars.

I link in the libkdecorecmodule and libkiocmodule at compile time and
they appear to be able to find what they need at run time. Certainly,
I don't experience ImportErrors as a result of missing libraries or
anything of that nature.

I may have to send you what I've written but it'll require modifying to
work on another system because I've not used autoconf for the project
(I was just prototyping).

I've since tried experimenting with DCOP and Python in the hope that I
can use an alternative approach to my problem should this one fail.
I'm currently running into issues with QDataStream, but that's another
story.

David




More information about the PyQt mailing list