diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-05-16 21:07:50 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-05-16 21:07:50 +0000 |
commit | 94dcbc0835951c5c7bc87f3503a94b22f740a7e9 (patch) | |
tree | b563b516e04bdf669540f884e432f5cb5dc38534 /h-client | |
parent | d52fe734102ded012a6481394a9b73f9d0db0e0e (diff) |
h-client:the last device is now selected after each synchronize
Diffstat (limited to 'h-client')
-rw-r--r-- | h-client/hclient.py | 25 |
1 files 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() |