11import lvgl as lv
22from mpos import Activity , DisplayMetrics , InputManager
33
4- indev_error_x = 160
5- indev_error_y = 120
6-
7- DARKPINK = lv .color_hex (0xEC048C )
8-
94import sys
105if sys .platform == "esp32" :
116 import mpong_xtensawin as mpong
@@ -70,7 +65,7 @@ def onCreate(self):
7065 def onResume (self , screen ):
7166 lv .log_register_print_cb (self .log_callback )
7267 mpong .init (self .buffer , self .hor_res , self .ver_res )
73- self .refresh_timer = lv .timer_create (self .run_mpong , 1 , None )
68+ self .refresh_timer = lv .timer_create (self .run_mpong , 15 , None )
7469
7570 def onPause (self , screen ):
7671 if self .refresh_timer :
@@ -91,18 +86,21 @@ def move_right_unfocus(self):
9186 self .unfocus ()
9287 mpong .move_paddle (self .paddle_move_step )
9388
89+ # This only works with the PREV/pageup and NEXT/pagedown buttons,
90+ # because the focus_direction handling of the arrow keys uses a trick to move focus (focus_next)
91+ # which conflicts with the focus_next below...
9492 def unfocus (self ):
9593 focusgroup = lv .group_get_default ()
9694 if not focusgroup :
9795 print ("WARNING: imageview.py could not get default focus group" )
9896 return
9997 focused = focusgroup .get_focused ()
10098 if focused :
101- print (f"got focus button: { focused } " )
99+ # print(f"got focus button: {focused}")
102100 label = focused .get_child (0 )
103- print (f"got label for button: { label .get_text ()} " )
101+ # print(f"got label for button: {label.get_text()}")
104102 #focused.remove_state(lv.STATE.FOCUSED) # this doesn't seem to work to remove focus
105- print ("checking which button is focused" )
103+ # print("checking which button is focused")
106104 if focused == self .rightbutton :
107105 #print("next is focused")
108106 focusgroup .focus_prev ()
0 commit comments