[PyKDE] IOSlaves in Python?

Jim Bublitz jbublitz at nwinternet.com
Fri Jun 27 00:33:01 BST 2003


On Thursday June 26 2003 10:42, David Boddie wrote:
> 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.

There are a couple of tutorials at:

http://www.heise.de/ct/english/01/05/242/
http://developer.kde.org/documentation/design/kde/ioslaves/framework.html
http://developer.kde.org/documentation/design/kde/ioslaves/introduction.html

The second is older and may be a little obsolete. If they don't 
help, they should at least give you an idea where to dig through 
the KDE source code (eg KIO::Job, KIO::Scheduler). The 
KIO::Scheduler docs also have a little more info. (I assume you 
have the KDE Libs Class Ref - if not you should get a copy. You 
can find it on www.kde.org under Documentation in the Developers 
sections). KIO::Job is in jobclasses.[h, cpp], along with a 
large number of KIO::Job subclasses.

> 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.

I'm not sure if there's some sort of registration procedure. Just 
from the bits and pieces I've read, there are limits on the 
number of slaves, and they can be re-used. There does appear to 
be a requirement for a 'Protocol" file.

It appears there are several different ways to access slaves, and 
some of this may be mixing up the different methods.

> 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.

That would seem to indicate you DON'T have a linking problem 
(like needing to expose symbols globally or some such, which is 
the main problem I've had with similar stuff).

> 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'm really short of time at the moment and not very knowledgeable 
about this anyway. A couple things I would suggest:

a. google on "IOSlave" - it turns up some links both to docs and 
to people who have written IOSlaves. Might be worth contacting 
some of them to see if they can help. I've generally found 
people helpful for inquiries like this. Even if you have to get 
it working in C++ first, it might be worthwhile.

b. Try some of the KDE lists - I'm not sure which (and there are 
quite a few). You can get to them via www.kde.org and then look 
around the "Developers" section.

Despite the fact I'm not being of much help, I'd appreciate if 
you could post any successes or info to this list as I'm sure it 
will come up again in the future. I'd also like to be sure that 
PyKDE is providing everything needed to handle slaves. It seems 
like a nice application to do in Python.

> 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.





More information about the PyQt mailing list