@@ -226,26 +226,6 @@ def attempt_connecting_thread(self, ssid, password):
226226lv .async_call (lambda l :self .refresh_list (),None )
227227
228228
229- def print_events (event ):
230- event_code = event .get_code ()
231- #print(f"got event {event_code}")
232- # Ignore:
233- # =======
234- # 19: HIT_TEST
235- # COVER_CHECK
236- # DRAW_MAIN
237- # DRAW_MAIN_BEGIN
238- # DRAW_MAIN_END
239- # DRAW_POST
240- # DRAW_POST_BEGIN
241- # DRAW_POST_END
242- # 39: CHILD_CHANGED
243- # GET_SELF_SIZE
244- if event_code not in [19 ,23 ,25 ,26 ,27 ,28 ,29 ,30 ,39 ,49 ]:
245- name = mpos .ui .get_event_name (event_code )
246- print (f"lv_event_t: code={ event_code } , name={ name } " )
247- target = event .get_target ()
248- print (f"target:{ target } " )
249229
250230
251231
@@ -304,7 +284,7 @@ def onCreate(self):
304284self .keyboard .add_event_cb (lambda * args :self .hide_keyboard (),lv .EVENT .READY ,None )
305285self .keyboard .add_event_cb (lambda * args :self .hide_keyboard (),lv .EVENT .CANCEL ,None )
306286self .keyboard .add_flag (lv .obj .FLAG .HIDDEN )
307- self .keyboard .add_event_cb (print_events ,lv .EVENT .ALL ,None )
287+ self .keyboard .add_event_cb (self . print_events ,lv .EVENT .ALL ,None )
308288print ("PasswordPage: Loading password page" )
309289self .setContentView (password_page )
310290
@@ -343,6 +323,40 @@ def hide_keyboard(self):
343323focusgroup .focus_prev ()# move the focus to the close button, otherwise it goes back to the textarea, which opens the keyboard again
344324mpos .ui .anim .smooth_hide (self .keyboard )
345325
326+ def print_events (self ,event ):
327+ event_code = event .get_code ()
328+ #print(f"got event {event_code}")
329+ # Ignore:
330+ # =======
331+ # 19: HIT_TEST
332+ # COVER_CHECK
333+ # DRAW_MAIN
334+ # DRAW_MAIN_BEGIN
335+ # DRAW_MAIN_END
336+ # DRAW_POST
337+ # DRAW_POST_BEGIN
338+ # DRAW_POST_END
339+ # 39: CHILD_CHANGED
340+ # GET_SELF_SIZE
341+ if event_code not in [19 ,23 ,25 ,26 ,27 ,28 ,29 ,30 ,39 ,49 ]:
342+ name = mpos .ui .get_event_name (event_code )
343+ print (f"lv_event_t: code={ event_code } , name={ name } " )
344+ #target=event.get_target()
345+ #print(f"target: {target}") # blob
346+ if event_code == lv .EVENT .VALUE_CHANGED :
347+ button = self .keyboard .get_selected_button ()
348+ text = self .keyboard .get_button_text (button )
349+ print (f"button{ button } and text{ text } " )
350+ if text == lv .SYMBOL .NEW_LINE :
351+ print ("Newline pressed, would be nice to close the keyboard but that triggers the cancel button..." )
352+ #self.hide_keyboard() # makes cancel button click!
353+ #self.keyboard.send_event(lv.EVENT.READY, None)
354+ # workaround: dont change focus to cancel button:
355+ #self.connect_button.remove_flag(lv.obj.FLAG.HIDDEN)
356+ #self.cancel_button.remove_flag(lv.obj.FLAG.HIDDEN)
357+ #mpos.ui.anim.smooth_hide(self.keyboard)
358+ # => doesnt work because then the focus goes back to the keyboard which reopens
359+
346360@staticmethod
347361def setPassword (ssid ,password ):
348362global access_points