File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99sys .path .append ('lib/' )
1010
1111import mpos .ui
12+ import mpos .clipboard
1213
1314#TFT_HOR_RES=640
1415#TFT_VER_RES=480
@@ -43,6 +44,7 @@ def catch_escape_key(indev, indev_data):
4344import sdl_keyboard
4445sdlkeyboard = sdl_keyboard .SDLKeyboard ()
4546sdlkeyboard ._indev_drv .set_read_cb (catch_escape_key ) # check for escape
47+ sdlkeyboard .set_paste_text_callback (mpos .clipboard .paste_text )
4648
4749#def keyboard_cb(event):
4850 # global canvas
Original file line number Diff line number Diff line change 1- # simple clipboard
1+ import lvgl as lv
22
33copied = None
44
@@ -7,3 +7,10 @@ def add(tocopy):
77
88def get ():
99 return copied
10+
11+ def paste_text (text ): # called when CTRL-V is pressed on the keyboard
12+ print (f"mpos.ui.clipboard.py paste_text adding { text } " )
13+ group = lv .group_get_default ()
14+ focused_obj = group .get_focused ()
15+ if focused_obj and isinstance (focused_obj , lv .textarea ):
16+ focused_obj .add_text (text )
You can’t perform that action at this time.
0 commit comments