W9:优化界面
authordxy15521469561 <1731678236@qq.com>
Tue, 16 Jul 2024 09:46:06 +0000 (17:46 +0800)
committerdxy15521469561 <1731678236@qq.com>
Tue, 16 Jul 2024 09:46:06 +0000 (17:46 +0800)
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/alarm.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/appWechat.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/mgr.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui_video.py

index d63eae9..96e70bb 100644 (file)
@@ -427,9 +427,12 @@ class ClockManager(Abstract):
         self.days = 0
         self.idx = 0
         self.rtc.enable_alarm(1)
+        size_data = 0
         IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") 
-        self.check_alarm_list = []     
         if IFEXIST == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/alarm_msg.json") 
+        self.check_alarm_list = []     
+        if IFEXIST == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
                     self.check_alarm_list = ujson.load(fd)
@@ -470,9 +473,12 @@ class ClockManager(Abstract):
 
     def read_alarminjson(self, event, msg):
         IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json") 
+        size_data = 0
+        if IFEXIST == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/alarm_msg.json") 
         global alarm_list     
         print("IFEXIST:{}".format(IFEXIST))
-        if IFEXIST == True:
+        if IFEXIST == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
                     alarm_list = ujson.load(fd)
index 432936f..e5e898b 100644 (file)
@@ -100,8 +100,11 @@ class WechatScreen(Screen):
         self.wechat_num = 0
         self.volum_size = 8 
         self.msg_tmp = ""
+        size_data = 0
         check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json")
-        if check_txt == True :
+        if check_txt == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/wechat_record.json")
+        if check_txt == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/wechat_record.json","r") as fd:#音频文件编号
                     self.wechat_recode_list = ujson.load(fd)
index b39ff74..91568ef 100644 (file)
@@ -2683,9 +2683,11 @@ class AddrBookManager(Abstract):
     def __init__(self):
         self.read_phonebook = {}
         self.check_json = 0
+        size_data = 0
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json")
-
         if self.check_json == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/phonebook.json")
+        if self.check_json == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
                     self.read_phonebook = ujson.load(fd)
@@ -2763,8 +2765,10 @@ class CallLogManager(Abstract):
     def __init__(self):
         self.read_call_log = {}
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json")
-
         if self.check_json == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/Call_log.json")
+
+        if self.check_json == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
                     self.read_call_log = ujson.load(fd)
@@ -2842,13 +2846,21 @@ class gethistoryDataManager(Abstract):
 
 
         check_hr= ql_fs.path_exists("/usr/static/storage_file/history_hr.json")
+        size_data = 0
         if check_hr == True :
-            with open("/usr/static/storage_file/history_hr.json","r") as fd:#音频文件编号
-                self.read_histroy_hr_data = ujson.load(fd)
-                if self.read_histroy_hr_data == None:
-                    self.read_histroy_hr_data = []
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/history_hr.json")
+        if check_hr == True and size_data != 0:
+            try:
+                with open("/usr/static/storage_file/history_hr.json","r") as fd:#音频文件编号
+                    self.read_histroy_hr_data = ujson.load(fd)
+                    if self.read_histroy_hr_data == None:
+                        self.read_histroy_hr_data = []
+            except Exception as e:
+                usys.print_exception(e)
         check_temp= ql_fs.path_exists("/usr/static/storage_file/history_temp.json")
         if check_temp == True :
+            check_temp_data = ql_fs.path_getsize("/usr/static/storage_file/history_temp.json")
+        if check_temp == True and check_temp_data != 0:
             try:
                 with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号
                     self.read_histroy_temp_data = ujson.load(fd)
@@ -2858,6 +2870,8 @@ class gethistoryDataManager(Abstract):
                 usys.print_exception(e)
         check_spo2= ql_fs.path_exists("/usr/static/storage_file/history_spo2.json")
         if check_spo2 == True :
+            check_spo2_data = ql_fs.path_getsize("/usr/static/storage_file/history_spo2.json")
+        if check_spo2 == True and check_spo2_data != 0:
             try:
                 with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
                     self.read_histroy_spo2_data = ujson.load(fd)
@@ -2868,6 +2882,8 @@ class gethistoryDataManager(Abstract):
         
         check_blood= ql_fs.path_exists("/usr/static/storage_file/history_blood.json")
         if check_blood == True :
+            check_blood_data = ql_fs.path_getsize("/usr/static/storage_file/history_blood.json")
+        if check_blood == True and check_blood_data != 0:
             try:
                 with open("/usr/static/storage_file/history_blood.json","r") as fd:#音频文件编号
                     self.read_histroy_blood_data = ujson.load(fd)
@@ -3292,7 +3308,10 @@ class getStorageDataManager(Abstract):#获取内存数据
     def __init__(self):
         self.config_data = {}
         check = ql_fs.path_exists("/usr/static/storage_file/config.json")
+        size_data = 0
         if check == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/config.json")
+        if check == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/config.json","r") as fd:
                     self.config_data = ujson.load(fd)
@@ -3816,9 +3835,11 @@ class setclassTimeManager(Abstract):#设置上课禁用时间
     def __init__(self):
         self.class_buf = {}
         self.class_state = 0
+        size_data = 0
         check_json = ql_fs.path_exists("/usr/static/storage_file/class_msg.json")
-
         if check_json == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/class_msg.json")
+        if check_json == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/class_msg.json","r",encoding="utf-8") as fd:
                     self.class_buf = ujson.load(fd)
index 126ab18..489ef26 100644 (file)
@@ -2087,6 +2087,7 @@ class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出
         return self.phone_page_state
     
     def timeout_hangup(self,e):
+        # print("timeout_hangup\r\n")
         EventMesh.publish("system_sleep_rest")#防止黑屏
         if EventMesh.publish("get_call_state") == 4: #拨通了
             if dialing_popup_call != None:
@@ -3890,6 +3891,8 @@ class OnCallScreen(Screen):
         self.button = 0
         self.mute_btn = 0
         self.is_sliding = 0
+        self.count_sec = 0
+        self.timer.start(1000,1,self.refresh)
         voiceCall.mute(2,0,0)
 
     def show_num(self):
@@ -4128,9 +4131,6 @@ class OnCallScreen(Screen):
 
     def post_processor_after_initialization(self):
         global on_call_screen_tab,on_call_obj
-        self.count_sec = 0
-        self.timer.start(1000,1,self.refresh)
-        
         num = EventMesh.publish("get_volum_size")
         if num == None:
             self.volum_size = 8
@@ -4530,7 +4530,7 @@ class ContactsScreen(Screen):
         self.timer = osTimer()
         self.contact_detail_list = None
         EventMesh.subscribe("contact_updata_list_show", self.btn_create_list)
-        self.MXA_phone_num = 50 #最大显示号码个数
+        self.MXA_phone_num = 10 #最大显示号码个数
         self.contact_detail_listt_dict = []
         self.calling_btn = []
         self.is_sliding = 0
@@ -5757,7 +5757,7 @@ class StopwatchScreen(Screen):
                 self.total_time+=1
             if self.sec_value > 59:
                 self.sec_value = 0
-            if self.total_time > 99*60:
+            if self.total_time >= 99*60:
                 self.total_time = 99*60
                 self.timer.stop()
                 stopwatch_start_img.clear_flag(lv.obj.FLAG.HIDDEN)
@@ -6598,7 +6598,7 @@ class chargeOutScreen(Screen):
 rrestor_confirm_n_screen = None
 rrestor_confirm_n_screen_label = None
 
-#正在充电
+#
 class restore_confirmScreen(Screen):
     NAME = "restore_confirm"
     def __init__(self):
@@ -7148,7 +7148,6 @@ class UI(object):
         self.system_sleep_timeout_rest()
         # print("ui press {} self.screen_old:{}".format(self.screen_prev,self.screen_old))
         # print("ui_press_do")
-
         if self.system_ui_state == 0:
             if event == "done_left_to_right":
                 self.screen.done_left_to_right()
@@ -7158,14 +7157,14 @@ class UI(object):
                 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":
-            self.screen.done_click()
-        if event == "done_DOWN":
-            self.screen.done_DOWN()
-        if event == "done_UP":
-            self.screen.done_UP()
+            if event == "done_return":
+                self.screen.done_return()
+            if event == "done_click":
+                self.screen.done_click()
+            if event == "done_DOWN":
+                self.screen.done_DOWN()
+            if event == "done_UP":
+                self.screen.done_UP()
         # if event == "done_press":
         #     self.system_sleep_timeout_rest()
 
index 07d8d0f..feb0ae6 100644 (file)
@@ -442,6 +442,7 @@ class cameraalbumScreen(Screen):#相册
 
                     EventMesh.publish("load_screen", {"screen": "delete_album"})
                     return
+                EventMesh.publish("load_screen", {"screen": "main_menu"})
             elif i == 2:
                 EventMesh.publish("load_screen", {"screen": "main_menu"})
         pass
@@ -2302,9 +2303,11 @@ class videoBookManager(Abstract):
     def __init__(self):
         self.videobook = {}
         self.check_json = 0
+        size_data = 0
         self.check_json = ql_fs.path_exists("/usr/static/storage_file/videobook.json")
-
         if self.check_json == True:
+            size_data = ql_fs.path_getsize("/usr/static/storage_file/videobook.json")
+        if self.check_json == True and size_data != 0:
             try:
                 with open("/usr/static/storage_file/videobook.json","r",encoding="utf-8") as fd:
                     self.videobook = ujson.load(fd)