From f32b61c7c4f499b9393524fc7ae9bbfc05b9b729 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 1 May 2011 10:35:49 +0000 Subject: h-client:USB printers can now be submitted by means of the client --- h-client/hlibrary.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'h-client/hlibrary.py') diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 7523e35..83ca3a9 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -42,6 +42,9 @@ class Device(object): #list of options for the howItWorks entry _howItWorksOptions = ['yes','no'] + #list of subtypes + _subtypes = [] + #allowed years of commercialization _years = [ 'not-specified', @@ -88,6 +91,7 @@ class Device(object): self._howItWorks = '' self._driver = '' self._description = '' + self._subtype = 'not-specified' self._icon = 'unknown.png' def setPost(self): @@ -154,6 +158,12 @@ class Device(object): self._status = False self.errors.append('tmp folder not writable') + def getSubtype(self): + return self._subtype + + def getSubtypes(self): + return self._subtypes + def getHowItWorksOptions(self): return self._howItWorksOptions @@ -238,6 +248,9 @@ class Device(object): def setDescription(self,description): self._description = description + def setSubtype(self,subtype): + self._subtype = subtype + def getStatus(self): return self._status @@ -292,11 +305,13 @@ class Printer(Device): self._howItWorks = 'C-None' self._interfaces = ['not-specified','USB','Serial','Parallel','Firewire','SCSI','Ethernet'] self._howItWorksOptions = ['A-Full','B-Partial','C-None'] + self._subtypes = ['not-specified','laser','inkjet','other'] self._icon = 'printer.png' def setPost(self): super(Printer, self).setPost() self._post['compatibility'] = self._howItWorks + self._post['subtype'] = self._subtype #class to carry out http requests by means of pycurl class Mycurl: @@ -726,6 +741,10 @@ class Client: if deviceType == 'printer': works = device.getElementsByTagName("compatibility")[0].childNodes[0].data.encode('utf-8') + + #set the subtype + subtype = device.getElementsByTagName("subtype")[0].childNodes[0].data.encode('utf-8') + dev[0].setSubtype(subtype) else: works = device.getElementsByTagName("it_works")[0].childNodes[0].data.encode('utf-8') -- cgit v1.2.3