button press use the wrong record to popup the menu

issue3702
review3691004
This commit is contained in:
Cédric Krier committed 2014-02-27 12:43:13 +01:00
1 parent c42bf12c09
commit 7daeef687d
1 file changed
+8 -5
+8 -5
View File
@@ -594,16 +594,19 @@ class ViewList(ParserView):
def __button_press(self, treeview, event):
if event.button == 3:
path = treeview.get_path_at_pos(int(event.x), int(event.y))
try:
path, col, x, y = treeview.get_path_at_pos(
int(event.x), int(event.y))
except TypeError:
# Outside row
return False
selection = treeview.get_selection()
if selection.get_mode() == gtk.SELECTION_SINGLE:
model = selection.get_selected()[0]
elif selection.get_mode() == gtk.SELECTION_MULTIPLE:
model = selection.get_selected_rows()[0]
if (not path) or not path[0]:
return False
group = model.group
record = group[path[0][0]]
record = model.get_value(model.get_iter(path), 0)
group = record.group
menu = gtk.Menu()
menu.popup(None, None, None, event.button, event.time)