style_font_youyuan_20 = lv.style_t()
style_font_youyuan_20.init()
style_font_youyuan_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_20.set_text_font_v2("font_24.bin",24,0)
+style_font_youyuan_20.set_text_font_v2("font_28.bin",28,0)
style_font_youyuan_40 = lv.style_t()
style_font_youyuan_40.init()
style_font_youyuan_20_black = lv.style_t()
style_font_youyuan_20_black.init()
style_font_youyuan_20_black.set_text_color(lv.color_make(0x00, 0x00, 0x00))
-style_font_youyuan_20_black.set_text_font_v2("font_24.bin",24,0)
+style_font_youyuan_20_black.set_text_font_v2("font_28.bin",28,0)
style_font_youyuan_20_red = lv.style_t()
style_font_youyuan_20_red.init()
style_font_youyuan_20_red.set_text_color(lv.color_make(0xff, 0x00, 0x00))
-style_font_youyuan_20_red.set_text_font_v2("font_24.bin",24,0)
+style_font_youyuan_20_red.set_text_font_v2("font_28.bin",28,0)
style_img = lv.style_t()
style_img.init()
EventMesh.publish("load_screen", {"screen": "contacts"})
def call(self,e):
- self.name = None
- self.phonebook = {}
- self.number_tmp = {}
- if len(self.phone_list) != 0:
- data = EventMesh.publish("get_phonebook_list")
- if data != None:
- check = data[0]
- self.phonebook = data[1]
- # print("check :{}".format(check))
- if check == 1:#检查通讯录
- phonebook_keys = sorted(self.phonebook.keys())
- b = str(self.phone_num) in self.phonebook.values()#查找key中是否包含content电话号码 True 包含在里面 False不包含在里面
- j = 0
- if b == True:
- for i in range(len(self.phonebook)): #字典 key value
- #'001:张三':15521469561
- name = self.phonebook[phonebook_keys[j]]
- name_value = phonebook_keys[j]
- number_tmp = str(self.phone_num)
- # print("name :{} number_tmp:{}".format(name,number_tmp))
- if name.find(number_tmp) != -1:#查找电话号码是否在通讯录里面
- number_f= name_value
- name_s = number_f.split(':')
- name_s = name_s[1]
- self.name = name_s
- break
- j+=1
+ if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:
+ self.name = None
+ self.phonebook = {}
+ self.number_tmp = {}
+ if len(self.phone_list) != 0:
+ data = EventMesh.publish("get_phonebook_list")
+ if data != None:
+ check = data[0]
+ self.phonebook = data[1]
+ # print("check :{}".format(check))
+ if check == 1:#检查通讯录
+ phonebook_keys = sorted(self.phonebook.keys())
+ b = str(self.phone_num) in self.phonebook.values()#查找key中是否包含content电话号码 True 包含在里面 False不包含在里面
+ j = 0
+ if b == True:
+ for i in range(len(self.phonebook)): #字典 key value
+ #'001:张三':15521469561
+ name = self.phonebook[phonebook_keys[j]]
+ name_value = phonebook_keys[j]
+ number_tmp = str(self.phone_num)
+ # print("name :{} number_tmp:{}".format(name,number_tmp))
+ if name.find(number_tmp) != -1:#查找电话号码是否在通讯录里面
+ number_f= name_value
+ name_s = number_f.split(':')
+ name_s = name_s[1]
+ self.name = name_s
+ break
+ j+=1
+ else:
+ self.name = self.phone_num
else:
self.name = self.phone_num
- else:
- self.name = self.phone_num
- EventMesh.publish("save_phonenum",self.phone_num)
- EventMesh.publish("save_phonename",self.name)#
- voiceCall.callStart(self.phone_num)
-
+ EventMesh.publish("save_phonenum",self.phone_num)
+ EventMesh.publish("save_phonename",self.name)#
+ EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
+ else:
+ EventMesh.publish("load_screen", {"screen": "no_valied_num_screen"})
+ else:#未插卡
+ EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
+
+
def show_num(self):
#print("self.phone_num ",self.phone_num,self.phone_list)
len_t = len(self.phone_list)*40
self.call_log_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
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_flag(lv.obj.FLAG.HIDDEN)
phonnum = str(e.get_target().get_child(0).get_text())
phnoname = e.get_target().get_child(3).get_text()
# print("phonnum :{} _msg:{}".format(phonnum,phnoname))
- EventMesh.publish("save_phonenum",phonnum)#保存电话号码用于界面显示获取
+
self.name = None
self.phonebook = {}
if self.name == None:
self.name = phnoname
- if len(self.name) > 0:
+ if len(phonnum) > 0:
EventMesh.publish("save_phonename",self.name)#
- voiceCall.callStart(str(phonnum))
+ EventMesh.publish("save_phonenum",phonnum)#保存电话号码用于界面显示获取
+ #voiceCall.callStart(str(phonnum))
+ EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
+ else:
+ EventMesh.publish("load_screen", {"screen": "no_valied_num_screen"})
+
def done_return(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
dialing_screen = None
dialing_img = None
dialing_name = None
+dialing_call_label = None
hangup_imgbtn = None
class DialingScreen(Screen):
NAME = "dialing"
dialing_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
dialing_img = lv.img(dialing_screen)
- dialing_img.set_pos(80, 60)
+ dialing_img.set_pos(80, 20)
dialing_img.set_size(64, 64)
dialing_img.set_src("E:/static/IMAGE_NOTICE_CALL.png")
dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
dialing_name = lv.label(dialing_screen)
- dialing_name.set_pos(0, 160)
+ dialing_name.set_pos(0, 120)
dialing_name.set_size(240, 50)
+ dialing_name.set_text(" ")
dialing_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
dialing_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ dialing_call_label = lv.label(dialing_screen)
+ dialing_call_label.set_pos(0, 180)
+ dialing_call_label.set_size(240, 50)
+ dialing_call_label.set_text("正在等待对方接听电话")
+ dialing_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ dialing_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
hangup_imgbtn = lv.img(dialing_screen)
hangup_imgbtn.set_size(64, 64)
- hangup_imgbtn.set_src("E:/static/IMG_CC_HUNGUP1.png")
+ hangup_imgbtn.set_src("E:/static/hang_up.png")
hangup_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
- hangup_imgbtn.set_pos(80, 220)
+ hangup_imgbtn.set_pos(80, 250)
hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)),
lv.EVENT.CLICKED, None)
self.meta = dialing_screen
-
+ if dialing_name != None:
+ name = EventMesh.publish("get_phonename")#获取拨打电话名称
+ dialing_name.set_text(name)#名称
+ def post_processor_after_initialization(self):
+ # print("创建通话记录 post_processor_before_initialization\n")
+ utime.sleep_ms(200)#不加延时会切屏
#获取字符串
name = EventMesh.publish("get_phonename")#获取拨打电话名称
content = EventMesh.publish("get_phonenum")#获取电话号码
# ["15692025051","2","12:59","哥gdh符合双方和开发商开发好看的思考"],
# 格式:{"电话号码":{"timesec":'时间戳',"number":'电话号码',"name":'名字',"time":'时间',"count":'通话次数'}}
-
- dialing_name.set_text(name)#名称
# dialing_content.set_text(content)#电话号码
num = 0
self.read_call_log[content] = tmp
with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_call_log,fd)
- print("创建通话记录")
+ print("创建通话记录")
EventMesh.publish("set_call_log_list", [1,self.read_call_log])
EventMesh.publish("call_log_update_show_list")
EventMesh.publish(constants.EVENT.SYSTEM_UP)
+
+no_sim_popup_screen = None
+no_sim_popup_screen_title1 = None
+no_sim_popup_screen_title2 = None
+#未插卡
+class NoSimScreen(Screen):#
+ NAME = "no_sim_popup_screen"
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+
+ def initialization(self):
+ global no_sim_popup_screen,no_sim_popup_screen_title1,no_sim_popup_screen_title2
+ if no_sim_popup_screen == None :
+ no_sim_popup_screen = lv.obj()
+ print("no_sim_popup_screen")
+ no_sim_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ no_sim_popup_screen_title1 = lv.label(no_sim_popup_screen)
+ no_sim_popup_screen_title1.set_pos(0, 140)
+ no_sim_popup_screen_title1.set_size(240, 40)
+ no_sim_popup_screen_title1.set_text("无法连接到网络,请")
+ no_sim_popup_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_sim_popup_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ no_sim_popup_screen_title2 = lv.label(no_sim_popup_screen)
+ no_sim_popup_screen_title2.set_pos(0, 190)
+ no_sim_popup_screen_title2.set_size(240, 40)
+ no_sim_popup_screen_title2.set_text("插卡拨打")
+ no_sim_popup_screen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_sim_popup_screen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ self.meta = no_sim_popup_screen
+
+ def done_left_to_right(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_right_to_left(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_bottom_to_top(self):
+ EventMesh.publish("return_prev_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("return_prev_screen")
+
+ def btn1_release(self):
+ EventMesh.publish("return_prev_screen")
+
+ def btn8_press(self):
+ EventMesh.publish("return_prev_screen")
+
+
+no_valied_num_screen = None
+no_valied_num_screen_title1 = None
+no_valied_num_screen_title2 = None
+#=无效的号码 请重新输入
+class NovaliedNumScreen(Screen):#
+ NAME = "no_valied_num_screen"
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+ self.timer_count = 0
+ self.timer=osTimer()
+
+ def initialization(self):
+ global no_valied_num_screen,no_valied_num_screen_title1,no_valied_num_screen_title2
+ if no_valied_num_screen == None :
+ no_valied_num_screen = lv.obj()
+ print("no_valied_num_screen")
+ no_valied_num_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ no_valied_num_screen_title1 = lv.label(no_valied_num_screen)
+ no_valied_num_screen_title1.set_pos(0, 140)
+ no_valied_num_screen_title1.set_size(240, 40)
+ no_valied_num_screen_title1.set_text("无效的号码,")
+ no_valied_num_screen_title1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_valied_num_screen_title1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+ no_valied_num_screen_title2 = lv.label(no_valied_num_screen)
+ no_valied_num_screen_title2.set_pos(0, 190)
+ no_valied_num_screen_title2.set_size(240, 40)
+ no_valied_num_screen_title2.set_text("请重新输入")
+ no_valied_num_screen_title2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_valied_num_screen_title2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ self.meta = no_valied_num_screen
+ def post_processor_after_initialization(self):
+ self.timer_count = 0
+ self.timer.start(5000,1,self.timeout_exit)
+
+ def timeout_exit(self,e):
+ self.timer_count+=1
+ if self.timer_count >= 2:
+ self.timer_count = 0
+ EventMesh.publish("return_prev_screen")
+
+ def Close(self):
+ self.timer.stop()
+
+ def done_left_to_right(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_right_to_left(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_bottom_to_top(self):
+ EventMesh.publish("return_prev_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("return_prev_screen")
+
+ def btn1_release(self):
+ EventMesh.publish("return_prev_screen")
+
+ def btn8_press(self):
+ EventMesh.publish("return_prev_screen")
+
+
+
+no_sim_power_screen = None
+no_sim_power_screen_title = None
+no_sim_power_screen_label =None
+no_sim_power_screen_comfirm =None
+no_sim_power_screen_cancel = None
+
+
+#未插卡,长按关机
+class NoSimPowerScreen(Screen):#
+ NAME = "no_sim_power_screen"
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+
+ def initialization(self):
+ global no_sim_power_screen,no_sim_power_screen_title,no_sim_power_screen_comfirm,no_sim_power_screen_cancel,no_sim_power_screen_label
+ if no_sim_power_screen == None :
+ no_sim_power_screen = lv.obj()
+ print("no_sim_power_screen")
+ no_sim_power_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ no_sim_power_screen_title = lv.label(no_sim_power_screen)
+ no_sim_power_screen_title.set_pos(0, 60)
+ no_sim_power_screen_title.set_size(240, 80)
+ no_sim_power_screen_title.set_text("未插卡,无法拨打")
+ no_sim_power_screen_title.set_long_mode(lv.label.LONG.WRAP)
+ no_sim_power_screen_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_sim_power_screen_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ no_sim_power_screen_label = lv.label(no_sim_power_screen)
+ no_sim_power_screen_label.set_pos(0, 150)
+ no_sim_power_screen_label.set_size(240, 40)
+ no_sim_power_screen_label.set_text("是否关机?")
+ no_sim_power_screen_label.set_long_mode(lv.label.LONG.WRAP)
+ no_sim_power_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_sim_power_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+ no_sim_power_screen_comfirm = lv.label(no_sim_power_screen)
+ no_sim_power_screen_comfirm.set_pos(0, 200)
+ no_sim_power_screen_comfirm.set_size(120, 80)
+ no_sim_power_screen_comfirm.set_text("是")
+ no_sim_power_screen_comfirm.set_long_mode(lv.label.LONG.WRAP)
+ no_sim_power_screen_comfirm.add_flag(lv.obj.FLAG.CLICKABLE)
+ no_sim_power_screen_comfirm.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_sim_power_screen_comfirm.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+ no_sim_power_screen_cancel = lv.label(no_sim_power_screen)
+ no_sim_power_screen_cancel.set_pos(120, 200)
+ no_sim_power_screen_cancel.set_size(120, 80)
+ no_sim_power_screen_cancel.set_text("否")
+ no_sim_power_screen_cancel.add_flag(lv.obj.FLAG.CLICKABLE)
+ no_sim_power_screen_cancel.set_long_mode(lv.label.LONG.WRAP)
+ no_sim_power_screen_cancel.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ no_sim_power_screen_cancel.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ 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)
+
+ no_sim_power_screen_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.cancel(e)),
+ lv.EVENT.CLICKED, None)
+
+ def confirm(self,e):
+ EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"})
+
+ def cancel(self,e):
+ EventMesh.publish("return_prev_screen")
+
+ def done_left_to_right(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_right_to_left(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_bottom_to_top(self):
+ EventMesh.publish("return_prev_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):
+ pass
+ #EventMesh.publish("return_prev_screen")
+
+ def btn1_release(self):
+ #EventMesh.publish("return_prev_screen")
+ pass
+
+ def btn8_press(self):
+ EventMesh.publish("return_prev_screen")
+
+dialing_popup_screen = None
+dialing_popup_img = None
+dialing_popup_name = None
+dialing_popup_hangup_imgbtn = None
+class DialingNoPlayPopupScreen(Screen):#正在拨号中...未打出
+ NAME = "dialing_noplay_popup"
+
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+ self.timer1 = osTimer()
+ self.time_count = 0
+ self.timer2 = osTimer()
+
+ def initialization(self):
+ EventMesh.publish("set_UI_high_priority", 1)
+ global dialing_popup_screen,dialing_popup_img,dialing_popup_name ,dialing_popup_call,dialing_popup_hangup_imgbtn
+ if dialing_popup_screen == None:
+ dialing_popup_screen = lv.obj()
+ print("dialing_popup_screen")
+ dialing_popup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ dialing_popup_img = lv.img(dialing_popup_screen)
+ dialing_popup_img.set_pos(80, 20)
+ dialing_popup_img.set_size(64, 64)
+ dialing_popup_img.set_src("E:/static/IMAGE_NOTICE_CALL.png")
+ dialing_popup_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ dialing_popup_name = lv.label(dialing_popup_screen)
+ dialing_popup_name.set_pos(0, 120)
+ dialing_popup_name.set_size(240, 50)
+ dialing_popup_name.set_text(" ")
+ dialing_popup_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ dialing_popup_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ dialing_popup_call = lv.label(dialing_popup_screen)
+ dialing_popup_call.set_pos(0, 180)
+ dialing_popup_call.set_size(240, 50)
+ dialing_popup_call.set_text("正在拨号中")
+ dialing_popup_call.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ dialing_popup_call.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ dialing_popup_hangup_imgbtn = lv.img(dialing_popup_screen)
+ dialing_popup_hangup_imgbtn.set_size(64, 64)
+ dialing_popup_hangup_imgbtn.set_src("E:/static/hang_up.png")
+ dialing_popup_hangup_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
+ dialing_popup_hangup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+ dialing_popup_hangup_imgbtn.set_pos(80, 250)
+ dialing_popup_hangup_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)),
+ lv.EVENT.CLICKED, None)
+ self.meta = dialing_popup_screen
+ if dialing_popup_name != None:
+ name = EventMesh.publish("get_phonename")#获取拨打电话名称
+ dialing_popup_name.set_text(name)#名称
+
+ def post_processor_after_initialization(self):
+ self.time_count = 0
+
+ self.timer1.start(1000, 1, self.timeout_hangup)
+ self.timer2.start(2000, 0, self.timeout_call)
+
+ def timeout_call(self,e):
+ phone_num = EventMesh.publish("get_phonenum")
+ voiceCall.callStart(phone_num)
+
+ def timeout_hangup(self,e):
+ EventMesh.publish("system_sleep_rest")#防止黑屏
+ self.time_count+=1
+ if self.time_count >= 10:
+ self.time_count = 0
+ EventMesh.publish("set_UI_high_priority", 0)
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+
+ def hangup(self,e):
+ EventMesh.publish("set_UI_high_priority", 0)
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+ voiceCall.callEnd()
+
+ def Close(self):
+ self.timer1.stop()
+ self.timer2.stop()
+
+ def done_return(self):
+ pass
+ #EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def btn1_release(self):
+ pass
+ #EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ def btn8_press(self):
+ flag = EventMesh.publish("get_lcd_state")
+ if flag == 1:
+ EventMesh.publish(constants.EVENT.SYSTEM_SLEEP)
+ else:
+ EventMesh.publish(constants.EVENT.SYSTEM_UP)
+
+
message_popup_screen = None
message_popup_title = None
#信息弹窗
self.meta = incoming_call_screen
EventMesh.publish("set_UI_high_priority", 1)
+
def post_processor_after_initialization(self):
global incoming_call_screen,incoming_call_img,incoming_call_name_label,incoming_call_answer ,incoming_call_hangup
utime.sleep_ms(200)#不加延时会切屏
step_label = lv.label(step_screen)
step_label.set_pos(10, 30)
- step_label.set_size(100, 50)
+ step_label.set_size(230, 50)
step_label.set_text("今日步数")
step_label.set_long_mode(lv.label.LONG.WRAP)
- step_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ step_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
step_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
step_label_01 = lv.label(step_screen)
self.contact_detail_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
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_flag(lv.obj.FLAG.HIDDEN)
+
contact_btn_label_1 = lv.label(contact_btn)
contact_btn_label_2 = lv.label(contact_btn)
contact_btn_label_3 = lv.label(contact_btn)
def calling_cb(self,e):
code = e.get_code()
if code == lv.EVENT.CLICKED:
- msg_text = e.get_target().get_child(1).get_text()
- EventMesh.publish("publish_message_event_ui",{"func":self.calling,"data":msg_text})
+ 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"})
def calling(self,msg_text):
_msg = msg_text
phone_num = self.phonebook[_msg]
EventMesh.publish("save_phonenum", phone_num)
+
# phone_num_tmp = int(phone_num)
- voiceCall.callStart(phone_num)
+
+ "dialing_noplay_popup"
+ EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
+
def done_return(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
temperature_body_label = lv.label(temperature_screen)
temperature_body_label.set_pos(80, 40)
- temperature_body_label.set_size(100, 20)
+ temperature_body_label.set_size(160, 20)
temperature_body_label.set_text("当前腕温")
temperature_body_label.set_long_mode(lv.label.LONG.WRAP)
- temperature_body_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ temperature_body_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
temperature_body_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
temperature_degree_img = lv.img(temperature_screen)
def system_init_timer_cb(self, *args):
EventMesh.publish("system_sleep_rest")#防止黑屏
self.system_init_timer_count += 1
+ if self.system_init_timer_count > 4:
+ self.system_init_timer_count = 1
if system_init_screen != None:
- system_init_label_str = "系统初始化中"
- for i in range(self.system_init_timer_count%5):
- system_init_label_str += "."
- system_init_label.set_text("{:<23}".format(system_init_label_str))
+ system_init_label_str = "系统初始化中"
+ if self.system_init_timer_count == 1:
+ system_init_label.set_text("系统初始化中.")
+ elif self.system_init_timer_count == 2:
+ system_init_label.set_text("系统初始化中..")
+ elif self.system_init_timer_count == 3:
+ system_init_label.set_text("系统初始化中...")
+ else:
+ system_init_label.set_text("系统初始化中....")
def Close(self):
self.system_init_timer.stop()
self.system_sleep_timeout_rest()
def ui_press(self, event, key):
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME == "system_init":
+ return
self.system_sleep_timeout_rest()
#print("ui press {}".format(event))
if event == "done_left_to_right":
# if event == "done_press":
# self.system_sleep_timeout_rest()
def btn_press(self, event, key):
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME == "system_init":
+ return
print("btn_press: {}".format(event))
#主表盘按电源键,息屏
else:
EventMesh.publish("load_screen", {"screen": "NO_SOS_POPUP"})
else:
- EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"})
+ EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"})
else:
self.__lcd_on()
return
else:
EventMesh.publish("load_screen", {"screen": "NO_SOS_POPUP"})
else:
- EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"})
+ EventMesh.publish("load_screen", {"screen": "no_sim_power_screen"})
if event == "btn1_press":
self.screen.btn1_release()
def btn_release(self, event, msg):
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME == "system_init":
+ return
print("btn_release: {}".format(event))
# if self.main_flag != 1 and self.sleep_flag == 0:
# self.__lcd_on()