Clear entry when combobox is set to inactive item

GTK doesn't clear the entry when calling set_active with -1.
Complete changeset 112709fa23f4.

issue4298
review13991002
This commit is contained in:
Cédric Krier committed 2015-02-14 18:20:11 +01:00
1 parent efcbf15617
commit 098f661740
2 files changed
+5

No files matched your search

@@ -129,6 +129,9 @@ class Reference(Many2One, SelectionMixin, PopdownMixin):
active = i
break
self.widget_combo.set_active(active)
if active == -1:
# When setting no item GTK doesn't clear the entry
self.widget_combo.child.set_text('')
def display(self, record, field):
self.update_selection(record, field)
@@ -68,6 +68,8 @@ class Selection(Widget, SelectionMixin, PopdownMixin):
self.set_popdown(self.selection, self.entry)
if not field:
self.entry.set_active(-1)
# When setting no item GTK doesn't clear the entry
self.entry.child.set_text('')
return
super(Selection, self).display(record, field)
value = field.get(record)