From d52fe734102ded012a6481394a9b73f9d0db0e0e Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 16 May 2011 17:38:15 +0000 Subject: h-client:added other_names entry - part 3 --- h-client/hclient.py | 29 ++++++++++++++++++++--------- h-client/hlibrary.py | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'h-client') diff --git a/h-client/hclient.py b/h-client/hclient.py index f1fbfbc..70c3805 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -43,6 +43,10 @@ class hclient: def applyChanges(self,widget): self.currentDevice.setModel(self.modelNameEntry.get_text()) + otherNamesBuffer = self.otherNamesText.get_buffer() + startiter, enditer = otherNamesBuffer.get_bounds() + self.currentDevice.setOtherNames(otherNamesBuffer.get_text(startiter, enditer)) + self.currentDevice.setSubtype(self.getActive(self.subtypeCombo)) self.currentDevice.setYear(self.getActive(self.commYearCombo)) @@ -129,6 +133,8 @@ class hclient: if self.currentDevice != None: #set the model entry self.setModelEntry() + #set the other names entry + self.setOtherNamesEntry() #set the vendorid:productid entry self.setVendorIdProductIDCode() #set the subtype entry (in the case of printers) @@ -153,6 +159,11 @@ class hclient: def setModelEntry(self): self.modelNameEntry.set_text(self.currentDevice.getModel()) + #set the other names entry + def setOtherNamesEntry(self): + textbuffer = gtk.TextBuffer(table=None) + textbuffer.set_text(self.currentDevice.getOtherNames()) + self.otherNamesText.set_buffer(textbuffer) #set the vendorid:productid entry def setVendorIdProductIDCode(self): @@ -655,7 +666,7 @@ class hclient: self.window.set_title("h-client") self.window.set_icon_from_file("img/icon.png") - self.window.set_size_request(600, -1) + self.window.set_size_request(700, -1) self.window.set_position(gtk.WIN_POS_CENTER) self.window.connect("delete_event", self.delete_event) @@ -742,7 +753,7 @@ class hclient: treesw = gtk.ScrolledWindow() - treesw.set_size_request(140,401) + treesw.set_size_request(130,401) treesw.set_shadow_type(gtk.SHADOW_ETCHED_IN) treesw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) treesw.add(self.tree) @@ -805,23 +816,23 @@ class hclient: ### other names #other names label - self.otherNamesLabel = gtk.Label("Possible other names of the device:\n( write a name per row )") + self.otherNamesLabel = gtk.Label("Possible other names of the device:\n( write a name per row )") self.otherNamesLabel.set_use_markup(True) - self.otherNamesLabel.set_alignment(0.5,0.5) + self.otherNamesLabel.set_alignment(0.76,0.5) self.otherNamesLabel.set_justify(gtk.JUSTIFY_RIGHT) self.rightTable.attach(self.otherNamesLabel, 0, 1, 1, 2) #other names text area s = gtk.ScrolledWindow() s.set_shadow_type(gtk.SHADOW_ETCHED_IN) - s.set_size_request(-1,40) - s.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) + s.set_size_request(-1,50) + s.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.otherNamesText = gtk.TextView() #self.otherNamesText.set_size_request(-1,60) self.otherNamesText.set_wrap_mode(gtk.WRAP_CHAR) - #self.otherNamesText.set_left_margin(5) - #self.otherNamesText.set_right_margin(5) + self.otherNamesText.set_left_margin(5) + self.otherNamesText.set_right_margin(5) s.add(self.otherNamesText) s.show() @@ -832,7 +843,7 @@ class hclient: ### vendorid:productid #vendorid:productid label self.vendorIdProductIdLabel = gtk.Label("VendorID:productID code:") - self.vendorIdProductIdLabel.set_alignment(0.86,0.5) + self.vendorIdProductIdLabel.set_alignment(0.88,0.5) #add the label self.rightTable.attach(self.vendorIdProductIdLabel, 0, 1, 2, 3) diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index f91748d..4a2e22e 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -97,7 +97,7 @@ class Device(object): def setPost(self): self._post['model'] = self._model - self._post['other_names'] = self._otherNames + self._post['other_names'] = self._otherNames.replace("\n","\r\n") self._post['kernel'] = self._kernel self._post['distribution'] = self.createDistroEntry() self._post['comm_year'] = self._year -- cgit v1.2.3