From 7b857ff99175fee9322dd7fe9908990a6b598b4d Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Thu, 19 Sep 2024 10:16:49 -0300 Subject: [PATCH] fix: autoscroll now works if the entry is at the very bottom of the scroll the delay is needed because the osk will change the scrolledwindow adjustment, and it's only possible to scroll down more after the keyboard has been shown --- panels/gcode_macros.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/panels/gcode_macros.py b/panels/gcode_macros.py index 81643283..09ca03f7 100644 --- a/panels/gcode_macros.py +++ b/panels/gcode_macros.py @@ -103,12 +103,15 @@ class Panel(ScreenPanel): for param in self.macros[macro]["params"]: labels.add(Gtk.Label(param)) - self.macros[macro]["params"][param].connect("focus-in-event", self._screen.show_keyboard) - self.macros[macro]["params"][param].connect("focus-in-event", self.scroll_to_entry) + self.macros[macro]["params"][param].connect("focus-in-event", self.show_keyboard) self.macros[macro]["params"][param].connect("focus-out-event", self._screen.remove_keyboard) labels.add(self.macros[macro]["params"][param]) - def scroll_to_entry(self, entry, event): + def show_keyboard(self, entry, event): + self._screen.show_keyboard(entry, event) + GLib.timeout_add(100, self.scroll_to_entry, entry) + + def scroll_to_entry(self, entry): self.labels['macros_list'].get_vadjustment().set_value( entry.get_allocation().y - 50 )