[PyKDE] an example of simple python scripting of Kspread?

Jim Bublitz jbublitz at nwinternet.com
Mon Feb 3 00:20:01 GMT 2003


On 02-Feb-03 Ingo Krabbe wrote:
> I don't think that there really is a as fast solution as you like
> to see.  In the end PyKDE is just another programming language
> which needs to define the complete interface to Kspread or
> whatever.  The main problem will be to connect to the Kspread
> interface, so a bit studying is needed of the used classes (I
> don't know them though).

I'd have to think about characterizing PyKDE as a language, but
otherwise you're exactly correct. It's easy to assume the KParts
interface does more than what it really does - KParts just allows
something like KSpread to be a widget, but the interface it
provides is at the QWidget level, not the KSpread level. To
communicate with KSpread *as* KSpread requires another mechanism
(DCOP is supposed to do this) or another wrapper or bindings.

Just bindings alone would be huge and difficult to use, so I think
the better approach is to abstract the KSpread interface into a
simple wrapper (still in C++) and then write bindings to the
wrapper.
 
> As you defined your needs you won't want to open a complete
> Kspread process with its interface. It looks like you just want
> to use the Kspread interface to read in its spreadsheet format
> and apply it to given data.

I read the original as wanting a KSpread instance to interact with,
but the idea of just working with data is also a good solution. I
believe the .ksp format is a tar.gz'd XML file, so it might not be
too hard to work with. CSV files might also work out.
 
> This heavily depends on Kspread itself.  You should contact the
> developer of kspread on KDE to get deeper information, but thats
> just an opinion of a guy who most times writes applications than
> manipulate existing ones.

It certainly wouldn't hurt to get in touch with the koffice list
and at least indicate to them that there is interest in doing this.
You can find all of the KDE lists via

    http://www.kde.org/mailinglists.html

In the past they have "advertised" KOffice as being scriptable in
Python, but I think what they have in mind is DCOP, which is
definitely not the same ease of use as scripting Excel in VB.

Jim





More information about the PyQt mailing list