1772: Select row on right click in embedded lists

This commit is contained in:
Nick Hall 2014-04-04 19:30:10 +01:00
parent f6ac8eb854
commit 2353c0bd34
2 changed files with 11 additions and 0 deletions

View File

@ -115,10 +115,20 @@ class EmbeddedList(ButtonTab):
self.rebuild() self.rebuild()
self.show_all() 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): def _on_button_press(self, obj, event):
""" """
Handle button press, not double-click, that is done in init_interface 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): if is_right_click(event):
#ref = self.get_selected() #ref = self.get_selected()
#if ref: #if ref:

View File

@ -109,6 +109,7 @@ class GroupEmbeddedList(EmbeddedList):
""" """
Handle button press, not double-click, that is done in init_interface 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): if is_right_click(event):
obj = self.get_selected() obj = self.get_selected()
if obj and obj[1]: if obj and obj[1]: