K5还原
authordxy15521469561 <1731678236@qq.com>
Thu, 18 Jan 2024 12:02:30 +0000 (20:02 +0800)
committerdxy15521469561 <1731678236@qq.com>
Thu, 18 Jan 2024 12:02:30 +0000 (20:02 +0800)
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_main_menu.py
2.sdk/project/K5/sdk/services/microPython/ports/quectel/core/ui_setting.py

index 096fd4a..b4eeb35 100644 (file)
@@ -6848,7 +6848,7 @@ class UI(object):
         #     self.system_sleep_timeout_rest()
     def btn_press(self, event, key):
         screen_NAME = EventMesh.publish("get_screen_NAME")
-        if screen_NAME == "system_init":
+        if screen_NAME == "system_init" or screen_NAME == "poweron":
             return
         print("btn_press: {} self.main_flag:{} self.sleep_flag:{}".format(event,self.main_flag,self.sleep_flag))
         #主表盘按电源键,息屏
@@ -6898,7 +6898,7 @@ class UI(object):
 
     def btn_release(self, event, msg):
         screen_NAME = EventMesh.publish("get_screen_NAME")
-        if screen_NAME == "system_init":
+        if screen_NAME == "system_init" or screen_NAME == "poweron":
             return
         print("btn_release: {}".format(event))
         # if self.main_flag != 1 and self.sleep_flag == 0:
index 2d5f3c4..24c7e91 100644 (file)
@@ -272,38 +272,38 @@ MainMenu2x+=1
 #MainMenu2_num+=1
 #MainMenu2x+=1
 
-#sos
-MainMenu2_setting = MainMenu2_til.add_tile(MainMenu2x, 0,  lv.DIR.LEFT | lv.DIR.RIGHT)
-#MainMenu2_setting.set_tile_act(0,0,lv.ANIM.ON)
-label_text = lv.label(MainMenu2_setting)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("{}".format(MainMenu2_num))
-MainMenu2_img_sos = lv.img(MainMenu2_setting)
-MainMenu2_img_sos.set_size(160,160)
-MainMenu2_img_sos.set_pos(40,20)
-MainMenu2_img_sos.set_src("U:/static/IMAGE_ONE_PAGE_SOS.png")
-MainMenu2_img_sos.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_sos.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_sos_txt = lv.label(MainMenu2_setting)
-MainMenu2_img_sos_txt.set_pos(int(0),int(210))
-MainMenu2_img_sos_txt.set_size(240,100)
-MainMenu2_img_sos_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_sos_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_sos_txt.set_text("SOS")
-MainMenu2_img_sos_txt.add_style(style_font_youyuan_40, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-MainMenu2_img_sos_txt1 = lv.label(MainMenu2_setting)
-MainMenu2_img_sos_txt1.set_pos(int(0),int(260))
-MainMenu2_img_sos_txt1.set_size(240,60)
-MainMenu2_img_sos_txt1.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_sos_txt1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_sos_txt1.set_text("或长按【SOS键】3秒快速呼叫")
-MainMenu2_img_sos_txt1.add_style(style_font_youyuan_20_gray, lv.PART.MAIN|lv.STATE.DEFAULT)
+# #sos
+# MainMenu2_setting = MainMenu2_til.add_tile(MainMenu2x, 0,  lv.DIR.LEFT | lv.DIR.RIGHT)
+# #MainMenu2_setting.set_tile_act(0,0,lv.ANIM.ON)
+# label_text = lv.label(MainMenu2_setting)
+# label_text.set_pos(0, 240)
+# label_text.set_size(0, 0)
+# label_text.set_text("{}".format(MainMenu2_num))
+# MainMenu2_img_sos = lv.img(MainMenu2_setting)
+# MainMenu2_img_sos.set_size(160,160)
+# MainMenu2_img_sos.set_pos(40,20)
+# MainMenu2_img_sos.set_src("U:/static/IMAGE_ONE_PAGE_SOS.png")
+# MainMenu2_img_sos.add_flag(lv.obj.FLAG.CLICKABLE)
+# MainMenu2_img_sos.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+# MainMenu2_img_sos_txt = lv.label(MainMenu2_setting)
+# MainMenu2_img_sos_txt.set_pos(int(0),int(210))
+# MainMenu2_img_sos_txt.set_size(240,100)
+# MainMenu2_img_sos_txt.add_flag(lv.obj.FLAG.CLICKABLE)
+# MainMenu2_img_sos_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+# MainMenu2_img_sos_txt.set_text("SOS")
+# MainMenu2_img_sos_txt.add_style(style_font_youyuan_40, lv.PART.MAIN|lv.STATE.DEFAULT)
+
+# MainMenu2_img_sos_txt1 = lv.label(MainMenu2_setting)
+# MainMenu2_img_sos_txt1.set_pos(int(0),int(260))
+# MainMenu2_img_sos_txt1.set_size(240,60)
+# MainMenu2_img_sos_txt1.add_flag(lv.obj.FLAG.CLICKABLE)
+# MainMenu2_img_sos_txt1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+# MainMenu2_img_sos_txt1.set_text("或长按【SOS键】3秒快速呼叫")
+# MainMenu2_img_sos_txt1.add_style(style_font_youyuan_20_gray, lv.PART.MAIN|lv.STATE.DEFAULT)
 
-MainMenu2_num+=1
-MainMenu2x+=1
+# MainMenu2_num+=1
+# MainMenu2x+=1
 
 #工具箱
 MainMenu2_toolbox = MainMenu2_til.add_tile(MainMenu2x, 0,  lv.DIR.LEFT | lv.DIR.RIGHT)
@@ -368,21 +368,34 @@ class MainMenuScreen(Screen):
         self.menu_id = "0"
         self.menu_new_id = "255"
         self.menu_old_id = "255"
+        self.is_sliding = 0
         self.scroll_begin_event_count = 0
         self.menu_action = 0 # =1左滑  =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_sos.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "sos")), 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_sos.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.CLICKED, None)
-        #MainMenu2_img_alipay.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "alipay_open")), 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_sos.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "sos")), 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_sos.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.SHORT_CLICKED, None)
+        #MainMenu2_img_alipay.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "alipay_open")), 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)
+        MainMenu2_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.PRESSING, None)
+        MainMenu2_img_health.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "health")), lv.EVENT.PRESSING, None)
+        MainMenu2_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e,  "contacts")), lv.EVENT.PRESSING, None)
+        MainMenu2_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.PRESSING, None)
+        # MainMenu2_img_sos.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "sos")), lv.EVENT.PRESSING, None)
+        MainMenu2_img_sms.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.PRESSING, None)
+        # MainMenu2_img_sos.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "popup")), lv.EVENT.PRESSING, None)
+        #MainMenu2_img_alipay.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "alipay_open")), lv.EVENT.PRESSING, None)
         
         EventMesh.subscribe("watch_top_show", self.watch_top_show)
         EventMesh.subscribe("return_alipay", self.return_alipay)
@@ -390,6 +403,7 @@ class MainMenuScreen(Screen):
         #MainMenu2_img_alipay.add_event_cb(lambda e: img_cb(e, "Watchface_set"), lv.EVENT.CLICKED, None)
         
     def initialization(self):
+        self.is_sliding=0
         self.watchface.initialization(MainMenu2_Watchface)
         
         if self.menu_id =="0":
@@ -431,22 +445,35 @@ class MainMenuScreen(Screen):
         MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)  
         
     def img_cb(self, e, msg):
-        print("MainMenu2:img_cb:{}".format(msg))
-        if msg == "sos":
-            if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机
-                sos_number = EventMesh.publish("get_dial_sos_number")
-                if sos_number != None:
-                    if len(sos_number) != 0:
-                        screen_NAME = EventMesh.publish("get_screen_NAME")
-                        if screen_NAME != None:
-                            if screen_NAME != "SOS_POPUP":
-                                EventMesh.publish("load_screen", {"screen": "SOS_POPUP"})
+        code = e.get_code()
+
+        #print("code!!!!!!!!",code,msg)
+        if code == lv.EVENT.PRESSING:
+            #print("PRESSING")
+            self.is_sliding += 1
+
+        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:#如果是在滑动中则不需要点击事件
+                self.is_sliding =0
+                print("MainMenu2:img_cb:{}".format(msg))
+                if msg == "sos":
+                    if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机
+                        sos_number = EventMesh.publish("get_dial_sos_number")
+                        if sos_number != None:
+                            if len(sos_number) != 0:
+                                screen_NAME = EventMesh.publish("get_screen_NAME")
+                                if screen_NAME != None:
+                                    if screen_NAME != "SOS_POPUP":
+                                        EventMesh.publish("load_screen", {"screen": "SOS_POPUP"})
+                            else:
+                                EventMesh.publish("load_screen", {"screen": "NO_SOS_POPUP"})
                     else:
-                        EventMesh.publish("load_screen", {"screen": "NO_SOS_POPUP"})
-            else:
-                EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"})
-            return
-        EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+                        EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"})
+                    return
+                EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
+            self.is_sliding =0
         
     def lcd_on(self):
         self.watchface.watchface_style.timerout_update()
index 483d948..b39d460 100644 (file)
@@ -788,9 +788,9 @@ poweroff_label.set_pos(0,120)
 poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 poweroff_confirm_img = lv.img(poweroff_screen)
-poweroff_confirm_img.set_size(30, 30)
+poweroff_confirm_img.set_size(176, 46)
 poweroff_confirm_img.set_pos(32, 160)
-poweroff_confirm_img.set_src("E:/static/app/wechat/R_3.png")
+poweroff_confirm_img.set_src("E:/static/off_icon.png")
 poweroff_confirm_img.add_flag(lv.obj.FLAG.CLICKABLE)
 poweroff_confirm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
 
@@ -800,9 +800,9 @@ poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 5)
 poweroff_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
 
 poweroff_return = lv.img(poweroff_screen)
-poweroff_return.set_size(30, 30)
+poweroff_return.set_size(176, 46)
 poweroff_return.set_pos(32, 240)
-poweroff_return.set_src("E:/static/app/wechat/S_3.png")
+poweroff_return.set_src("E:/static/cancel_icon.png")
 
 poweroff_return.add_flag(lv.obj.FLAG.CLICKABLE)
 poweroff_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
@@ -875,6 +875,7 @@ class PowerOnScreen(Screen):
         self.count = 0
 
     def initialization(self):
+        EventMesh.publish("set_UI_high_priority",1)
         self.count = 0
         self.aud.setVolume(11)
         self.timer.start(1000,1,self.fun)
@@ -890,11 +891,13 @@ class PowerOnScreen(Screen):
                 if self.count >= 9:#在上一个界面在播放音频时切换界面则关闭 以免一直播放
                     self.count = 0
                     self.timer.stop()
+                    EventMesh.publish("set_UI_high_priority",0)
                     EventMesh.publish("load_screen", {"screen": "main_menu"})
                     return
         self.count+=1
 
     def Close(self):
+        EventMesh.publish("set_UI_high_priority",0)
         self.timer.stop()
         self.aud.setVolume(self.volum_size)
         pass