diff options
Diffstat (limited to 'h-client/hclient.py')
-rw-r--r-- | h-client/hclient.py | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/h-client/hclient.py b/h-client/hclient.py index 1868add..ebb0907 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -481,6 +481,16 @@ class hclient: self.statusLabel.set_markup("<i>you are not logged in</i>") self.submitButton.set_sensitive(False) + #def setTreeViewCell(self,column, cell_renderer, model, iter): + ##img = model.get_value(iter, 3) + ##imgFlag = model.get_value(iter, 5) + #print model + ##self.devices.clear_attributes(cell_renderer) + ##if imgFlag == 'image': + ###print True + ##cell_renderer.set_property('pixbuf', img) + #return + #another callback def delete_event(self, widget, event, data=None): @@ -490,7 +500,7 @@ class hclient: def __init__(self): #start the client object - self.client = Client('h-source') + self.client = Client('http://www.h-node.com/') self.client.createDevices() # Create the main window @@ -567,30 +577,38 @@ class hclient: self.tree = gtk.TreeView() self.tree.set_headers_visible(False) - devices = gtk.TreeViewColumn("Your PCI and USB devices") + self.devices = gtk.TreeViewColumn("Your PCI and USB devices") + + device_icon = gtk.CellRendererPixbuf() + self.devices.pack_start(device_icon, True) + self.devices.add_attribute(device_icon, 'pixbuf', 3) + #self.devices.set_cell_data_func(device_icon, self.setTreeViewCell) - cell = gtk.CellRendererText() - devices.pack_start(cell, False) - devices.add_attribute(cell, "text", 0) - devices.add_attribute(cell, "weight", 2) + + device_name = gtk.CellRendererText() + self.devices.pack_start(device_name, True) + self.devices.add_attribute(device_name, "text", 0) + self.devices.add_attribute(device_name, "xpad", 4) + self.devices.add_attribute(device_name, "weight", 2) + - self.treestore = gtk.TreeStore(str,str,int) + self.treestore = gtk.TreeStore(str,str,int,gtk.gdk.Pixbuf,int,str) - pci = self.treestore.append(None, ["Your PCI Devices","",800]) + pci = self.treestore.append(None, ["Your PCI Devices","",800,gtk.gdk.pixbuf_new_from_file('img/devices/unknown.png'),4,'no_image']) for key,dev in self.client.devices.iteritems(): if key[0] == 'p': - self.treestore.append(pci, [dev[0].getType(),key,400]) + self.treestore.append(pci, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/'+dev[0].getIcon()),4,'image']) selection = self.tree.get_selection() selection.connect('changed', self.setCurrentDevice) - self.tree.append_column(devices) + self.tree.append_column(self.devices) self.tree.set_model(self.treestore) treesw = gtk.ScrolledWindow() - treesw.set_size_request(50,441) + treesw.set_size_request(110,401) treesw.set_shadow_type(gtk.SHADOW_ETCHED_IN) treesw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) treesw.add(self.tree) |