Grab focus on icon press

It is needed to trigger the focus out event of other widgets and store the
value.

Closes #7868
This commit is contained in:
Cédric Krier committed 2023-02-16 22:18:01 +01:00
1 parent 69a329292a
commit b16dbdc9c8
5 files changed
+8 -1

No files matched your search

@@ -193,6 +193,7 @@ class Binary(BinaryMixin, Widget):
return False
def sig_icon_press(self, widget, icon_pos, event):
widget.grab_focus()
if icon_pos == Gtk.EntryIconPosition.PRIMARY:
self.open_()
@@ -183,6 +183,8 @@ class Many2One(Widget):
rec_name=self.wid_text.get_text())
def sig_edit(self, entry=None, icon_pos=None, *args):
if entry:
entry.grab_focus()
model = self.get_model()
if not model or not common.MODELACCESS[model]['read']:
return
@@ -279,7 +279,9 @@ class TranslateMixin:
button.connect('clicked', self.translate)
return button
def translate(self, *args):
def translate(self, widget=None, *args):
if widget:
widget.grab_focus()
self.view.set_value()
if self.record.id < 0 or self.record.modified:
common.message(
@@ -817,6 +817,7 @@ class M2O(GenericText):
editable.set_icon_tooltip_text(pos, tooltip)
def icon_press(editable, icon_pos, event):
editable.grab_focus()
value = field.get(record)
if not model:
return
@@ -544,6 +544,7 @@ class ScreenContainer(object):
GLib.idle_add(keypress)
def icon_press(self, widget, icon_pos, event):
widget.grab_focus()
if icon_pos == Gtk.EntryIconPosition.PRIMARY:
self.search_box(widget)
elif icon_pos == Gtk.EntryIconPosition.SECONDARY: