aboutsummaryrefslogtreecommitdiff
path: root/h-client/hlibrary.py
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-05-01 10:35:49 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-05-01 10:35:49 +0000
commitf32b61c7c4f499b9393524fc7ae9bbfc05b9b729 (patch)
tree7fe6752d26e6b27ad1d171c638b3a79a44f6af1d /h-client/hlibrary.py
parentf7b8505501a7ad129499c26830bb47a06882e745 (diff)
h-client:USB printers can now be submitted by means of the client
Diffstat (limited to 'h-client/hlibrary.py')
-rw-r--r--h-client/hlibrary.py19
1 files changed, 19 insertions, 0 deletions
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')