From 8cd1a019cce019c3be1d5f6a36fb7b95fd983f51 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Fri, 19 Oct 2007 20:51:18 +0000 Subject: [PATCH] 2007-10-19 Gary Burton * src/DisplayTabs/_EmbeddedList.py: * src/DisplayTabs/_ButtonTab.py: ENTER is edit on embedded lists, issue #1296 svn: r9213 --- ChangeLog | 5 +++++ src/DisplayTabs/_ButtonTab.py | 15 +++++++++++++++ src/DisplayTabs/_EmbeddedList.py | 1 + 3 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index eace9d7c5..011162ddb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-19 Gary Burton + * src/DisplayTabs/_EmbeddedList.py: + * src/DisplayTabs/_ButtonTab.py: + ENTER is edit on embedded lists, issue #1296 + 2007-10-19 Frank S. Thomas * src/glade/gramps.glade: Remove extra space. diff --git a/src/DisplayTabs/_ButtonTab.py b/src/DisplayTabs/_ButtonTab.py index f57d7f267..ab9a68f8e 100644 --- a/src/DisplayTabs/_ButtonTab.py +++ b/src/DisplayTabs/_ButtonTab.py @@ -43,6 +43,9 @@ from GrampsWidgets import SimpleButton from _GrampsTab import GrampsTab import Errors +_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter") +_RETURN = gtk.gdk.keyval_from_name("Return") + #------------------------------------------------------------------------- # # Classes @@ -130,6 +133,18 @@ class ButtonTab(GrampsTab): except Errors.WindowActiveError: pass + def key_pressed(self, obj, event): + """ + Handles the return key being pressed on list. If the key is pressed, + the Edit button handler is called + """ + if event.type == gtk.gdk.KEY_PRESS and \ + event.keyval in (_RETURN, _KP_ENTER): + try: + self.edit_button_clicked(obj) + except Errors.WindowActiveError: + pass + def add_button_clicked(self, obj): """ Function called with the Add button is clicked. This function diff --git a/src/DisplayTabs/_EmbeddedList.py b/src/DisplayTabs/_EmbeddedList.py index 3ddeb91a0..60ff996d1 100644 --- a/src/DisplayTabs/_EmbeddedList.py +++ b/src/DisplayTabs/_EmbeddedList.py @@ -263,6 +263,7 @@ class EmbeddedList(ButtonTab): self.tree.set_reorderable(True) self.tree.set_rules_hint(True) self.tree.connect('button_press_event', self.double_click) + self.tree.connect('key_press_event', self.key_pressed) # create the scrolled window, and attach the treeview scroll = gtk.ScrolledWindow()