PyQt and DCOP Documentation
Jim Bublitz
jbublitzno at spamnwinternet.com
Sun Nov 9 21:15:03 EST 2003
Eric Williams wrote:
> Is there any reasonable documentation (i.e., with full examples
> and/or code
> snippets or argument lists or anything) to be found for using
> python with
> Qt/DCOP? "Fully Implemented." does not constitute complete
> documentation when you're c++ illiterate.
>
> I'm actually just trying to get the volume level out of noatun
> in a python script, if anyone can help me with an example.
> What, exactly, does one DO with a QByteArray in python?
>>> from qt import QByteArray
>>> qb = QByteArray ()
>>> qb.duplicate ("Hello")
<qt.QByteArray instance at 0x819d7fc>
>>> qb.data()
'Hello'
But you should be able to use a Python string anywhere you need a
QByteArray, so the above shouldn't be necessary.
I'll check out the rest, but I'll have to see if I have noatun
working first - may take a little while to get to it
(dinnertime).
PyQt is supported on the PyKDE list:
PyKDE at mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Jim
> class Noatun(dcop.DCOPClient):
> def __init__(self):
> dcop.DCOPClient.__init__(self)
> self.appname="NoatunPeeker"
> self.attach()
> self.registerAs(self.appname)
> if self.isAttached():
> self.rc =
> dcop.DCOPRef("noatun","Noatun")
> else:
> print "Couldn't attach!"
> sys.exit(1)
>
> def getvol(self):
> res = self.rc.call("volume()")
> if res.isValid():
> return str(res.data)
> #returns '(' why?
> else:
> return "Couldn't call"
>
> def gettitle(self):
> res = self.rc.call("title()")
> if res.isValid():
> return str(res.data)
> #works as expected
> else:
> return "Couldn't call"
>
> if __name__=="__main__":
> n = Noatun()
> print n.getvol()
> print n.gettitle()
More information about the Python-list
mailing list