From: dxy15521469561 <1731678236@qq.com> Date: Tue, 21 Nov 2023 08:07:35 +0000 (+0800) Subject: C06S优化 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=be2fbdaea40a2afcc4f3affb35199d9ad679ecb6;p=mirrors%2FASR1603_G5.git C06S优化 --- diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py index a9f28e79..1c56b926 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/alarm.py @@ -1043,8 +1043,7 @@ class ClkListScreen(Screen): # EventMesh.publish("set_rtc_alarm") # print("sw_event_cb ~~~") - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "toolbox"}) + # def done_return(self): # EventMesh.publish("load_screen", {"screen": "toolbox"}) @@ -1052,6 +1051,9 @@ class ClkListScreen(Screen): def btn1_release(self): EventMesh.publish("load_screen", {"screen": "toolbox"}) + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py index dc498ccb..26bb4f70 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appFactoryMode.py @@ -127,11 +127,11 @@ class FactoryModeScreen(Screen): super().__init__() self.is_sliding = 0 self.meta = factorymode_screen - factorymode_location.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeLocation")), lv.EVENT.CLICKED, None) + factorymode_location.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeLocation")), lv.EVENT.SHORT_CLICKED, None) #factorymode_alipay_init.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeAlipayInit"})), lv.EVENT.CLICKED, None) - factorymode_bat_test.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeBatTest")), lv.EVENT.CLICKED, None) - factorymode_hsensor_test.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeHsensorTest")), lv.EVENT.CLICKED, None) - factorymode_log.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeLog")), lv.EVENT.CLICKED, None) + factorymode_bat_test.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeBatTest")), lv.EVENT.SHORT_CLICKED, None) + factorymode_hsensor_test.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeHsensorTest")), lv.EVENT.SHORT_CLICKED, None) + factorymode_log.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeLog")), lv.EVENT.SHORT_CLICKED, None) factorymode_location.add_event_cb(lambda e: EventMesh.callback_wrapper(self.location_mode(e, "FactoryModeLocation")), lv.EVENT.PRESSING, None) #factorymode_alipay_init.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeAlipayInit"})), lv.EVENT.CLICKED, None) @@ -157,7 +157,7 @@ class FactoryModeScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -271,15 +271,17 @@ class FactoryModeLogScreen(Screen): self.log_data = "" pass - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "factorymode"}) + def done_return(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) - + + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) + def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -386,12 +388,11 @@ class FactoryModeHsensorTestScreen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) - def done_left_to_right(self): + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) - def btn1_release(self): + def done_left_to_right(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) - def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -433,15 +434,15 @@ class FactoryModeBatTestScreen(Screen): def Close(self): self.BatTest_timer.stop() pass - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "factorymode"}) - def done_return(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) - + + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) + def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -615,13 +616,14 @@ class FactoryModeLocationScreen(Screen): EventMesh.publish(constants.EVENT.CLOSE_LOCATION) self.timer_FactoryModeLocation.stop() - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "factorymode"}) def done_return(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "factorymode"}) + + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "factorymode"}) def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) \ No newline at end of file diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py index 344403e3..7f1c6697 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/appWechat.py @@ -595,12 +595,14 @@ class WechatScreen(Screen): self.countdown = 15 wechat_press_label_countdown.set_text("{}S".format(str(self.countdown))) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - + + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py index 351e6dc4..9dcc9e86 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py @@ -610,7 +610,7 @@ def voice_callback(args): screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: if screen_NAME != "dialing_noplay_popup": - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("return_prev_screen") EventMesh.publish("set_sos_info_call") print('voicecall disconnect end') @@ -726,7 +726,7 @@ class DeviceInfoManager(Abstract): self.hsensor.init() self.hsensor.close() try : - self.hsensor.set_sar(0) + self.hsensor.set_sar(1) except Exception as e: print("Hsensor none set_sar:{}".format(e)) self.old_temp_time = 0 @@ -2547,6 +2547,7 @@ class gethistoryDataManager(Abstract): with open("/ext/static/storage_file/history_temp.json","w",encoding="utf-8") as fd: ujson.dump(self.read_histroy_temp_data,fd) #print(self.read_histroy_temp_data) + EventMesh.publish("show_history_temp_data") def get_history_hr_value(self, event, msg): #近7次心率历史数据统计显示 if self.read_histroy_hr_data: @@ -2561,6 +2562,7 @@ class gethistoryDataManager(Abstract): def save_hr_value(self, event, msg): if msg >= 50: + EventMesh.publish("set_storage_config",["old_hr",msg]) self.oldHr = msg @@ -2582,6 +2584,7 @@ class gethistoryDataManager(Abstract): with open("/ext/static/storage_file/history_hr.json","w",encoding="utf-8") as fd: ujson.dump(self.read_histroy_hr_data,fd) + EventMesh.publish("show_history_hr_data") #print(self.read_histroy_hr_data) @@ -2590,6 +2593,7 @@ class gethistoryDataManager(Abstract): def save_spo2_value(self, event, msg): if msg >= 85: + EventMesh.publish("set_storage_config",["old_spo2",msg]) self.oldspo2 = msg @@ -2610,6 +2614,7 @@ class gethistoryDataManager(Abstract): with open("/ext/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd: ujson.dump(self.read_histroy_spo2_data,fd) + EventMesh.publish("show_history_spo2_data") #print(self.read_histroy_spo2_data) def get_spo2_value(self, event, msg): diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py index 84059e2e..b02aa48c 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui.py @@ -173,6 +173,7 @@ style_wechat_btn.set_shadow_opa(0) style_contact_btn = lv.style_t() style_contact_btn.init() style_contact_btn.set_bg_color(lv.color_make(0xff, 0xff, 0xff)) +style_contact_btn.set_radius(5) style_contact_btn.set_border_width(0) style_contact_btn.set_shadow_opa(0) @@ -528,7 +529,7 @@ class PhoneScreen(Screen): # lv.EVENT.PRESSING, None) phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)), lv.EVENT.PRESSING, None) # # phone_contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.contact(e)), @@ -729,7 +730,7 @@ class PhoneScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -796,12 +797,14 @@ class PhoneScreen(Screen): self.timer.stop() - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -858,13 +861,16 @@ class CallLogScreen(Screen): print("call_log_screen") call_log_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) call_log_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - + call_log_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), + lv.EVENT.GESTURE, None) + call_log_cont_list_screen = lv.obj(call_log_screen) call_log_cont_list_screen.set_pos(0, 50) call_log_cont_list_screen.set_size(LCD_SIZE_W, LCD_SIZE_H-50) call_log_cont_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) call_log_cont_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - + call_log_cont_list_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), + lv.EVENT.GESTURE, None) call_log_title = lv.label(call_log_screen) call_log_title.set_pos(0, 10) @@ -887,13 +893,15 @@ class CallLogScreen(Screen): self.call_log_detail_list.set_size(LCD_SIZE_W, LCD_SIZE_H-50+1) self.call_log_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.call_log_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + self.call_log_detail_list.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), + lv.EVENT.GESTURE, None) for i in range(self.CALL_LOG_MAX): _btn = lv.btn(self.call_log_detail_list) _btn.add_flag(lv.obj.FLAG.CLICKABLE) _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), - lv.EVENT.CLICKED, None) - _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), - lv.EVENT.PRESSING, None) + lv.EVENT.SHORT_CLICKED, None) + # _btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), + # lv.EVENT.PRESSING, None) _btn.add_flag(lv.obj.FLAG.HIDDEN) _btn_label2 = lv.label(_btn) _btn_label3 = lv.label(_btn) @@ -944,10 +952,12 @@ class CallLogScreen(Screen): # print("num_count :{} num_name:{} num_time:{}".format(num_count,num_name,num_time)) #_btn = lv.btn(self.call_log_detail_list) self.call_log_detail_list_dict[h]["_btn"].set_size(LCD_SIZE_W-10,CALL_LOG_LIST_SIZE) - self.call_log_detail_list_dict[h]["_btn"].set_pos(0,(CALL_LOG_LIST_SIZE+4)*h) + self.call_log_detail_list_dict[h]["_btn"].set_pos(5,(CALL_LOG_LIST_SIZE+4)*h) #self.call_log_detail_list_dict[h]["_btn"].add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) self.call_log_detail_list_dict[h]["_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) + # self.call_log_detail_list_dict[h]["_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), + # lv.EVENT.PRESSING, None) #_btn_label2 = lv.label(_btn) @@ -996,11 +1006,14 @@ class CallLogScreen(Screen): def calling(self,e): code = e.get_code() - if code == lv.EVENT.PRESSING: - #print("PRESSING") - self.is_sliding += 1 + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: global call_log_screen,contacts_cont_list ,call_log_title ,none_call_log_title if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 self.is_sliding = 0 @@ -1077,12 +1090,14 @@ class CallLogScreen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1143,7 +1158,7 @@ class DialingScreen(Screen): hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) hangup_imgbtn.set_pos(80, 210) hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.PRESSING, None) self.meta = dialing_screen @@ -1161,7 +1176,7 @@ class DialingScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -1176,7 +1191,7 @@ class DialingScreen(Screen): screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: if screen_NAME != "dialing_noplay_popup": - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("return_prev_screen") self.is_sliding =0 @@ -1242,23 +1257,25 @@ class NoSimScreen(Screen):# self.meta = no_sim_popup_screen - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") + - def done_right_to_left(self): + def done_return(self): EventMesh.publish("return_prev_screen") - def done_bottom_to_top(self): + + def btn1_release(self): EventMesh.publish("return_prev_screen") - def done_top_to_bottom(self): + def done_left_to_right(self): EventMesh.publish("return_prev_screen") - def done_return(self): + def done_right_to_left(self): EventMesh.publish("return_prev_screen") + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") - def btn1_release(self): + def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") def btn8_press(self): @@ -1314,22 +1331,24 @@ class NovaliedNumScreen(Screen):# def Close(self): self.timer.stop() - def done_left_to_right(self): + + + def done_return(self): EventMesh.publish("return_prev_screen") - def done_right_to_left(self): + def btn1_release(self): EventMesh.publish("return_prev_screen") - def done_bottom_to_top(self): + def done_left_to_right(self): EventMesh.publish("return_prev_screen") - def done_top_to_bottom(self): + def done_right_to_left(self): EventMesh.publish("return_prev_screen") - def done_return(self): + def done_bottom_to_top(self): EventMesh.publish("return_prev_screen") - def btn1_release(self): + def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") def btn8_press(self): @@ -1411,10 +1430,10 @@ class NoSimPowerScreen(Screen):# self.meta = no_sim_power_screen no_sim_power_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) no_sim_power_screen_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) no_sim_power_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), lv.EVENT.PRESSING, None) @@ -1429,7 +1448,7 @@ class NoSimPowerScreen(Screen):# #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -1534,10 +1553,10 @@ class NoSimAutoScreen(Screen):#无sim卡是否关机 self.meta = no_sim_auto_screen no_sim_auto_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) no_sim_auto_screen_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) no_sim_auto_screen_comfirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)), lv.EVENT.PRESSING, None) @@ -1566,7 +1585,7 @@ class NoSimAutoScreen(Screen):#无sim卡是否关机 #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -1649,7 +1668,7 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 dialing_popup_hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) dialing_popup_hangup_imgbtn.set_pos(80, 210) dialing_popup_hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) dialing_popup_hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.PRESSING, None) self.meta = dialing_popup_screen @@ -1740,7 +1759,7 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -1755,7 +1774,7 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出 EventMesh.publish("set_interrup_incall",0) EventMesh.publish("set_UI_high_priority",0) - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("return_prev_screen") self.is_sliding =0 @@ -1822,22 +1841,24 @@ class DialNoconnectPopupScreen(Screen):#你所拨打的电话暂时无法接通 EventMesh.publish("set_sos_info_call") self.timer.stop() - def done_left_to_right(self): + + + def done_return(self): EventMesh.publish("return_prev_screen") - def done_right_to_left(self): + def btn1_release(self): EventMesh.publish("return_prev_screen") - def done_bottom_to_top(self): + def done_left_to_right(self): EventMesh.publish("return_prev_screen") - def done_top_to_bottom(self): + def done_right_to_left(self): EventMesh.publish("return_prev_screen") - def done_return(self): + def done_bottom_to_top(self): EventMesh.publish("return_prev_screen") - def btn1_release(self): + def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") def btn8_press(self): @@ -1890,12 +1911,14 @@ class chargefullScreen(Screen):#充电已满弹窗提示 def done_return(self): EventMesh.publish("return_prev_screen") - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") + def btn1_release(self): EventMesh.publish("return_prev_screen") + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("return_prev_screen") @@ -1932,6 +1955,16 @@ class NewMessageScreen(Screen): + + + def done_return(self): + EventMesh.publish("return_prev_screen") + def done_click(self): + EventMesh.publish("load_screen", {"screen": "popup"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): EventMesh.publish("return_prev_screen") @@ -1944,14 +1977,6 @@ class NewMessageScreen(Screen): def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") - def done_return(self): - EventMesh.publish("return_prev_screen") - def done_click(self): - EventMesh.publish("load_screen", {"screen": "popup"}) - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1992,6 +2017,16 @@ class RemoveMessageScreen(Screen):#删除短信弹窗框 def Close(self): self.timer.stop() + + + def done_return(self): + EventMesh.publish("return_prev_screen") + def done_click(self): + EventMesh.publish("load_screen", {"screen": "popup"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): EventMesh.publish("return_prev_screen") @@ -2004,14 +2039,6 @@ class RemoveMessageScreen(Screen):#删除短信弹窗框 def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") - def done_return(self): - EventMesh.publish("return_prev_screen") - def done_click(self): - EventMesh.publish("load_screen", {"screen": "popup"}) - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) message_full_screen = None @@ -2063,8 +2090,8 @@ class MessageFullScreen(Screen): message_full_cancel.set_ext_click_area(20) self.meta = message_full_screen - message_full_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) - message_full_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) + message_full_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.SHORT_CLICKED, None) + message_full_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.SHORT_CLICKED, None) message_full_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.PRESSING, None) message_full_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.PRESSING, None) @@ -2079,7 +2106,7 @@ class MessageFullScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -2096,6 +2123,14 @@ class MessageFullScreen(Screen): def concel(self, e): EventMesh.publish("return_prev_screen") + + + def done_return(self): + EventMesh.publish("return_prev_screen") + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): EventMesh.publish("return_prev_screen") @@ -2108,12 +2143,6 @@ class MessageFullScreen(Screen): def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") - def done_return(self): - EventMesh.publish("return_prev_screen") - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) ############短信############################### @@ -2200,7 +2229,8 @@ class PopupScreen(Screen): print("msg_list_screen") msg_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) msg_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - + msg_list_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), + lv.EVENT.GESTURE, None) msg_top_title = lv.label(msg_list_screen) @@ -2238,12 +2268,14 @@ class PopupScreen(Screen): self.sms_detail_list.set_size(LCD_SIZE_W-10, LCD_SIZE_H-50+1) self.sms_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.sms_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + self.sms_detail_list.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), + lv.EVENT.GESTURE, None) for i in range(MSG_MAX): msg_btn = lv.btn(self.sms_detail_list) msg_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), - lv.EVENT.CLICKED, None) - msg_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), - lv.EVENT.PRESSING, None) + lv.EVENT.SHORT_CLICKED, None) + # msg_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), + # lv.EVENT.PRESSING, None) msg_btn.add_flag(lv.obj.FLAG.HIDDEN) _btn_label2 = lv.label(msg_btn) _btn_label3 = lv.label(msg_btn) @@ -2450,7 +2482,7 @@ class PopupScreen(Screen): if tmp != -1: #msg_btn = lv.btn(self.sms_detail_list) self.sms_detail_list_dict[i]["msg_btn"].set_size(LCD_SIZE_W-10,SMS_LIST_ONE_ICON) - self.sms_detail_list_dict[i]["msg_btn"].set_pos(0,(SMS_LIST_ONE_ICON+4)*count) + self.sms_detail_list_dict[i]["msg_btn"].set_pos(5,(SMS_LIST_ONE_ICON+4)*count) #self.sms_detail_list_dict[i]["msg_btn"].add_style(style_sms_bg_btn, lv.PART.MAIN | lv.STATE.DEFAULT) # self.sms_detail_list_dict[i]["msg_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.sms_cb(e)), # lv.EVENT.CLICKED, None) @@ -2509,21 +2541,21 @@ class PopupScreen(Screen): def sms_cb(self, e): code = e.get_code() - if code == lv.EVENT.PRESSING: - #print("PRESSING") - self.is_sliding += 1 + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + elif code == lv.EVENT.SHORT_CLICKED: + _name = e.get_target().get_child(0).get_text() + EventMesh.publish("save_msg_name", _name) + content = e.get_target().get_child(1).get_text() + EventMesh.publish("save_msg_content", content) + EventMesh.publish("load_screen", {"screen": "msg_detail"}) + - elif code == lv.EVENT.CLICKED: - #utime.sleep_ms(10) - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - self.is_sliding = 0 - _name = e.get_target().get_child(0).get_text() - EventMesh.publish("save_msg_name", _name) - content = e.get_target().get_child(1).get_text() - EventMesh.publish("save_msg_content", content) - EventMesh.publish("load_screen", {"screen": "msg_detail"}) - self.is_sliding =0 def done_DOWN(self):#下滑 if self.sms_detail_list != None: scroll_y = self.sms_detail_list.get_scroll_y() @@ -2540,12 +2572,15 @@ class PopupScreen(Screen): self.sms_detail_list.scroll_to_y(scroll_y+SMS_LIST_ONE_ICON,lv.ANIM.ON) pass - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) + + # def done_left_to_right(self): + # EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -2607,14 +2642,17 @@ class MsgDetailScreen(Screen): def post_processor_after_initialization(self): pass - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "popup"}) + def done_return(self): EventMesh.publish("load_screen", {"screen": "popup"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) + + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "popup"}) + def btn8_press(self): EventMesh.publish("load_screen", {"screen": "popup"}) @@ -2654,7 +2692,8 @@ class HeartrateScreen(Screen): self.timer = osTimer() self.point = 0 self.heart_value = 0 - self.is_sliding =0 + self.is_sliding = 0 + EventMesh.subscribe("show_history_hr_data",self.show_history_hr_data) def initialization(self): self.is_sliding =0 @@ -2755,22 +2794,23 @@ class HeartrateScreen(Screen): self.meta = heartrate_screen heartrate_reset_btn_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.restart_up(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) heartrate_reset_btn_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.restart_up(e)), lv.EVENT.PRESSING, None) heartrate_done_label.set_text(" ") heartrate_bpm_label.set_text("-- bpm") heartrate_start_label.set_text("正在测量中.") - EventMesh.publish("set_hr_state",1)#1代表手动进入测试界面 + # EventMesh.publish("set_hr_state",1)#1代表手动进入测试界面 - EventMesh.publish(constants.EVENT.START_HEART) + # EventMesh.publish(constants.EVENT.START_HEART) def post_processor_after_initialization(self): self.point = 0 self.is_sliding = 0 self.heart_value = 0 - self.show_history_data() + EventMesh.publish("show_history_hr_data") + # self.show_history_data() self.start_init() def restart_up(self,e): @@ -2781,7 +2821,7 @@ class HeartrateScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -2817,7 +2857,7 @@ class HeartrateScreen(Screen): EventMesh.publish(constants.EVENT.START_HEART) - def show_history_data(self): + def show_history_hr_data(self,event,msg): global hr_line1,hr_line2,hr_line3,hr_line4,hr_line5,hr_line6,hr_line7 read_data = {} read_data = EventMesh.publish("get_history_hr_value") @@ -2932,7 +2972,7 @@ class HeartrateScreen(Screen): # heartrate_done_label.set_text("测量完成") else: heartrate_bpm_label.set_text("-- bpm") - self.show_history_data() + self.point = 0 EventMesh.publish("set_hr_state",0)#0代表关闭测试 print("stop debug9") @@ -2950,6 +2990,11 @@ class HeartrateScreen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "health"}) + + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "health"}) + def done_left_to_right(self): self.timer.stop() get_hr_state = EventMesh.publish("get_hr_state") @@ -2958,11 +3003,8 @@ class HeartrateScreen(Screen): EventMesh.publish("set_hr_state",0)#0代表关闭测试 print("stop debug10") EventMesh.publish(constants.EVENT.STOP_HEART) - EventMesh.publish("load_screen", {"screen": "health"}) + EventMesh.publish("return_prev_screen") - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "health"}) - def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -3116,35 +3158,35 @@ class ToolboxScreen(Screen): toolbox_stopwatch_img.set_src("E:/static/tool/IMAGE_SECMENU_STOPWATCH.png") toolbox_stopwatch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - toolbox_step_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "step")), lv.EVENT.CLICKED, None) - toolbox_weather_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "weather")), lv.EVENT.CLICKED, None) - toolbox_alarm_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "clk_list")), lv.EVENT.CLICKED, None) - # toolbox_sms_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "popup"})), lv.EVENT.CLICKED, None) - toolbox_countdown_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "countdown")), lv.EVENT.CLICKED, None) - toolbox_stopwatch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "stopwatch")), lv.EVENT.CLICKED, None) + toolbox_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "void")), lv.EVENT.GESTURE, None) - toolbox_step_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "step")), lv.EVENT.PRESSING, None) - toolbox_weather_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "weather")), lv.EVENT.PRESSING, None) - toolbox_alarm_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "clk_list")), lv.EVENT.PRESSING, None) + toolbox_step_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "step")), lv.EVENT.SHORT_CLICKED, None) + toolbox_weather_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "weather")), lv.EVENT.SHORT_CLICKED, None) + toolbox_alarm_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "clk_list")), lv.EVENT.SHORT_CLICKED, None) # toolbox_sms_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "popup"})), lv.EVENT.CLICKED, None) - toolbox_countdown_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "countdown")), lv.EVENT.PRESSING, None) - toolbox_stopwatch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "stopwatch")), lv.EVENT.PRESSING, None) + toolbox_countdown_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "countdown")), lv.EVENT.SHORT_CLICKED, None) + toolbox_stopwatch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "stopwatch")), lv.EVENT.SHORT_CLICKED, None) + + # toolbox_step_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "step")), lv.EVENT.PRESSING, None) + # toolbox_weather_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "weather")), lv.EVENT.PRESSING, None) + # toolbox_alarm_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "clk_list")), lv.EVENT.PRESSING, None) + # # toolbox_sms_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "popup"})), lv.EVENT.CLICKED, None) + # toolbox_countdown_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "countdown")), lv.EVENT.PRESSING, None) + # toolbox_stopwatch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.tool_cb(e, "stopwatch")), lv.EVENT.PRESSING, None) self.meta = toolbox_screen def tool_cb(self,e,msg): code = e.get_code() - if code == lv.EVENT.PRESSING: - #print("PRESSING") - self.is_sliding += 1 + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + elif code == lv.EVENT.SHORT_CLICKED: + EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) - elif code == lv.EVENT.CLICKED: - #utime.sleep_ms(10) - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - self.is_sliding = 0 - EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) - - self.is_sliding =0 def done_DOWN(self):#下滑 scroll_y = toolbox_cont.get_scroll_y() print("scroll_y:{}".format(scroll_y)) @@ -3159,12 +3201,11 @@ class ToolboxScreen(Screen): toolbox_cont.scroll_to_y(scroll_y+TOOL_ICON_OFFSET_SIZE,lv.ANIM.ON) pass - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -3234,9 +3275,9 @@ class IncomingCallScreen(Screen): incoming_call_hangup.set_src("E:/static/hang_up.png") incoming_call_answer.add_event_cb(lambda e: EventMesh.callback_wrapper(self.answer(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) incoming_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) incoming_call_answer.add_event_cb(lambda e: EventMesh.callback_wrapper(self.answer(e)), lv.EVENT.PRESSING, None) incoming_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), @@ -3368,7 +3409,7 @@ class IncomingCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -3391,7 +3432,7 @@ class IncomingCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -3407,7 +3448,7 @@ class IncomingCallScreen(Screen): screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: if screen_NAME != "dialing_noplay_popup": - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("return_prev_screen") self.is_sliding =0 @@ -3536,7 +3577,7 @@ class OnCallScreen(Screen): on_call_volum_reduce_btn.set_size(60, 50) on_call_volum_reduce_btn.set_text(" ") on_call_volum_reduce_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) on_call_volum_reduce_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)), lv.EVENT.PRESSING, None) @@ -3553,7 +3594,7 @@ class OnCallScreen(Screen): on_call_volum_add_btn.set_size(60, 50) on_call_volum_add_btn.set_text(" ") on_call_volum_add_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) on_call_volum_add_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)), lv.EVENT.PRESSING, None) @@ -3566,7 +3607,7 @@ class OnCallScreen(Screen): on_call_volum_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) on_call_volum_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_volum_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.open_volum_show(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) on_call_volum_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.open_volum_show(e)), lv.EVENT.PRESSING, None) @@ -3577,7 +3618,7 @@ class OnCallScreen(Screen): on_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_hangup.set_src("E:/static/hang_up.png") on_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) on_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)), lv.EVENT.PRESSING, None) @@ -3589,7 +3630,7 @@ class OnCallScreen(Screen): on_call_tab_label.set_style_text_align(lv.TEXT_ALIGN.CENTER,0) on_call_tab_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) on_call_tab_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.on_call_tab_show(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) on_call_tab_label.add_event_cb(lambda e: EventMesh.callback_wrapper(self.on_call_tab_show(e)), lv.EVENT.PRESSING, None) @@ -3899,7 +3940,7 @@ class OnCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -3923,7 +3964,7 @@ class OnCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -3951,7 +3992,7 @@ class OnCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -3970,7 +4011,7 @@ class OnCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -4031,7 +4072,7 @@ class OnCallScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -4046,7 +4087,7 @@ class OnCallScreen(Screen): screen_NAME = EventMesh.publish("get_screen_NAME") if screen_NAME != None: if screen_NAME != "dialing_noplay_popup": - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("return_prev_screen") self.is_sliding =0 @@ -4121,15 +4162,18 @@ class StepScreen(Screen): def Close(self): self.timer.stop() - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "toolbox"}) + + # EventMesh.publish("load_screen", {"screen": "toolbox"}) # def done_return(self): # EventMesh.publish("load_screen", {"screen": "toolbox"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "toolbox"}) - + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -4291,14 +4335,16 @@ class WeatherScreen(Screen): no_connect_label.set_text("找不到服务器") no_connect_label1.set_text("请联网后重试") - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "toolbox"}) + # def done_return(self): # EventMesh.publish("load_screen", {"screen": "toolbox"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "toolbox"}) + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") def btn8_press(self): EventMesh.publish("watch_top_show") @@ -4356,7 +4402,9 @@ class ContactsScreen(Screen): print("contacts_screen") contacts_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) contacts_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - + contacts_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling_cb(e)), + lv.EVENT.GESTURE, None) + contacts_screen_list_screen = lv.obj(contacts_screen) contacts_screen_list_screen.set_pos(0, 50) contacts_screen_list_screen.set_size(LCD_SIZE_W, LCD_SIZE_H-50) @@ -4385,13 +4433,15 @@ class ContactsScreen(Screen): self.contact_detail_list.set_size(LCD_SIZE_W, LCD_SIZE_H-50+1) self.contact_detail_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.contact_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + self.contact_detail_list.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling_cb(e)), + lv.EVENT.GESTURE, None) for i in range(self.MXA_phone_num): contact_btn = lv.btn(self.contact_detail_list) contact_btn.add_flag(lv.obj.FLAG.CLICKABLE) contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling_cb(e)), - lv.EVENT.CLICKED, None) - contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling_cb(e)), - lv.EVENT.PRESSING, None) + lv.EVENT.SHORT_CLICKED, None) + # contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling_cb(e)), + # lv.EVENT.PRESSING, None) contact_btn.add_flag(lv.obj.FLAG.HIDDEN) contact_btn_label_1 = lv.label(contact_btn) @@ -4422,8 +4472,10 @@ class ContactsScreen(Screen): if contacts_screen == None: return #读取json文件中的键作为label文本; - + self.check_json = True + if self.check_json == True and len(self.phonebook) != 0: + self.contact_detail_list.clear_flag(lv.obj.FLAG.HIDDEN) contact_none_label.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本 j =0 @@ -4438,11 +4490,12 @@ class ContactsScreen(Screen): name = self.phonebook[phonebook_keys[j]] key_tmp =phonebook_keys[j] - print("name :{} key_tmp:{}".format(name,key_tmp)) + + # print("name :{} key_tmp:{}".format(name,key_tmp)) #contact_btn = lv.btn(self.contact_detail_list) self.contact_detail_listt_dict[i]["contact_btn"].set_size(LCD_SIZE_W-10,CONTACTS_LIST_SIZE) - self.contact_detail_listt_dict[i]["contact_btn"].set_pos(0,(CONTACTS_LIST_SIZE+6)*i ) + self.contact_detail_listt_dict[i]["contact_btn"].set_pos(5,(CONTACTS_LIST_SIZE+6)*i ) #self.contact_detail_listt_dict[i]["contact_btn"].add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.DEFAULT) # contact_btn.add_style(style_contact_btn_pressed, lv.PART.MAIN | lv.STATE.PRESSED) # self.contact_detail_listt_dict[i]["contact_btn"].add_event_cb(lambda e: EventMesh.callback_wrapper(self.calling(e)), @@ -4484,21 +4537,20 @@ class ContactsScreen(Screen): def calling_cb(self,e): code = e.get_code() - if code == lv.EVENT.PRESSING: - #print("PRESSING") - self.is_sliding += 1 + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) - elif code == lv.EVENT.CLICKED: - #utime.sleep_ms(10) - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 - msg_text = e.get_target().get_child(1).get_text() - EventMesh.publish("publish_message_event_ui",{"func":self.calling,"data":msg_text}) - else: - EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) + elif code == lv.EVENT.SHORT_CLICKED: + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 + msg_text = e.get_target().get_child(1).get_text() + EventMesh.publish("publish_message_event_ui",{"func":self.calling,"data":msg_text}) + else: + EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) - self.is_sliding =0 def calling(self,msg_text): @@ -4533,12 +4585,14 @@ class ContactsScreen(Screen): self.contact_detail_list.scroll_to_y(scroll_y+CONTACTS_LIST_SIZE,lv.ANIM.ON) pass - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -4586,7 +4640,7 @@ class TemperatureScreen(Screen): self.point = 0 self.temp_value = 0 self.is_sliding =0 - + EventMesh.subscribe("show_history_temp_data",self.show_history_temp_data) def initialization(self): self.is_sliding =0 global temperature_screen,temperature_keep_label,temperature_label,temp_reset_btn_img,temp_line1,temp_line2,temp_line3,temp_line4,temp_line5,\ @@ -4703,7 +4757,7 @@ class TemperatureScreen(Screen): self.meta = temperature_screen temp_reset_btn_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.restart_up(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) temp_reset_btn_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.restart_up(e)), lv.EVENT.PRESSING, None) size_x = len(str("- -"))*14 @@ -4725,7 +4779,7 @@ class TemperatureScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -4742,7 +4796,7 @@ class TemperatureScreen(Screen): temperature_start_label.set_text("正在测量中.") EventMesh.publish("set_temp_state",1) EventMesh.publish(constants.EVENT.START_TEMP) - self.show_history_data() + EventMesh.publish("show_history_temp_data") self.timer.start(1*500, 1, self.start_measure) self.is_sliding =0 @@ -4760,10 +4814,10 @@ class TemperatureScreen(Screen): temperature_start_label.set_text("正在测量中.") EventMesh.publish("set_temp_state",1) EventMesh.publish(constants.EVENT.START_TEMP) - self.show_history_data() + EventMesh.publish("show_history_temp_data") self.timer.start(1*500, 1, self.start_measure) - def show_history_data(self): + def show_history_temp_data(self,event,msg): global temp_line1,temp_line2,temp_line3,temp_line4,temp_line5,temp_line6,temp_line7 read_data = {} read_data = EventMesh.publish("get_history_temp_value") @@ -4942,9 +4996,6 @@ class TemperatureScreen(Screen): else: temperature_done_img.set_src("E:/static/temp_gif03.png") temp_reset_btn_img.clear_flag(lv.obj.FLAG.HIDDEN) - - self.show_history_data() - self.point = 0 EventMesh.publish("set_temp_state",0) @@ -4958,18 +5009,20 @@ class TemperatureScreen(Screen): EventMesh.publish("set_temp_state",0) EventMesh.publish(constants.EVENT.STOP_TEMP) - def done_left_to_right(self): - self.timer.stop() - EventMesh.publish("set_temp_state",0) - EventMesh.publish(constants.EVENT.STOP_TEMP) - EventMesh.publish("load_screen", {"screen": "health"}) + def done_return(self): EventMesh.publish("load_screen", {"screen": "health"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "health"}) - + + def done_left_to_right(self): + self.timer.stop() + EventMesh.publish("set_temp_state",0) + EventMesh.publish(constants.EVENT.STOP_TEMP) + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -5018,6 +5071,8 @@ class Spo2Screen(Screen): self.point = 0 self.spo2_value = 0 self.is_sliding = 0 + EventMesh.subscribe("show_history_spo2_data",self.show_history_spo2_data) + #self.Hsensor = None def initialization(self): self.is_sliding = 0 @@ -5113,7 +5168,7 @@ class Spo2Screen(Screen): self.meta = spo2_screen spo2_reset_btn_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.restart_up(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) spo2_reset_btn_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.restart_up(e)), lv.EVENT.PRESSING, None) @@ -5121,7 +5176,7 @@ class Spo2Screen(Screen): self.point = 0 self.is_sliding= 0 self.spo2_value = 0 - self.show_history_data() + EventMesh.publish("show_history_spo2_data") self.start_init() def restart_up(self,e): @@ -5134,7 +5189,7 @@ class Spo2Screen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -5163,7 +5218,7 @@ class Spo2Screen(Screen): EventMesh.publish("set_spo2_state",1)#2代表后台进入血氧测试 EventMesh.publish(constants.EVENT.START_BLOOD_OXYGEN) - def show_history_data(self): + def show_history_spo2_data(self,event,msg): global spo2_line1,spo2_line2,spo2_line3,spo2_line4,spo2_line5,spo2_line6,spo2_line7 read_data = {} read_data = EventMesh.publish("get_history_spo2_value") @@ -5298,7 +5353,7 @@ class Spo2Screen(Screen): spo2_value_label.set_text("- -%") - self.show_history_data() + # self.show_history_data() self.point = 0 EventMesh.publish("set_spo2_state",0)#0代表关闭测试 @@ -5316,6 +5371,11 @@ class Spo2Screen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "health"}) + + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "health"}) + def done_left_to_right(self): self.timer.stop() get_hr_state = EventMesh.publish("get_hr_state") @@ -5323,11 +5383,8 @@ class Spo2Screen(Screen): if get_hr_state == 1 or get_spo2_state == 1: EventMesh.publish("set_spo2_state",0)#0代表关闭测试 EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN) - EventMesh.publish("load_screen", {"screen": "health"}) + EventMesh.publish("return_prev_screen") - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "health"}) - def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -5576,9 +5633,9 @@ class CountdownScreen(Screen): countdown_hour_down_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hour_down(e)), lv.EVENT.CLICKED, None) countdown_start_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) countdown_reset_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reset(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) countdown_start_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)), lv.EVENT.PRESSING, None) countdown_reset_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reset(e)), @@ -5668,7 +5725,7 @@ class CountdownScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -5797,7 +5854,7 @@ class CountdownScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -5895,15 +5952,17 @@ class CountdownScreen(Screen): if self.g_end == 1: EventMesh.publish("load_screen", {"screen": "countdown"}) else: - EventMesh.publish("load_screen", {"screen": "toolbox"}) + EventMesh.publish("return_prev_screen") - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "toolbox"}) + def btn1_release(self): if self.g_state == 0: self.timer.stop() EventMesh.publish("load_screen", {"screen": "toolbox"}) + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") def btn8_press(self): if self.g_state == 0: @@ -5967,28 +6026,30 @@ class CountdownEndScreen(Screen): def Close(self): self.stop_FIND() - def done_left_to_right(self): + + + def done_return(self): self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) - def done_right_to_left(self): + def done_click(self): + print("count down !!!!!!!!!!") self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) - def done_bottom_to_top(self): + def done_left_to_right(self): self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) - def done_top_to_bottom(self): + def done_right_to_left(self): self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) - def done_return(self): + def done_bottom_to_top(self): self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) - def done_click(self): - print("count down !!!!!!!!!!") + def done_top_to_bottom(self): self.stop_FIND() EventMesh.publish("load_screen", {"screen": "countdown"}) @@ -6275,16 +6336,18 @@ class StopwatchScreen(Screen): self.timer.stop() EventMesh.publish("load_screen", {"screen": "toolbox"}) - def done_left_to_right(self): - if self.s_state == 0: - self.timer.stop() - EventMesh.publish("load_screen", {"screen": "toolbox"}) + def btn1_release(self): if self.s_state == 0: self.timer.stop() EventMesh.publish("load_screen", {"screen": "toolbox"}) - + + def done_left_to_right(self): + if self.s_state == 0: + self.timer.stop() + EventMesh.publish("return_prev_screen") + def btn8_press(self): if self.s_state == 0: self.timer.stop() @@ -6348,16 +6411,7 @@ class UIFINDScreen(Screen): self.FIND_timer.stop() self.aud.stop() #播放声音 - def done_left_to_right(self): - self.stop_FIND() - - def done_right_to_left(self): - self.stop_FIND() - def done_bottom_to_top(self): - self.stop_FIND() - - def done_top_to_bottom(self): - self.stop_FIND() + def done_return(self): self.stop_FIND() @@ -6369,7 +6423,17 @@ class UIFINDScreen(Screen): def btn1_release(self): self.stop_FIND() + def done_left_to_right(self): + self.stop_FIND() + + def done_right_to_left(self): + self.stop_FIND() + def done_bottom_to_top(self): + self.stop_FIND() + def done_top_to_bottom(self): + self.stop_FIND() + def btn8_press(self): self.stop_FIND() @@ -6399,6 +6463,15 @@ class LowPowerScreen(Screen): Lowpower_screen_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT) self.meta = Lowpower_screen + + def done_return(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_click(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + def btn1_release(self): + EventMesh.publish("load_screen", {"screen": "main_menu"}) + def done_left_to_right(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) def done_right_to_left(self): @@ -6407,13 +6480,6 @@ class LowPowerScreen(Screen): EventMesh.publish("load_screen", {"screen": "main_menu"}) def done_top_to_bottom(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_click(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) - - def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) def btn8_press(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -6470,25 +6536,27 @@ class LowOnePowerScreen(Screen): #0%的电池电量 def fun(self,e): EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"}) - def done_left_to_right(self): + + + def done_return(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_right_to_left(self): + def done_click(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_bottom_to_top(self): + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_top_to_bottom(self): + def done_left_to_right(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_return(self): + def done_right_to_left(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def done_click(self): + def done_bottom_to_top(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - def btn1_release(self): + def done_top_to_bottom(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) def btn8_press(self): @@ -6572,7 +6640,7 @@ class sosScreen(Screen): self.meta = sos_screen sos_screen_confirm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.timer_comfirm_cb(e)), - lv.EVENT.CLICKED, None) + lv.EVENT.SHORT_CLICKED, None) sos_screen_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.timer_cancel_cb(e)), lv.EVENT.CLICKED, None) @@ -6588,7 +6656,7 @@ class sosScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -6617,18 +6685,7 @@ class sosScreen(Screen): def Close(self): self.timer.stop() - def done_left_to_right(self): - EventMesh.publish("return_prev_screen") - pass - def done_right_to_left(self): - EventMesh.publish("return_prev_screen") - pass - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") - pass - def done_top_to_bottom(self): - EventMesh.publish("return_prev_screen") - pass + def done_return(self): EventMesh.publish("return_prev_screen") pass @@ -6642,6 +6699,19 @@ class sosScreen(Screen): def btn1_press(self): EventMesh.publish("return_prev_screen") pass + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + pass + def done_right_to_left(self): + EventMesh.publish("return_prev_screen") + pass + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") + pass + def done_top_to_bottom(self): + EventMesh.publish("return_prev_screen") + pass + def btn1_release(self): EventMesh.publish("return_prev_screen") pass @@ -6695,31 +6765,33 @@ class noSosDataScreen(Screen): EventMesh.publish("return_prev_screen") - def done_left_to_right(self): + + def done_return(self): EventMesh.publish("return_prev_screen") pass - def done_right_to_left(self): + def done_click(self): EventMesh.publish("return_prev_screen") pass - def done_bottom_to_top(self): - EventMesh.publish("return_prev_screen") + + def btn8_press(self): + pass - def done_top_to_bottom(self): + def btn1_press(self): EventMesh.publish("return_prev_screen") pass - def done_return(self): + def done_left_to_right(self): EventMesh.publish("return_prev_screen") pass - def done_click(self): + def done_right_to_left(self): EventMesh.publish("return_prev_screen") pass - - def btn8_press(self): - + def done_bottom_to_top(self): + EventMesh.publish("return_prev_screen") pass - def btn1_press(self): + def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") pass + def btn1_release(self): EventMesh.publish("return_prev_screen") pass @@ -6829,31 +6901,33 @@ class chargeInScreen(Screen): EventMesh.publish("return_prev_screen") - def done_left_to_right(self): + + def done_return(self): EventMesh.publish("return_prev_screen") pass - def done_right_to_left(self): + def done_click(self): EventMesh.publish("return_prev_screen") pass - def done_bottom_to_top(self): + + def btn8_press(self): EventMesh.publish("return_prev_screen") pass - def done_top_to_bottom(self): + def btn1_press(self): EventMesh.publish("return_prev_screen") pass - def done_return(self): + def done_left_to_right(self): EventMesh.publish("return_prev_screen") pass - def done_click(self): + def done_right_to_left(self): EventMesh.publish("return_prev_screen") pass - - def btn8_press(self): + def done_bottom_to_top(self): EventMesh.publish("return_prev_screen") pass - def btn1_press(self): + def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") pass + def btn1_release(self): EventMesh.publish("return_prev_screen") pass @@ -6912,31 +6986,33 @@ class chargeOutScreen(Screen): EventMesh.publish("return_prev_screen") - def done_left_to_right(self): + + def done_return(self): EventMesh.publish("return_prev_screen") pass - def done_right_to_left(self): + def done_click(self): EventMesh.publish("return_prev_screen") pass - def done_bottom_to_top(self): + + def btn8_press(self): EventMesh.publish("return_prev_screen") pass - def done_top_to_bottom(self): + def btn1_press(self): EventMesh.publish("return_prev_screen") pass - def done_return(self): + def done_left_to_right(self): EventMesh.publish("return_prev_screen") pass - def done_click(self): + def done_right_to_left(self): EventMesh.publish("return_prev_screen") pass - - def btn8_press(self): + def done_bottom_to_top(self): EventMesh.publish("return_prev_screen") pass - def btn1_press(self): + def done_top_to_bottom(self): EventMesh.publish("return_prev_screen") pass + def btn1_release(self): EventMesh.publish("return_prev_screen") pass @@ -7126,11 +7202,12 @@ class UI(object): self.screen_list = [] self.lv = lv self.system_sleep_timer = osTimer() + self.system_ui_timer = osTimer() self.system_sleep_timer_count = 0 self.sleep_flag = 1 self.level = 6 self.aud = audio.Audio(0) - + self.system_ui_state = 0 self.main_flag = 0 self.main_id = 0 self.set_interrup_flag = 0 @@ -7238,14 +7315,15 @@ class UI(object): return self.system_sleep_timeout_rest() #print("ui press {}".format(event)) - if event == "done_left_to_right": - self.screen.done_left_to_right() - if event == "done_right_to_left": - self.screen.done_right_to_left() - if event == "done_bottom_to_top": - self.screen.done_bottom_to_top() - if event == "done_top_to_bottom": - self.screen.done_top_to_bottom() + if self.system_ui_state == 0: + if event == "done_left_to_right": + self.screen.done_left_to_right() + if event == "done_right_to_left": + self.screen.done_right_to_left() + if event == "done_bottom_to_top": + self.screen.done_bottom_to_top() + if event == "done_top_to_bottom": + self.screen.done_top_to_bottom() if event == "done_return": self.screen.done_return() if event == "done_click": @@ -7398,6 +7476,10 @@ class UI(object): if self.system_sleep_timer_count >= time : self.system_sleep_timer_count = 0 self.__lcd_off() + + def system_ui_flag(self, *args): + self.system_ui_state = 0 + def system_sleep_timeout_rest(self) : #print("system_sleep_timeout_rest") @@ -7486,7 +7568,8 @@ class UI(object): self.__lcd_on() mem = gc.mem_free() print('2剩余内存RAM:{} KB'.format(mem / 1024)) - + self.system_ui_state = 1 + self.system_ui_timer.start(100, 0, self.system_ui_flag) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py index a5321e7b..7865de37 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_health.py @@ -139,40 +139,50 @@ class HealthScreen(Screen):#健康测量 def __init__(self): super().__init__() self.meta = health_screen + health_screen.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "void")), lv.EVENT.GESTURE, None) self.is_sliding = 0 # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None) - health_hr_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "heartrate")), lv.EVENT.CLICKED, None) + health_hr_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None) - hhealth_spo2_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "spo2")), lv.EVENT.CLICKED, None) - health_temp_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "temperature")), lv.EVENT.CLICKED, None) + hhealth_spo2_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) + health_temp_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) - health_hr_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "heartrate")), lv.EVENT.PRESSING, None) - # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None) - hhealth_spo2_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e,"spo2")), lv.EVENT.PRESSING, None) - health_temp_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "temperature")), lv.EVENT.PRESSING, None) + # health_hr_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "heartrate")), lv.EVENT.PRESSING, None) + # # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None) + # hhealth_spo2_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e,"spo2")), lv.EVENT.PRESSING, None) + # health_temp_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.healt_cb(e, "temperature")), lv.EVENT.PRESSING, None) def initialization(self): self.is_sliding = 0 def healt_cb(self,e,msg): code = e.get_code() - if code == lv.EVENT.PRESSING: - self.is_sliding += 1 - - elif code == lv.EVENT.CLICKED: - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - self.is_sliding = 0 - EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + elif code == lv.EVENT.SHORT_CLICKED: + EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) + # code = e.get_code() + # if code == lv.EVENT.PRESSING: + # self.is_sliding += 1 + + # elif code == lv.EVENT.SHORT_CLICKED: + # print("1self.is_sliding",self.is_sliding) + # if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 + # self.is_sliding = 0 + # EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) - self.is_sliding = 0 + # self.is_sliding = 0 - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "main_menu"}) - + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py index d641f716..0f8a8c41 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_main_menu.py @@ -584,57 +584,57 @@ class MainMenuScreen(Screen): ###1 MainMenu1_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event_cb(e)),lv.EVENT.SCROLL_END,None) #lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_END, NULL); - MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.CLICKED, None) + MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.PRESSING, None) - MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.CLICKED, None) + MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.PRESSING, None) - MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.CLICKED, None) + MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.PRESSING, None) - MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.CLICKED, None) + MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_calllog.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "call_log")), lv.EVENT.PRESSING, None) - MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.CLICKED, None) + MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_hr.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "heartrate")), lv.EVENT.PRESSING, None) - MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.CLICKED, None) + MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.PRESSING, None) - MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.CLICKED, None) + MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_temp.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "temperature")), lv.EVENT.PRESSING, None) - MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.CLICKED, None) + MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.PRESSING, None) - MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.CLICKED, None) + MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_alarm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "clk_list")), lv.EVENT.PRESSING, None) - MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.CLICKED, None) + MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_stopwatch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "stopwatch")), lv.EVENT.PRESSING, None) - MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.CLICKED, None) + MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_countdown.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "countdown")), lv.EVENT.PRESSING, None) - MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.CLICKED, None) + MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.PRESSING, None) - MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.CLICKED, None) + MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.SHORT_CLICKED, None) MainMenu1_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.PRESSING, None) ##2 print("MainMenu1:__init__") MainMenu2_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event_cb(e)),lv.EVENT.SCROLL_END,None) #lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_END, NULL); - MainMenu2_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.CLICKED, None) - MainMenu2_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.CLICKED, None) - MainMenu2_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.CLICKED, None) - MainMenu2_img_health.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "health")), lv.EVENT.CLICKED, None) - MainMenu2_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.CLICKED, None) - MainMenu2_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.CLICKED, None) - # MainMenu2_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.CLICKED, None) - MainMenu2_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.CLICKED, None) + MainMenu2_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.SHORT_CLICKED, None) + MainMenu2_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.SHORT_CLICKED, None) + MainMenu2_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.SHORT_CLICKED, None) + MainMenu2_img_health.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "health")), lv.EVENT.SHORT_CLICKED, None) + MainMenu2_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.SHORT_CLICKED, None) + MainMenu2_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.SHORT_CLICKED, None) + # MainMenu2_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.SHORT_CLICKED, None) + MainMenu2_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.SHORT_CLICKED, None) MainMenu2_img_phone.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "Phone")), lv.EVENT.PRESSING, None) MainMenu2_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.PRESSING, None) @@ -739,7 +739,7 @@ class MainMenuScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py index 0aae0b55..c2623c28 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/ui_setting.py @@ -32,6 +32,7 @@ setting_screen = lv.obj() print("setting_screen") setting_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + setting_imei_img = lv.img(setting_screen) setting_imei_img.set_pos(4, 10) setting_imei_img.set_size(232, 34) @@ -256,56 +257,65 @@ class SettingScreen(Screen): self.is_sliding =0 super().__init__() self.meta = setting_screen - + setting_screen.add_event_cb(lambda e:EventMesh.callback_wrapper(self.setting_cb(e,"void")), lv.EVENT.GESTURE, None) # img regist btton # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None) - setting_dialswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "dialswitch")), lv.EVENT.CLICKED, None) - setting_themeswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "themeswitch")), lv.EVENT.CLICKED, None) - setting_imei_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "imei")), lv.EVENT.CLICKED, None) - setting_app_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "app")), lv.EVENT.CLICKED, None) - setting_bright_bg_img.add_event_cb(lambda e:EventMesh.callback_wrapper( self.setting_cb(e, "brightness")), lv.EVENT.CLICKED, None) - setting_volume_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "totalvolume")), lv.EVENT.CLICKED, None) - setting_restore_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "restore")), lv.EVENT.CLICKED, None) - setting_poweroff_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "poweroff")), lv.EVENT.CLICKED, None) + setting_dialswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "dialswitch")), lv.EVENT.SHORT_CLICKED, None) + setting_themeswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "themeswitch")), lv.EVENT.SHORT_CLICKED, None) + setting_imei_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "imei")), lv.EVENT.SHORT_CLICKED, None) + setting_app_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "app")), lv.EVENT.SHORT_CLICKED, None) + setting_bright_bg_img.add_event_cb(lambda e:EventMesh.callback_wrapper( self.setting_cb(e, "brightness")), lv.EVENT.SHORT_CLICKED, None) + setting_volume_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "totalvolume")), lv.EVENT.SHORT_CLICKED, None) + setting_restore_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "restore")), lv.EVENT.SHORT_CLICKED, None) + setting_poweroff_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "poweroff")), lv.EVENT.SHORT_CLICKED, None) # setting_update_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "update")), lv.EVENT.CLICKED, None) - setting_version_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "version")), lv.EVENT.CLICKED, None) - - setting_dialswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "dialswitch")), lv.EVENT.PRESSING, None) - setting_themeswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "themeswitch")), lv.EVENT.PRESSING, None) - setting_imei_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "imei")), lv.EVENT.PRESSING, None) - setting_app_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "app")), lv.EVENT.PRESSING, None) - setting_bright_bg_img.add_event_cb(lambda e:EventMesh.callback_wrapper( self.setting_cb(e, "brightness")), lv.EVENT.PRESSING, None) - setting_volume_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "totalvolume")), lv.EVENT.PRESSING, None) - setting_restore_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "restore")), lv.EVENT.PRESSING, None) - setting_poweroff_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "poweroff")), lv.EVENT.PRESSING, None) - # setting_update_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "update")), lv.EVENT.PRESSING, None) - setting_version_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "version")), lv.EVENT.PRESSING, None) + setting_version_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "version")), lv.EVENT.SHORT_CLICKED, None) + + # setting_dialswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "dialswitch")), lv.EVENT.PRESSING, None) + # setting_themeswitch_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "themeswitch")), lv.EVENT.PRESSING, None) + # setting_imei_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "imei")), lv.EVENT.PRESSING, None) + # setting_app_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "app")), lv.EVENT.PRESSING, None) + # setting_bright_bg_img.add_event_cb(lambda e:EventMesh.callback_wrapper( self.setting_cb(e, "brightness")), lv.EVENT.PRESSING, None) + # setting_volume_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "totalvolume")), lv.EVENT.PRESSING, None) + # setting_restore_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "restore")), lv.EVENT.PRESSING, None) + # setting_poweroff_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "poweroff")), lv.EVENT.PRESSING, None) + # # setting_update_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "update")), lv.EVENT.PRESSING, None) + # setting_version_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, "version")), lv.EVENT.PRESSING, None) def initialization(self): self.is_sliding = 0 def setting_cb(self,e,msg): code = e.get_code() - if code == lv.EVENT.PRESSING: - #print("PRESSING") + indev = lv.indev_get_act() + lv.indev_t.wait_release(indev) + dir = lv.indev_t.get_gesture_dir(indev) + if code == lv.EVENT.GESTURE: + if dir == lv.DIR.RIGHT: + EventMesh.publish("load_screen", {"screen": "main_menu"}) + + elif code == lv.EVENT.PRESSING: + print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: + EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) #utime.sleep_ms(10) - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - self.is_sliding = 0 - EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) + # print("1self.is_sliding",self.is_sliding) + # if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 + # self.is_sliding = 0 + # if msg != "void": + # EventMesh.publish("load_screen", {"screen": "{}".format(msg)}) - self.is_sliding =0 + # self.is_sliding =0 - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + + def btn1_release(self): EventMesh.publish("return_setiing") EventMesh.publish("load_screen", {"screen": "main_menu"}) - + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -946,9 +956,9 @@ class RestoreScreen(Screen): self.is_sliding = 0 super().__init__() self.meta = restore_screen - restore_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) + restore_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.SHORT_CLICKED, None) restore_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.PRESSING, None) - restore_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) + restore_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.SHORT_CLICKED, None) restore_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.PRESSING, None) def initialization(self): @@ -960,7 +970,7 @@ class RestoreScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -974,7 +984,7 @@ class RestoreScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -987,12 +997,14 @@ class RestoreScreen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "setting"}) - + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1047,12 +1059,14 @@ class VersionScreen(Screen): def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "setting"}) + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1111,8 +1125,8 @@ class PoweroffScreen(Screen): super().__init__() self.is_sliding = 0 self.meta = poweroff_screen - poweroff_confirm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None) - poweroff_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None) + poweroff_confirm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.SHORT_CLICKED, None) + poweroff_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.SHORT_CLICKED, None) poweroff_confirm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.PRESSING, None) poweroff_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.PRESSING, None) @@ -1129,7 +1143,7 @@ class PoweroffScreen(Screen): #print("PRESSING") self.is_sliding += 1 - elif code == lv.EVENT.CLICKED: + elif code == lv.EVENT.SHORT_CLICKED: #utime.sleep_ms(10) print("1self.is_sliding",self.is_sliding) if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 @@ -1139,8 +1153,7 @@ class PoweroffScreen(Screen): #EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"}) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + def concel(self, e): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1148,6 +1161,9 @@ class PoweroffScreen(Screen): def btn1_release(self): EventMesh.publish("load_screen", {"screen": "setting"}) + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1426,8 +1442,9 @@ class ThemeswitchScreen(Screen): def __init__(self): super().__init__() - self.is_sliding = 0 self.meta = menustyle_screen + self.is_sliding1 = 0 + self.is_sliding2 = 0 menustyle_img1_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.fun1(e)), lv.EVENT.CLICKED, None) @@ -1439,8 +1456,10 @@ class ThemeswitchScreen(Screen): menustyle_img2_bg_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.fun2(e)), lv.EVENT.PRESSING, None) + def initialization(self): - self.is_sliding = 0 + self.is_sliding1 = 0 + self.is_sliding2 = 0 read_data = EventMesh.publish("get_storage_config","MainMenu") if read_data != None: if read_data == "1": @@ -1460,54 +1479,57 @@ class ThemeswitchScreen(Screen): code = e.get_code() if code == lv.EVENT.PRESSING: #print("PRESSING") - self.is_sliding += 1 + self.is_sliding1 += 1 elif code == lv.EVENT.CLICKED: #utime.sleep_ms(10) - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - self.is_sliding = 0 + print("1self.is_sliding",self.is_sliding1) + if self.is_sliding1 <= 5 and self.is_sliding1 != 0:#如果是在滑动中则不需要点击事件 + self.is_sliding1 = 0 menustyle_select.set_pos(int(190),int(80)) # menustyle_img1.set_src("E:/static/theme_four2.png") # menustyle_img2.set_src("E:/static/theme_single1.png") EventMesh.publish("set_mainmenu",[1]) EventMesh.publish("load_screen", {"screen": "main_menu"}) - self.is_sliding =0 + self.is_sliding1 =0 def fun2(self,e): code = e.get_code() if code == lv.EVENT.PRESSING: #print("PRESSING") - self.is_sliding += 1 + self.is_sliding2 += 1 elif code == lv.EVENT.CLICKED: #utime.sleep_ms(10) - print("1self.is_sliding",self.is_sliding) - if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件 - self.is_sliding = 0 + print("2self.is_sliding",self.is_sliding2) + if self.is_sliding2 <= 5 and self.is_sliding2 != 0:#如果是在滑动中则不需要点击事件 + self.is_sliding2 = 0 menustyle_select.set_pos(int(190),int(165)) # menustyle_img1.set_src("E:/static/theme_four1.png") # menustyle_img2.set_src("E:/static/theme_single2.png") EventMesh.publish("set_mainmenu",[2]) EventMesh.publish("load_screen", {"screen": "main_menu"}) - self.is_sliding = 0 - - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + self.is_sliding2 = 0 def done_return(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("load_screen", {"screen": "setting"}) def btn1_release(self): - EventMesh.publish("load_screen", {"screen": "main_menu"}) + EventMesh.publish("load_screen", {"screen": "setting"}) + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) + + + # -------------------------------------------imei screen---------------------------------------------------------- imei_screen = lv.obj() print("imei_screen") @@ -1543,7 +1565,7 @@ class ImeiScreen(Screen): self.meta = imei_screen def initialization(self): - + print("rrrrrrr1") imei = EventMesh.publish(constants.EVENT.GET_IMEI) imei_qr_data = str(imei) imei_qr.update(imei_qr_data,len(imei_qr_data)) @@ -1556,7 +1578,7 @@ class ImeiScreen(Screen): EventMesh.publish("load_screen", {"screen": "setting"}) def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + EventMesh.publish("return_prev_screen") def btn8_press(self): EventMesh.publish("watch_top_show") @@ -1573,15 +1595,17 @@ class AppScreen(Screen): imei = EventMesh.publish(constants.EVENT.GET_IMEI) app_label.set_text(imei) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) def btn1_release(self): EventMesh.publish("load_screen", {"screen": "setting"}) - + + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -1772,8 +1796,7 @@ class BrightnessScreen(Screen): brightness_bar.set_value((100 // 10) * self.level, lv.ANIM.OFF) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + def done_return(self): EventMesh.publish("load_screen", {"screen": "setting"}) @@ -1781,6 +1804,9 @@ class BrightnessScreen(Screen): def btn1_release(self): EventMesh.publish("load_screen", {"screen": "setting"}) + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) @@ -2031,12 +2057,14 @@ class totalvolumeScreen(Screen): self.aud.stop() EventMesh.publish("load_screen", {"screen": "setting"}) - def done_left_to_right(self): - EventMesh.publish("load_screen", {"screen": "setting"}) + def btn1_release(self): EventMesh.publish("load_screen", {"screen": "setting"}) + def done_left_to_right(self): + EventMesh.publish("return_prev_screen") + def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"})