From 701770dbdd9d142ee3bb088d2daa9ea6b4719ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 16 Jul 2015 01:10:24 +0200 Subject: [PATCH] Add selection shortcuts to reference widget issue4860 review21291002 --- .../gui/window/view_form/view/form_gtk/reference.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/reference.py b/tryton/gui/window/view_form/view/form_gtk/reference.py index d997f8b013..c65db02d35 100644 --- a/tryton/gui/window/view_form/view/form_gtk/reference.py +++ b/tryton/gui/window/view_form/view/form_gtk/reference.py @@ -4,7 +4,8 @@ import gtk import gettext from .many2one import Many2One -from tryton.common.selection import SelectionMixin, PopdownMixin +from tryton.common.selection import SelectionMixin, PopdownMixin, \ + selection_shortcuts _ = gettext.gettext @@ -16,10 +17,13 @@ class Reference(Many2One, SelectionMixin, PopdownMixin): self.widget_combo = gtk.ComboBoxEntry() child = self.widget_combo.get_child() - child.set_editable(False) - child.connect('changed', self.sig_changed_combo) - self.widget.pack_start(self.widget_combo, expand=False, fill=True) + child.connect('activate', lambda *a: self._focus_out()) + child.connect('focus-out-event', lambda *a: self._focus_out()) + self.widget_combo.connect('changed', self.sig_changed_combo) + selection_shortcuts(self.widget_combo) + self.widget_combo.set_focus_chain([child]) + self.widget.pack_start(self.widget_combo, expand=False, fill=True) self.widget.pack_start(gtk.Label('-'), expand=False, fill=False) self.init_selection()