@@ -232,26 +232,6 @@ def set_mode(self, mode):
232232 self ._keyboard .set_map (mode , key_map , ctrl_map )
233233 self ._keyboard .set_mode (mode )
234234
235-
236- # Python magic method for automatic method forwarding
237- def __getattr__ (self , name ):
238- #print(f"[kbd] __getattr__ {name}")
239- """
240- Forward any undefined method/attribute to the underlying LVGL keyboard.
241-
242- This allows MposKeyboard to support ALL lv.keyboard methods automatically
243- without needing to manually wrap each one. Any method not defined on
244- MposKeyboard will be forwarded to self._keyboard.
245-
246- Examples:
247- keyboard.set_textarea(ta) # Works
248- keyboard.align(lv.ALIGN.CENTER) # Works
249- keyboard.set_style_opa(128, 0) # Works
250- keyboard.any_lvgl_method() # Works!
251- """
252- # Forward to the underlying keyboard object
253- return getattr (self ._keyboard , name )
254-
255235 def scroll_after_show (self , timer ):
256236 #self._textarea.scroll_to_view_recursive(True) # makes sense but doesn't work and breaks the keyboard scroll
257237 self ._keyboard .scroll_to_view_recursive (True )
@@ -282,3 +262,22 @@ def hide_keyboard(self):
282262 mpos .ui .anim .smooth_hide (self ._keyboard , duration = 500 )
283263 # Do this after the hide so the scrollbars disappear automatically if not needed
284264 scroll_timer = lv .timer_create (self .scroll_back_after_hide ,550 ,None ).set_repeat_count (1 )
265+
266+ # Python magic method for automatic method forwarding
267+ def __getattr__ (self , name ):
268+ #print(f"[kbd] __getattr__ {name}")
269+ """
270+ Forward any undefined method/attribute to the underlying LVGL keyboard.
271+
272+ This allows MposKeyboard to support ALL lv.keyboard methods automatically
273+ without needing to manually wrap each one. Any method not defined on
274+ MposKeyboard will be forwarded to self._keyboard.
275+
276+ Examples:
277+ keyboard.set_textarea(ta) # Works
278+ keyboard.align(lv.ALIGN.CENTER) # Works
279+ keyboard.set_style_opa(128, 0) # Works
280+ keyboard.any_lvgl_method() # Works!
281+ """
282+ # Forward to the underlying keyboard object
283+ return getattr (self ._keyboard , name )
0 commit comments