Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
a1697e72 by Cédric Krier at 2023-02-16T22:18:01+01:00
Grab focus on icon press

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

Closes #7868
- - - - -


5 changed files:

- tryton/tryton/gui/window/view_form/view/form_gtk/binary.py
- tryton/tryton/gui/window/view_form/view/form_gtk/many2one.py
- tryton/tryton/gui/window/view_form/view/form_gtk/widget.py
- tryton/tryton/gui/window/view_form/view/list_gtk/widget.py
- tryton/tryton/gui/window/view_form/view/screen_container.py


Changes:

=====================================
tryton/tryton/gui/window/view_form/view/form_gtk/binary.py
=====================================
@@ -193,6 +193,7 @@
         return False
 
     def sig_icon_press(self, widget, icon_pos, event):
+        widget.grab_focus()
         if icon_pos == Gtk.EntryIconPosition.PRIMARY:
             self.open_()
 


=====================================
tryton/tryton/gui/window/view_form/view/form_gtk/many2one.py
=====================================
@@ -183,6 +183,8 @@
             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


=====================================
tryton/tryton/gui/window/view_form/view/form_gtk/widget.py
=====================================
@@ -279,7 +279,9 @@
         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(


=====================================
tryton/tryton/gui/window/view_form/view/list_gtk/widget.py
=====================================
@@ -817,6 +817,7 @@
                 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


=====================================
tryton/tryton/gui/window/view_form/view/screen_container.py
=====================================
@@ -544,6 +544,7 @@
         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:



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/a1697e72f21e65cbf7e16766a4dd3dc4d8d2bcfc

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/a1697e72f21e65cbf7e16766a4dd3dc4d8d2bcfc
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to