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/hclient.py | 57 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 13 deletions(-) (limited to 'h-client/hclient.py') diff --git a/h-client/hclient.py b/h-client/hclient.py index ab15ce2..2cd8d5c 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -43,6 +43,8 @@ class hclient: def applyChanges(self,widget): self.currentDevice.setModel(self.modelNameEntry.get_text()) + self.currentDevice.setSubtype(self.getActive(self.subtypeCombo)) + self.currentDevice.setYear(self.getActive(self.commYearCombo)) self.currentDevice.setInterface(self.getActive(self.interfaceCombo)) @@ -118,6 +120,8 @@ class hclient: self.setModelEntry() #set the vendorid:productid entry self.setVendorIdProductIDCode() + #set the subtype entry (in the case of printers) + self.setSubtypeEntry() #set the commercialization year entry self.setCommYearEntry() #set the interface entry @@ -144,6 +148,20 @@ class hclient: self.vendorIdProductIdEntry.set_text(self.currentDevice.getVendorId() + ':' + self.currentDevice.getProductId()) + #set the subtype entry (in the case pf printers) + def setSubtypeEntry(self): + self.subtypeCombo.get_model().clear() + for subtype in self.currentDevice.getSubtypes(): + self.subtypeCombo.append_text(subtype) + + if self.currentDevice.getSubtype() in self.currentDevice.getSubtypes(): + index = self.currentDevice.getSubtypes().index(self.currentDevice.getSubtype()) + else: + index = 0 + + self.subtypeCombo.set_active(index) + + #set the year of commercialization def setCommYearEntry(self): self.commYearCombo.get_model().clear() @@ -756,7 +774,7 @@ class hclient: #add the input to the table self.rightTable.attach(self.modelNameEntry, 1, 2, 0, 1) - + ### vendorid:productid #vendorid:productid label self.vendorIdProductIdLabel = gtk.Label("VendorID:productID code:") @@ -772,17 +790,30 @@ class hclient: self.rightTable.attach(self.vendorIdProductIdEntry, 1, 2, 1, 2) + ###subtype + #subtype label + self.subtypeLabel = gtk.Label("Subtype:") + self.subtypeLabel.set_alignment(0.95,0.5) + #add the label + self.rightTable.attach(self.subtypeLabel, 0, 1, 2, 3) + + #subtype input + self.subtypeCombo = gtk.combo_box_new_text() + #add the input to the table + self.rightTable.attach(self.subtypeCombo, 1, 2, 2, 3) + + ###year of commercialization #year of commercialization label self.commYearLabel = gtk.Label("Year of commercialization:") self.commYearLabel.set_alignment(0.95,0.5) #add the label - self.rightTable.attach(self.commYearLabel, 0, 1, 2, 3) + self.rightTable.attach(self.commYearLabel, 0, 1, 3, 4) self.commYearCombo = gtk.combo_box_new_text() #add the combo to the table - self.rightTable.attach(self.commYearCombo, 1, 2, 2, 3) + self.rightTable.attach(self.commYearCombo, 1, 2, 3, 4) ###interface @@ -790,7 +821,7 @@ class hclient: self.interfaceLabel = gtk.Label("Interface:") self.interfaceLabel.set_alignment(0.95,0.5) #add the label - self.rightTable.attach(self.interfaceLabel, 0, 1, 3, 4) + self.rightTable.attach(self.interfaceLabel, 0, 1, 4, 5) self.interfaceCombo = gtk.combo_box_new_text() @@ -799,7 +830,7 @@ class hclient: self.interfaceCombo.set_active(0) #add the combo to the table - self.rightTable.attach(self.interfaceCombo, 1, 2, 3, 4) + self.rightTable.attach(self.interfaceCombo, 1, 2, 4, 5) ### distribution @@ -807,7 +838,7 @@ class hclient: self.distributionLabel = gtk.Label("Distribution used: ") self.distributionLabel.set_alignment(0.95,0.5) #add the label - self.rightTable.attach(self.distributionLabel, 0, 1, 4, 5) + self.rightTable.attach(self.distributionLabel, 0, 1, 5, 6) #distribution input self.distributionEntry = gtk.Entry() @@ -815,7 +846,7 @@ class hclient: #add the input - self.rightTable.attach(self.distributionEntry, 1, 2, 4, 5) + self.rightTable.attach(self.distributionEntry, 1, 2, 5, 6) ### kernel @@ -823,12 +854,12 @@ class hclient: self.kernelLabel = gtk.Label("Kernel libre version:") self.kernelLabel.set_alignment(0.95,0.5) #add the label - self.rightTable.attach(self.kernelLabel, 0, 1, 5, 6) + self.rightTable.attach(self.kernelLabel, 0, 1, 6, 7) #kernel input self.kernelEntry = gtk.Entry() #add the input - self.rightTable.attach(self.kernelEntry, 1, 2, 5, 6) + self.rightTable.attach(self.kernelEntry, 1, 2, 6, 7) ###how it works @@ -836,12 +867,12 @@ class hclient: self.howItWorksLabel = gtk.Label("Does it work?") self.howItWorksLabel.set_alignment(0.95,0.5) #add the label - self.rightTable.attach(self.howItWorksLabel, 0, 1, 6, 7) + self.rightTable.attach(self.howItWorksLabel, 0, 1, 7, 8) self.howItWorksCombo = gtk.combo_box_new_text() #add the combo to the table - self.rightTable.attach(self.howItWorksCombo, 1, 2, 6, 7) + self.rightTable.attach(self.howItWorksCombo, 1, 2, 7, 8) ### driver @@ -849,12 +880,12 @@ class hclient: self.driverLabel = gtk.Label("Free driver used:") self.driverLabel.set_alignment(0.95,0.5) #add the label - self.rightTable.attach(self.driverLabel, 0, 1, 7, 8) + self.rightTable.attach(self.driverLabel, 0, 1, 8, 9) #driver input self.driverEntry = gtk.Entry() #add the input - self.rightTable.attach(self.driverEntry, 1, 2, 7, 8) + self.rightTable.attach(self.driverEntry, 1, 2, 8, 9) ### description -- cgit v1.2.3