[PyQt] PyKDE4 solid question

Simon Edwards simon at simonzone.com
Sat Jan 12 10:48:25 GMT 2008


Hi,

Peter Liedler wrote:
> I try to work on a PyKDE4 application and have problems on finding
> tutorials, specially for configuration dialogs and solid. 

They basically haven't been written. I encourage people to write 
tutorials and put them up on techbase.kde.org.

> Currently I try to determine the block device address of my cdrom, but
> it always gives me the AttributeError: device.
> In the solid documentation there is a device function in block that
> returns the block device as a string. 
> Please tell me where I am wrong. Here is my code sample:

Works here:

-----------------------------------------------------------
from PyKDE4.kdecore import *
from PyKDE4.solid import *

def main():
     curDevice = Solid.Device.allDevices()
     for cdrom in curDevice:
         if cdrom.isDeviceInterface (Solid.DeviceInterface.Block):
             drive = cdrom.asDeviceInterface (Solid.DeviceInterface.Block)
             print drive.device()

main()

[sbe at zootv ~/devel/pykde4]$ python solid_cdrom.py
/dev/sda1
/dev/sda
/dev/hdb
/dev/hda4
/dev/hda3
/dev/hda2
/dev/hda1
/dev/hda
-----------------------------------------------------------

What version of PyKDE4 are you using exactly? I've more or less got 4.0.

cheers,

-- 
Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."


More information about the PyQt mailing list