From 2353c0bd34b52283ff27179b44c11150cf691dcc Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 4 Apr 2014 19:30:10 +0100 Subject: [PATCH] 1772: Select row on right click in embedded lists --- gramps/gui/editors/displaytabs/embeddedlist.py | 10 ++++++++++ gramps/gui/editors/displaytabs/groupembeddedlist.py | 1 + 2 files changed, 11 insertions(+) diff --git a/gramps/gui/editors/displaytabs/embeddedlist.py b/gramps/gui/editors/displaytabs/embeddedlist.py index 48f79a2c7..bbdd6d0e4 100644 --- a/gramps/gui/editors/displaytabs/embeddedlist.py +++ b/gramps/gui/editors/displaytabs/embeddedlist.py @@ -115,10 +115,20 @@ class EmbeddedList(ButtonTab): self.rebuild() self.show_all() + def _select_row_at_coords(self, x, y): + """ + Select the row at the current cursor position. + """ + wx, wy = self.tree.convert_bin_window_to_widget_coords(x, y) + row = self.tree.get_dest_row_at_pos(wx, wy) + if row: + self.tree.get_selection().select_path(row[0]) + def _on_button_press(self, obj, event): """ Handle button press, not double-click, that is done in init_interface """ + self._select_row_at_coords(event.x, event.y) if is_right_click(event): #ref = self.get_selected() #if ref: diff --git a/gramps/gui/editors/displaytabs/groupembeddedlist.py b/gramps/gui/editors/displaytabs/groupembeddedlist.py index 7ac8d40d5..f15176ea7 100644 --- a/gramps/gui/editors/displaytabs/groupembeddedlist.py +++ b/gramps/gui/editors/displaytabs/groupembeddedlist.py @@ -109,6 +109,7 @@ class GroupEmbeddedList(EmbeddedList): """ Handle button press, not double-click, that is done in init_interface """ + self._select_row_at_coords(event.x, event.y) if is_right_click(event): obj = self.get_selected() if obj and obj[1]: