From 3bddd2e5c9783fef0214feffe6e1142e54ab0e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 30 May 2023 18:26:16 +0200 Subject: [PATCH] Always disable scroll-event and prevent move-active on readonly time and datetime The time and datetime widgets were missing from 7a55ecca7a59 of #7076 (grafted from cc50b693f196c5e75a4f5d635341d0805794dab8) --HG-- branch : 6.0 --- .../gui/window/view_form/view/form_gtk/calendar_.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tryton/tryton/gui/window/view_form/view/form_gtk/calendar_.py b/tryton/tryton/gui/window/view_form/view/form_gtk/calendar_.py index fe9bf53bab..36ead73769 100644 --- a/tryton/tryton/gui/window/view_form/view/form_gtk/calendar_.py +++ b/tryton/tryton/gui/window/view_form/view/form_gtk/calendar_.py @@ -89,11 +89,20 @@ class Date(Widget): self.set_format() +def _move_active(combobox, scroll_type): + if not combobox.get_child().get_editable(): + combobox.stop_emission_by_name('move-active') + + class Time(Date): _changed_signal = 'time-changed' def __init__(self, view, attrs): super(Time, self).__init__(view, attrs, _entry=TimeEntry) + self.entry.connect('move-active', _move_active) + self.entry.connect( + 'scroll-event', + lambda c, e: c.stop_emission_by_name('scroll-event')) def _set_editable(self, value): self.entry.set_sensitive(value) @@ -130,6 +139,10 @@ class DateTime(Date): for child in self.entry.get_children(): add_operators(child) if isinstance(child, Gtk.ComboBox): + child.connect('move-active', _move_active) + child.connect( + 'scroll-event', + lambda c, e: c.stop_emission_by_name('scroll-event')) child = child.get_child() child.set_property('activates_default', True) child.connect('key_press_event', self.sig_key_press)