PyQt and DCOP Documentation
Eric Williams
s-rube at uselessbastard.net
Sun Nov 9 21:20:20 EST 2003
Eric Williams wrote:
> 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?
>
Ok, figured out a workaround for that call; in case anyone else's having a
similar problem:
----------------------------------------------
def getvol(self):
res = self.rc.call("volume()")
if res.isValid():
return ord(res.data.data()[-1])
else:
return None
-----------------------------------------------
Where rc is a DCOPRef object hooked to noatun.
For whatever reason, res.data.data() returns a 4-byte array, so here you
take the last byte. Am I doing that correctly, or is there a better way?
On to the next problem:
-----------------------------------------------
def volup(self):
curvol = int(self.getvol())
newvol = curvol + 5
res = self.rc.call("setVolume(%d)" % newvol)
print "Setvol: ", res.isValid()
-----------------------------------------------
I've tried various mutations of this. This doesn't work at all. Anybody
know how to do this?
Thanks,
Eric
--
---
s- should be removed to contact me...
More information about the Python-list
mailing list