From 94dcbc0835951c5c7bc87f3503a94b22f740a7e9 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 16 May 2011 21:07:50 +0000 Subject: h-client:the last device is now selected after each synchronize --- h-client/hclient.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/h-client/hclient.py b/h-client/hclient.py index 70c3805..a1911a9 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -615,7 +615,14 @@ class hclient: return False + #update the devices' tree def setDeviceTree(self): + + #get the current selection + ts, itera = self.tree.get_selection().get_selected() + if itera: + path = ts.get_path(itera) + 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]) @@ -635,13 +642,17 @@ class hclient: self.tree.expand_all() - #select the first device - self.tree.get_selection().select_path(0) - ts, itera = self.tree.get_selection().get_selected() + #select the device on the tree if itera: - next = ts.iter_nth_child(itera, 0) - path = ts.get_path(next) self.tree.get_selection().select_path(path) + else: + #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): @@ -753,7 +764,7 @@ class hclient: treesw = gtk.ScrolledWindow() - treesw.set_size_request(130,401) + treesw.set_size_request(110,401) treesw.set_shadow_type(gtk.SHADOW_ETCHED_IN) treesw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) treesw.add(self.tree) @@ -1034,8 +1045,6 @@ class hclient: self.leftWindow.show() self.window.show() - - self.synchronize(None) self.updateStatus() -- cgit v1.2.3