diff options
Diffstat (limited to 'h-client')
-rw-r--r-- | h-client/hclient.py | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/h-client/hclient.py b/h-client/hclient.py index 1a9f1fe..9629319 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -554,6 +554,7 @@ class hclient: #print self.client.errors self.setEntries() self.setDeviceInfoLabel() + self.setDeviceTree() def printErrors(self): @@ -603,6 +604,34 @@ class hclient: return False + def setDeviceTree(self): + self.treestore = gtk.TreeStore(str,str,int,gtk.gdk.Pixbuf,int) + + pci = self.treestore.append(None, ["Your PCI Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4]) + usb = self.treestore.append(None, ["Your USB Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4]) + for key,dev in self.client.devices.iteritems(): + + if key[0] == 'p': + self.treestore.append(pci, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4]) + + if key[0] == 'u': + self.treestore.append(usb, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4]) + + self.tree.set_model(self.treestore) + + selection = self.tree.get_selection() + selection.connect('changed', self.setCurrentDevice) + + self.tree.expand_all() + + #select the first device + self.tree.get_selection().select_path(0) + ts, itera = self.tree.get_selection().get_selected() + if itera: + next = ts.iter_nth_child(itera, 0) + path = ts.get_path(next) + self.tree.get_selection().select_path(path) + def delete_event(self, widget, event, data=None): gtk.main_quit() @@ -706,24 +735,6 @@ class hclient: self.devices.add_attribute(device_name, "weight", 2) - self.treestore = gtk.TreeStore(str,str,int,gtk.gdk.Pixbuf,int) - - pci = self.treestore.append(None, ["Your PCI Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4]) - usb = self.treestore.append(None, ["Your USB Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4]) - for key,dev in self.client.devices.iteritems(): - - if key[0] == 'p': - self.treestore.append(pci, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4]) - - if key[0] == 'u': - self.treestore.append(usb, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4]) - - self.tree.set_model(self.treestore) - - selection = self.tree.get_selection() - selection.connect('changed', self.setCurrentDevice) - - self.tree.append_column(self.devices) @@ -737,7 +748,7 @@ class hclient: self.leftWindow.pack_start(treesw, False, True, 0) self.leftWindow.show_all() - self.tree.expand_all() + #treeFrame.add(self.leftWindow) ## build the right window ## @@ -944,6 +955,9 @@ class hclient: self.submitButton.connect("clicked", self.openLicenseNoticeWindow) self.submitButton.set_tooltip_text('submit your modifications to the server') + #create the device tree + self.setDeviceTree() + hboxBelowEntries.pack_end(self.applyButton, False, True, 0) hboxBelowEntries.pack_end(self.resetButton, False, True, 0) hboxBelowEntries.pack_start(self.submitButton, False, True, 0) @@ -980,13 +994,7 @@ class hclient: self.leftWindow.show() self.window.show() - #select the first device - self.tree.get_selection().select_path(0) - ts, itera = self.tree.get_selection().get_selected() - if itera: - next = ts.iter_nth_child(itera, 0) - path = ts.get_path(next) - self.tree.get_selection().select_path(path) + self.synchronize(None) self.updateStatus() |