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
This commit is contained in:
Cédric Krier committed 2016-08-01 21:03:36 +02:00
1 parent 69fc48c197
commit 2dbfdd8d9a
1 file changed
+6 -1
@@ -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):