3328: Rule Editor does not select current rule to edit

svn: r14244
This commit is contained in:
Doug Blank 2010-02-06 12:42:36 +00:00
parent e045018356
commit ec017abfa3

View File

@ -557,13 +557,12 @@ class EditRule(ManagedWindow.ManagedWindow):
node = self.store.insert_after(top_node[category], prev) node = self.store.insert_after(top_node[category], prev)
self.store.set(node, 0, class_obj.name, 1, class_obj) self.store.set(node, 0, class_obj.name, 1, class_obj)
#
# if this is an edit rule, save the node # if this is an edit rule, save the node
if class_obj == self.sel_class: if class_obj == self.sel_class:
sel_node = node sel_node = (top_node[category], node)
if sel_node: if sel_node:
self.selection.select_iter(sel_node) self.select_iter(sel_node)
page = self.class2page[self.active_rule.__class__] page = self.class2page[self.active_rule.__class__]
self.notebook.set_current_page(page) self.notebook.set_current_page(page)
self.display_values(self.active_rule.__class__) self.display_values(self.active_rule.__class__)
@ -581,6 +580,17 @@ class EditRule(ManagedWindow.ManagedWindow):
self.show() self.show()
def select_iter(self, data):
"""
Workaround to get self.selection to move to iter row.
self.selection.select_iter(iter) did not work, so we first
select the top_node iter, expand it, and then select_iter.
"""
top_node, iter = data
self.selection.select_iter(top_node)
self.expand_collapse()
self.selection.select_iter(iter)
def _button_press(self, obj, event): def _button_press(self, obj, event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
return self.expand_collapse() return self.expand_collapse()