From 7dbd7dc987eb70a663c9e26f8f6a5de3671c08a1 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 5 May 2011 13:29:20 +0000 Subject: h-client:added device icons and classes --- h-client/hlibrary.py | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) (limited to 'h-client/hlibrary.py') diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 389eff3..7f9d900 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -314,6 +314,85 @@ class Printer(Device): self._post['compatibility'] = self._howItWorks self._post['subtype'] = self._subtype +class Scanner(Device): + + def __init__(self): + super(Scanner, self).__init__() + self._type = 'scanner' + self._howItWorks = 'C-None' + self._interfaces = ['not-specified','USB','Serial','Parallel','Firewire','SCSI','Ethernet'] + self._howItWorksOptions = ['A-Full','B-Partial','C-None'] + self._icon = 'scanner.png' + + def setPost(self): + super(Scanner, self).setPost() + self._post['compatibility'] = self._howItWorks + +class Threegcard(Device): + + def __init__(self): + super(Threegcard, self).__init__() + self._type = '3G-card' + self._howItWorks = 'no' + self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card'] + self._icon = '3G-card.png' + + def setPost(self): + super(Threegcard, self).setPost() + self._post['wifi_works'] = self._howItWorks + +class Webcam(Device): + + def __init__(self): + super(Webcam, self).__init__() + self._type = 'webcam' + self._howItWorks = 'no' + self._interfaces = ['not-specified','USB','Firewire','Parallel','Wifi','Serial'] + self._icon = 'webcam.png' + + def setPost(self): + super(Webcam, self).setPost() + self._post['webcam_works'] = self._howItWorks + +class Bluetooth(Device): + + def __init__(self): + super(Bluetooth, self).__init__() + self._type = 'bluetooth' + self._howItWorks = 'no' + self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card'] + self._icon = 'bluetooth.png' + + def setPost(self): + super(Bluetooth, self).setPost() + self._post['bluetooth_works'] = self._howItWorks + +class Acquisitioncard(Device): + + def __init__(self): + super(Acquisitioncard, self).__init__() + self._type = 'acquisition-card' + self._howItWorks = 'no' + self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card','Firewire','Parallel','Serial'] + self._icon = 'acquisition-card.png' + + def setPost(self): + super(Acquisitioncard, self).setPost() + self._post['compatibility'] = self._howItWorks + +class Fingerprintreader(Device): + + def __init__(self): + super(Fingerprintreader, self).__init__() + self._type = 'fingerprint-reader' + self._howItWorks = 'no' + self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card','Firewire','Parallel','Serial'] + self._icon = 'fingerprint-reader.png' + + def setPost(self): + super(Fingerprintreader, self).setPost() + self._post['fingerprint_works'] = self._howItWorks + class Unknown(Device): def __init__(self): @@ -755,12 +834,14 @@ class Client: if code.hasChildNodes(): if (code.childNodes[0].data == vendorid_productid): + + modelName = device.getElementsByTagName("model_name")[0].childNodes[0].data.encode('utf-8') interface = device.getElementsByTagName("interface")[0].childNodes[0].data.encode('utf-8') distribution = device.getElementsByTagName("distribution")[0].childNodes[0].data.encode('utf-8') idDevice = device.getElementsByTagName("id")[0].childNodes[0].data.encode('utf-8') - if deviceType == 'printer': + if deviceType == 'printer' or deviceType == 'scanner': works = device.getElementsByTagName("compatibility")[0].childNodes[0].data.encode('utf-8') #set the subtype -- cgit v1.2.3