[PyKDE] DCOP problem
Michał Woźniak
mikiwoz at yahoo.co.uk
Thu May 25 17:06:30 BST 2006
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?
Cheers
Mike
=== SCRIPT ==================================================================
#!/usr/bin/python
import dcop
import dcopext
from kdecore import *
from qt import *
# the dcop client
dc = dcop.DCOPClient()
print 'attaching:', dc.attach()
print
# getting the editor up
dcApp = dcopext.DCOPApp('kontact', dc)
print 'methods:'
for method in dcApp.KMailIface.methods:
print ' - "' + str(method) + '"'
print
print 'calling dcApp.KMailIface.openComposer(\'to\', \'cc\', \'bcc\',
\'subject\', \'body\', False):'
print dcApp.KMailIface.openComposer('to', 'cc', 'bcc', 'subject', 'body',
False)
print dcApp.KMailIface.openComposer(QCString('to'), QCString('cc'),
QCString('bcc'), QCString('subject'), QCString('body'), False)
print dcApp.KMailIface.openComposer(QString('to'), QString('cc'),
QString('bcc'), QString('subject'), QString('body'), False)
-----------------------------------------------------------------------------
=== OUTPUT ==================================================================
attaching: True
methods:
- "QCStringList interfaces()"
- "QCStringList functions()"
- "void checkMail()"
- "QStringList accounts()"
- "void checkAccount(QString account)"
- "void openReader()"
- "int openComposer(QString to,QString cc,QString bcc,QString subject,QString
body,int hidden,KURL messageFile)"
- "int openComposer(QString to,QString cc,QString bcc,QString subject,QString
body,int hidden,KURL messageFile,KURL attachURL)"
- "int openComposer(QString to,QString cc,QString bcc,QString subject,QString
body,int hidden,KURL messageFile,KURL::List attachURLs)"
- "int openComposer(QString to,QString cc,QString bcc,QString subject,QString
body,int hidden,QString attachName,QCString attachCte,QCString
attachData,QCString attachType,QCString attachSubType,QCString
attachParamAttr,QString attachParamValue,QCString attachContDisp)"
- "int openComposer(QString to,QString cc,QString bcc,QString subject,QString
body,int hidden,QString attachName,QCString attachCte,QCString
attachData,QCString attachType,QCString attachSubType,QCString
attachParamAttr,QString attachParamValue,QCString attachContDisp,QCString
attachCharset)"
- "DCOPRef openComposer(QString to,QString cc,QString bcc,QString
subject,QString body,bool hidden)"
- "int sendCertificate(QString to,QByteArray certData)"
- "void compactAllFolders()"
- "int dcopAddMessage(QString foldername,QString messagefile)"
- "int dcopAddMessage(QString foldername,KURL messagefile)"
- "QStringList folderList()"
- "DCOPRef getFolder(QString vpath)"
- "void selectFolder(QString folder)"
- "bool canQueryClose()"
- "int timeOfLastMessageCountChange()"
calling dcApp.KMailIface.openComposer('to', 'cc', 'bcc', 'subject', 'body',
False):
(False, None)
(False, None)
(False, None)
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
More information about the PyQt
mailing list