wifi.py: small reworks

This commit is contained in:
Thomas Farstrike
2025-10-08 16:20:48 +02:00
parent 58cc2a91fb
commit f3fb400b19
@@ -226,26 +226,6 @@ class WiFi(Activity):
lv.async_call(lambda l: self.refresh_list(), None)
def print_events(event):
event_code=event.get_code()
#print(f"got event {event_code}")
# Ignore:
# =======
# 19: HIT_TEST
# COVER_CHECK
# DRAW_MAIN
# DRAW_MAIN_BEGIN
# DRAW_MAIN_END
# DRAW_POST
# DRAW_POST_BEGIN
# DRAW_POST_END
# 39: CHILD_CHANGED
# GET_SELF_SIZE
if event_code not in [19,23,25,26,27,28,29,30,39,49]:
name = mpos.ui.get_event_name(event_code)
print(f"lv_event_t: code={event_code}, name={name}")
target=event.get_target()
print(f"target: {target}")
@@ -304,7 +284,7 @@ class PasswordPage(Activity):
self.keyboard.add_event_cb(lambda *args: self.hide_keyboard(), lv.EVENT.READY, None)
self.keyboard.add_event_cb(lambda *args: self.hide_keyboard(), lv.EVENT.CANCEL, None)
self.keyboard.add_flag(lv.obj.FLAG.HIDDEN)
self.keyboard.add_event_cb(print_events, lv.EVENT.ALL, None)
self.keyboard.add_event_cb(self.print_events, lv.EVENT.ALL, None)
print("PasswordPage: Loading password page")
self.setContentView(password_page)
@@ -343,6 +323,40 @@ class PasswordPage(Activity):
focusgroup.focus_prev() # move the focus to the close button, otherwise it goes back to the textarea, which opens the keyboard again
mpos.ui.anim.smooth_hide(self.keyboard)
def print_events(self, event):
event_code=event.get_code()
#print(f"got event {event_code}")
# Ignore:
# =======
# 19: HIT_TEST
# COVER_CHECK
# DRAW_MAIN
# DRAW_MAIN_BEGIN
# DRAW_MAIN_END
# DRAW_POST
# DRAW_POST_BEGIN
# DRAW_POST_END
# 39: CHILD_CHANGED
# GET_SELF_SIZE
if event_code not in [19,23,25,26,27,28,29,30,39,49]:
name = mpos.ui.get_event_name(event_code)
print(f"lv_event_t: code={event_code}, name={name}")
#target=event.get_target()
#print(f"target: {target}") # blob
if event_code == lv.EVENT.VALUE_CHANGED:
button = self.keyboard.get_selected_button()
text = self.keyboard.get_button_text(button)
print(f"button {button} and text {text}")
if text == lv.SYMBOL.NEW_LINE:
print("Newline pressed, would be nice to close the keyboard but that triggers the cancel button...")
#self.hide_keyboard() # makes cancel button click!
#self.keyboard.send_event(lv.EVENT.READY, None)
# workaround: dont change focus to cancel button:
#self.connect_button.remove_flag(lv.obj.FLAG.HIDDEN)
#self.cancel_button.remove_flag(lv.obj.FLAG.HIDDEN)
#mpos.ui.anim.smooth_hide(self.keyboard)
# => doesnt work because then the focus goes back to the keyboard which reopens
@staticmethod
def setPassword(ssid, password):
global access_points