From 2dbfdd8d9adee08b5eb9aadb7727b253aa92ba91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 1 Aug 2016 21:03:36 +0200 Subject: [PATCH] Trigger editing-done on ComboBox changed only if a row is selected The CellRendererTime uses also a ComboBoxEntry for editing but parsing it on every change does not work because the parsing will expect a valid time format otherwise the current text will be erased. So to keep the original goal of changeset 3591350f0018 which is to trigger "editing-done" when an option from the drop-down menu is selected, the callback on "changed" must ensure there is an active row selected. issue5746 review28601002 --- tryton/gui/window/view_form/view/list_gtk/widget.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/widget.py b/tryton/gui/window/view_form/view/list_gtk/widget.py index 6d64057c78..a6f40d6ed7 100644 --- a/tryton/gui/window/view_form/view/list_gtk/widget.py +++ b/tryton/gui/window/view_form/view/list_gtk/widget.py @@ -39,7 +39,12 @@ def send_keys(renderer, editable, position, treeview): editable.editing_done_id = editable.connect('editing_done', treeview.on_editing_done) if isinstance(editable, (gtk.ComboBoxEntry, gtk.ComboBox)): - editable.connect('changed', treeview.on_editing_done) + def changed(combobox): + # "changed" signal is also triggered by text editing + # so only trigger editing-done if a row is active + if combobox.get_active_iter(): + treeview.on_editing_done(combobox) + editable.connect('changed', changed) def realized(func):