[PyKDE] DCOP problem

Jim Bublitz jbublitz at nwinternet.com
Fri May 26 17:23:40 BST 2006


On Thursday 25 May 2006 09:06, Michał Woźniak wrote:
> Hi there, guys
>
> Got a strange issue here: trying to have my Python script open a new
> KMail's Composer window through DCOP, but I can't seem to be able to call
> the appropriate function.
>
> Now, from shell, everything works great:
> dcop kontact KMailIface openComposer to cc bcc subject body False
> opens me a new window.
>
> What's more, 1. I can call other functions of the KMailIface object from
> Python without any issues, and 2. the script below actually lists the
> "openComposer" method (a few times), but apparently does not call it. As
> you will see in the code below, I tried three ways of passing the
> arguments, in case I am missing something here, but no luck either. Any
> ideas?

If I add KURL(""):

print dcApp.KMailIface.openComposer(QString('to'), QString('cc'), 
QString('bcc'), QString('subject'), QString('body'), False, 
KURL (""))

at the end, that works as far as creating a composer window with 'body' as the 
text (an actual URL argument to KURL seems to work correctly too). Of course 
you don't get a DCOPRef back - just an int.

The problem is that PyKDE/extensions/dcopext.py (which does the DCOP stuff) 
doesn't handle overloaded methods correctly (or at all, for that matter). 
There's an alternative version here:

http://twoday.tuwien.ac.at/pub/stories/22870/

I haven't had time to check it out completely, so PyKDE hasn't been modified, 
but it looks like it should work. To try it out, download it and replace the 
installed dcopext.py (usually in site-packages, or wherever the Qt and PyKDE 
modules are installed) with the newer version. The revised version, or 
something similar, will probably go in the next release.

If you test the modified version, I'd appreciate a post to the list about how 
it works.

Apologies for the slow reply - I've been replacing a fried mobo and upgrading 
to a 64 bit CPU.

Jim




More information about the PyQt mailing list