$(BUILD)/uping.mpy \
$(BUILD)/ymodem.mpy \
$(BUILD)/alarm.mpy \
- $(BUILD)/appAlipay.mpy \
- $(BUILD)/appFactoryMode.mpy \
$(BUILD)/appWechat.mpy \
$(BUILD)/btn_device_ec800m.mpy \
- $(BUILD)/capacitive_hynitron_cst816d_update.mpy \
- $(BUILD)/code.mpy \
$(BUILD)/common.mpy \
$(BUILD)/constants.mpy \
$(BUILD)/EventMesh.mpy \
- $(BUILD)/initTP.mpy \
- $(BUILD)/lcd.mpy \
$(BUILD)/location.mpy \
$(BUILD)/mgr.mpy \
$(BUILD)/protocol.mpy \
$(BUILD)/ui.mpy \
- $(BUILD)/ui_main_menu.mpy \
- $(BUILD)/ui_setting.mpy \
- $(BUILD)/ui_WatchFaceScreen.mpy \
- $(BUILD)/ui_health.mpy \
$(BUILD)/main_init.mpy \
$(BUILD)/versions.mpy \
no_add_alarm_img = lv.img(clk_list_screen1_1)
no_add_alarm_img.set_pos(65, 0)
no_add_alarm_img.set_size(110, 140)
-no_add_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png")
+no_add_alarm_img.set_src("U:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png")
no_add_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
#暂未添加闹钟
self.days = 0
self.idx = 0
- IFEXIST = ql_fs.path_exists("/ext/static/storage_file/alarm_msg.json")
+ IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json")
self.check_alarm_list = []
if IFEXIST == True:
- with open("/ext/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
self.check_alarm_list = ujson.load(fd)
def post_processor_after_instantiation(self):
alarm_list[idx]["days"] = msg["days"]
alarm_list[idx]["enabled"] = msg["enabled"]
alarm_list[idx]["repeart"] = msg["repeart"]
- with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
ujson.dump(alarm_list,fd)
def read_alarminjson(self, event, msg):
- IFEXIST = ql_fs.path_exists("/ext/static/storage_file/alarm_msg.json")
+ IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json")
global alarm_list
print("IFEXIST:{}".format(IFEXIST))
if IFEXIST == True:
- with open("/ext/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json","r",encoding='utf-8') as fd:
alarm_list = ujson.load(fd)
return alarm_list
# num+=1
print("alarm_list----len- :{}".format(len(alarm_list)))
- with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
ujson.dump(alarm_list,fd)
EventMesh.publish("push_update_alarm_show")
alarm_list[j]["idx"] -= 1
print("delete_here4-----",alarm_list)
- with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
ujson.dump(alarm_list,fd)
print("关闭1:",alarm_list[idx]["days"])
print("关闭2:",alarm_list [idx]["days"])
alarm_list[idx]["enabled"] = False
- with open("/ext/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json", 'w+',encoding='utf-8') as fd:
ujson.dump(alarm_list,fd)
EventMesh.publish("set_rtc_alarm")
#设置下一个闹钟,定时开关机功能
popup_alarm_img = lv.img(popup_alarm_screen)
popup_alarm_img.set_pos(63, 60)
popup_alarm_img.set_size(110, 140)
-popup_alarm_img.set_src("E:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png")
+popup_alarm_img.set_src("U:/static/IMAGE_IDLE_SCREEN_ALARM_ICON_NEW.png")
popup_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
popup_alarm_time = lv.label(popup_alarm_screen)
self.timer.stop()
EventMesh.publish("load_screen", {"screen": "main_menu"})
return
- self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音
+ self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3') #播放声音
def close_timer(self):
self.alarm_count=0
def alarm_draw_btn(self):
global alarm_list
self.clock_list = alarm_list
- IFEXIST = ql_fs.path_exists("/ext/static/storage_file/alarm_msg.json")
+ IFEXIST = ql_fs.path_exists("/usr/static/storage_file/alarm_msg.json")
if IFEXIST == True:
if self.clock_list:
# print("nalarm_list:{}".format(alarm_list))
+++ /dev/null
-import modem
-import sim
-import osTimer
-import ALIPAY
-from common import Lock, Abstract, LogAdapter
-import utime
-import lvgl as lv
-import EventMesh
-from machine import Timer
-import constants
-from misc import Power
-import pm
-from ui import Screen
-from code import code_128_generate_barcode
-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_28.bin",28,0)
-
-style_btn_alipay = lv.style_t()
-style_btn_alipay.init()
-style_btn_alipay.set_radius(20)
-style_btn_alipay.set_bg_opa(lv.OPA.COVER)
-style_btn_alipay.set_bg_color(lv.palette_main(lv.PALETTE.BLUE))
-style_btn_alipay.set_bg_grad_color(lv.palette_darken(lv.PALETTE.BLUE, 2))
-style_btn_alipay.set_bg_grad_dir(lv.GRAD_DIR.VER)
-
-style_cont_alipay = lv.style_t()
-style_cont_alipay.init()
-style_cont_alipay.set_radius(20)
-style_cont_alipay.set_bg_opa(lv.OPA.COVER)
-style_cont_alipay.set_bg_color(lv.color_make(0xff, 0xff, 0xff))
-
-
-class Alipay(Abstract):
- """
- 支付宝
- """
- def __init__(self):
- self.imei = modem.getDevImei()
- if self.imei == None :
- self.imei = "1111"
- self.iccid = sim.getIccid()
- if self.iccid == -1 :
- self.iccid = "1111"
- self.imsi = sim.getImsi()
- if self.imsi == -1:
- self.imsi = "1111"
- self.mac = "123456"
- self.sn = modem.getDevSN()
- self.vendor = "ZHSX"
- self.product_name = "ZHSX"
- self. product_model = modem.getDevModel()
- self.pk_alipay = "voPuTFiLcdA"
- self.pk_aliyun = "a1c7Ojs6HMR"
- self.ps_aliyun = "TxPFIJ5F1kwa0zO3"
- self.product_type = 0
- self.timer_Alipay = osTimer()
- self.Alipay_Ui_isOpen = 0
- self.Alipay_init_flag = 0
- EventMesh.subscribe("alipay_unbind", self.alipay_unbind)
-
- EventMesh.subscribe("alipay_1", self.alipay_1)
- EventMesh.subscribe("get_payment_code", self.get_payment_code)
- EventMesh.subscribe("get_collect_code", self.get_collect_code)
- EventMesh.subscribe("get_parent_code", self.get_parent_code)
- EventMesh.subscribe("get_alipay_init", self.get_alipay_init)
- EventMesh.subscribe("alipay_exit", self.alipay_exit)
- EventMesh.subscribe("id2_clean_data", self.id2_clean_data)
- EventMesh.subscribe("Alipay_init", self.Alipay_init)
- EventMesh.subscribe("get_Alipay_Ui_isOpen",self.get_Alipay_Ui_isOpen)
- EventMesh.subscribe("set_Alipay_Ui_isOpen",self.set_Alipay_Ui_isOpen)
-
- self.is_simcard_identify = 255
- self.is_init = 255
- self.upay_bound = 0 #绑定结果
- self.alipay = ALIPAY(self.imei, self.iccid,self.imsi, self.mac, self.sn,self.vendor, self.product_name, self. product_model, self.pk_alipay , self.pk_aliyun, self.ps_aliyun,0)
- #self.alipay = ALIPAY("867387060319491", "898604293619F0549750","460044917509047", "123456", "P1Q22I80C0007530P","ZHIHUISHIXUN", "ZHIHUISHIXUN", "EC800M", "uHTfYqOlGlA" , "a15PcyZ3IHA", "kOGGPhtXAg1Lz1vg",0)
- #self.alipay.register_print()
- self.alipay.set_log_limit(5)
- #self.alipay.set_log_limit(0)
-
- #self.timer_Alipay.start(20000, 1, self.timeout_Alipay)
- def post_processor_after_instantiation(self):
- print("post_processor_after_instantiation")
- EventMesh.publish_async("Alipay_init","",40*1024)
-
-
- def get_Alipay_Ui_isOpen(self, event, msg):
- return self.Alipay_Ui_isOpen
- def set_Alipay_Ui_isOpen(self, event, msg):
- self.Alipay_Ui_isOpen = msg
- def Alipay_init(self, event, msg):
- if self.Alipay_init_flag == 1:
- print("Alipay_init:reuse!!!!!!!!")
- #self.Alipay_init_flag = 0
- return
- self.Alipay_init_flag = 1
- #print("timeout_Alipay1:{}".format(EventMesh.publish(constants.EVENT.GET_CONNECT)))
- #time = utime.localtime()
-
- if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and self.alipay != None and (self.is_simcard_identify != 0 ):#or time[3] == 0 or time[3] == 12):
- #if self.alipay != None and (self.is_simcard_identify != 0 or time[3] == 0 or time[3] == 12):
- self.is_simcard_identify = self.alipay.start_simcard_identify()
- print("is_simcard_identify:%d"%self.is_simcard_identify)
-
- #if self.is_simcard_identify == 0 and EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and self.is_init != 0:
- if self.is_init != 0:
- id2_st = bytearray([0])
- id2_ret = self.alipay.id2_init()
- #print("id2_ret:%d"%id2_ret)
- self.alipay.id2_check_status(id2_st)
- #print("id2_st:",str(id2_st))
- if id2_st[0] == 1:
- self.is_init = self.alipay.pay_init(90000, 90000,\
- 2000, 2000, \
- 200, 40*1024, \
- self.upay_display_notify_cb, 0)
- #alipay.pay_init(90000, 90000,2000, 2000,200, 40*1024,upay_display_notify_cb, 0)
-
- if self.is_init == 0 :
- self.alipay.enable_collectioncode(1)
- else :
- print("id2_st:",str(id2_st))
- print("self.is_pay_init:%d"%self.is_init)
- self.Alipay_init_flag = 0
-
- def upay_display_notify_cb(self,arg):
- #print("upay_display_notify_cb!!!!!!!!!!!!!!!!!!!!")
- cmd = arg[0]
- rsp_code = arg[1]
- result = arg[2]
- result_len = arg[3]
- userdata = arg[4]
- if EventMesh.publish("get_Alipay_Ui_isOpen") == 0:
- return
- print("upay_display_notify_cb:\r\ncmd:{}\r\nrsp_code:{}".format(cmd,rsp_code))
-
- if rsp_code == 4 :
- # 打印获取到的绑定码
- print("bindcode[%d]: %s\n"%(result_len, result))
- #查询绑定结果
- utime.sleep_ms(1000)
- cmd_t = 2 #UPAY_MSG_GET_BINDING_RESULT;
- userdata_t = None
- args = None
- ret = self.alipay.msg_send(cmd_t,args,userdata_t)
- #EventMesh.subscribe("get_binding_code", self.get_binding_code)
- #EventMesh.publish("load_screen", {"screen": "alipay_invite","meta":{"result":result,"result_len":result_len}})
- EventMesh.publish("load_screen", {"screen": "alipay_invite","meta":str(result)})
-
- #case UPAY_RSP_PROCESSING:
- elif rsp_code == 1:
- #轮询绑定结果
- if cmd == 2 :
- print("upay_display_notify_cb: bind processing\n")
-
- elif rsp_code == 5:
- #获取付款码回调
- print("upay_display_notify_cb: paycode[%d]: %s\n"%( result_len, result))
- EventMesh.publish("load_screen", {"screen": "alipay_paycode","meta":str(result)})
-
- # 查询付款结果
- print("upay_display_notify_cb: get payment result\n")
- utime.sleep_ms(500)
- cmd_t = 4
- userdata_t = None
- args = None
- ret = self.alipay.msg_send(cmd_t,args,userdata_t)
-
- elif rsp_code == 6:
- #打印获取到的收款码
- print("upay_display_notify_cb: collectioncode[%d]: %s\n"%(result_len, result))
- EventMesh.publish("load_screen", {"screen": "alipay_collect","meta":str(result)})
- utime.sleep_ms(500)
-
- elif rsp_code == 7:
- #打印家长控制码
- print("upay_display_notify_cb: parentctrlcode[%d]: %s\n"%(result_len, result) )
- EventMesh.publish("load_screen", {"screen": "alipay_parent","meta":str(result)})
-
-
- elif rsp_code == 8:
- #付款结果
- print("upay_display_notify_cb: order result, bitmap size %d\n"%(result_len))
- EventMesh.publish("load_screen", {"screen": "alipay_pay_success","meta":str(result)})
-
- elif rsp_code == 3:
- #绑定成功
- print("upay_display_notify_cb: bind complete\n")
- EventMesh.publish("load_screen", {"screen": "alipay_success"})
-
- self.upay_bound = 1
-
- elif rsp_code == 2:
- # 绑定进度
- print("upay_display_notify_cb: bind progress %s\n"%(str(result)))
- EventMesh.publish("load_screen", {"screen": "alipay_inviting"})
-
- elif rsp_code == 11:
- # 解绑成功
- print("upay_display_notify_cb: unbind complete\n")
-
-
- elif rsp_code == 9:
- #主扫码解析结果
- print("%s: recv scancode info\n")
- #upay_scancode_info_t *scancode_info = (upay_scancode_info_t *)result
- seller_name = result[10]#未验证
- amount = result[20]#未验证
- print("upay_display_notify_cb: seller name %s, amount %s\n"%(seller_name, amount))
-
- #发起主扫支付
- cmd_t = 7 #UPAY_MSG_POST_SCAN_PAYMENT;
- args = amount
- userdata_t = None
- print("upay_display_notify_cb: ---------------------------- post scan payment\n")
- ret = self.alipay.msg_send(cmd_t,args,userdata_t)
-
- elif rsp_code == 20:
- if cmd == 6 :
- print("TODO:show 网络异常,请重试")
-
- elif rsp_code == 21:
- if cmd == 6 :
- print("TODO:show 二维码无法识别")
-
- elif rsp_code == 46:
- if cmd == 6 :
- print("TODO:show 网络异常,请重试")
-
- elif rsp_code == 48:
- if cmd == 6 :
- print("TODO:show 网络异常,请重试")
-
- elif rsp_code == 37:
- if cmd == 6 :
- print("TODO:show 网络异常,请重试")
-
- elif rsp_code == 49:
- if cmd == 6:
- print("TODO:show 网络异常,请重试")
-
- elif rsp_code == 50:
- if cmd == 6:
- print("TODO:show 网络异常,请重试")
-
- elif rsp_code == 10:
- #发起主扫支付结果
- print("upay_display_notify_cb: post scan payment complete\n")
-
- elif rsp_code == 18:
- # 发起主扫支付结果
- print("upay_display_notify_cb: post scan payment failed\n")
-
- elif rsp_code == 19:
- # 发起主扫支付结果
- print("upay_display_notify_cb: post scan payment failed\n")
-
- elif rsp_code == 42:
- #发起主扫支付结果
- print("upay_display_notify_cb: post scan payment failed\n")
-
- elif rsp_code == 43:
- # 发起主扫支付结果
- print("upay_display_notify_cb: post scan payment failed\n")
-
- elif rsp_code == 44:
- # 服务端已解绑
- print("upay_display_notify_cb: not bind !\n")
-
- def get_binding_code(self, event, msg):
- return self.result
-
- def alipay_unbind(self, event, msg):
- self.alipay.unbind()
-
- def get_payment_code(self, event, msg):
- if self.is_init == 0 :
- args = ""
- userdata = ""
- ret = self.alipay.msg_send(3,args,userdata)
-
- def get_collect_code(self, event, msg):
- if self.is_init == 0 :
- args = ""
- userdata = ""
- ret = self.alipay.msg_send(5,args,userdata)
-
- def get_parent_code(self, event, msg):
- if self.is_init == 0 :
- args = ""
- userdata = ""
- ret = self.alipay.msg_send(8,args,userdata)
- def get_alipay_init(self, event, msg):
- return self.is_init
-
- def alipay_exit(self, event, msg):
- if self.is_init == 0 :
- args = ""
- userdata = ""
- ret = self.alipay.msg_send(11,args,userdata) #发送退出程序命令
- print("alipay_exit")
- def id2_clean_data(self, event, msg):
- return self.alipay.id2_clean_data()
- def alipay_1(self, event, msg):
- #本地判断是否绑定
- check_bind = self.alipay.check_bind_status()
- check_bind_online = self.alipay.check_bind_status()
- print("check_bind:{} check_bind_online:{}".format(check_bind,check_bind_online))
- if check_bind == 4: #已绑定
- EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
- # if self.is_init == 0 :
- # args = ""
- # userdata = ""
- # ret = self.alipay.msg_send(3,args,userdata) #发送获取付款码消息
- # ret = self.alipay.msg_send(5,args,userdata) #发送获取收款码消息
- elif check_bind == 5: #未绑定
- #EventMesh.publish("load_screen", {"screen": "alipay_invite"})
- if self.is_init == 0 :
- args = ""
- userdata = ""
- print("--000--")
- ret = self.alipay.msg_send(1,args,userdata) #发送获取绑定码消息
- print("alipay_1 send msg:HELIOS_PAY_MSG_GET_BIND_CODE:{}".format(ret))
- else :
- print("check bind error!!!")
-
-
-style_alipay_screen_default = lv.style_t()
-style_alipay_screen_default.init()
-style_alipay_screen_default.set_radius(0)
-style_alipay_screen_default.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-style_alipay_screen_default.set_bg_opa(255)
-style_alipay_screen_default.set_border_width(0)
-style_alipay_screen_default.set_pad_left(0)
-style_alipay_screen_default.set_pad_right(0)
-style_alipay_screen_default.set_pad_top(0)
-style_alipay_screen_default.set_pad_bottom(0)
-
-style_alipay_img_default = lv.style_t()
-style_alipay_img_default.init()
-style_alipay_img_default.set_img_opa(255)
-style_alipay_img_default.set_img_recolor_opa(0)
-style_alipay_img_default.set_img_recolor(lv.color_make(0xff,0xff,0xff))
-
-alipay_open_screen = lv.obj()
-print("alipay_open_screen")
-alipay_open_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_open_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#进入图片
-AlipayOpen_img = lv.img(alipay_open_screen)
-AlipayOpen_img.set_pos(int(70),int(80))
-AlipayOpen_img.set_size(100,100)
-AlipayOpen_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-AlipayOpen_img.add_flag(lv.obj.FLAG.CLICKABLE)
-AlipayOpen_img.set_src("E:/static/APP/alipay/1.jpg")
-AlipayOpen_img.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-AlipayOpen_label = lv.label(alipay_open_screen)
-AlipayOpen_label.set_pos(0, 250)
-AlipayOpen_label.set_size(240, 50)
-AlipayOpen_label.set_long_mode(lv.label.LONG.WRAP)
-AlipayOpen_label.set_text("网络错误,请重试")
-AlipayOpen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-AlipayOpen_label.add_flag(lv.obj.FLAG.HIDDEN)
-AlipayOpen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-class AlipayOpenScreen(Screen):
- NAME = "alipay_open"
- #打开支付宝
- def __init__(self):
- super().__init__()
- self.meta = alipay_open_screen
- self.timer_AlipayOpen = osTimer()
- self.timer_AlipayOpen_count = 0
- self.flag = 0
-
-
- def initialization(self):
-
- self.flag = 0
- state = EventMesh.publish(constants.EVENT.GET_CONNECT)
- print("AlipayOpenScreen:state",state)
-
- if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:
- AlipayOpen_label.clear_flag(lv.obj.FLAG.HIDDEN)
- else:
- AlipayOpen_label.add_flag(lv.obj.FLAG.HIDDEN)
- if EventMesh.publish("get_alipay_init") == 0:
- if self.flag == 0:
- self.flag = 1
- EventMesh.publish("alipay_1")
- else:
- EventMesh.publish_async("Alipay_init","",40*1024)
- self.timer_AlipayOpen_count = 0
- self.timer_AlipayOpen.start(1000, 1, self.timeout_AlipayOpen)
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def timeout_AlipayOpen(self, *args):
- #print("timeout_AlipayOpen:",self.flag)
- EventMesh.publish("system_sleep_rest")#防止黑屏
- state = EventMesh.publish(constants.EVENT.GET_CONNECT)
- print("AlipayOpenScreen:state",state)
- if EventMesh.publish(constants.EVENT.GET_CONNECT) == 0:
- if self.timer_AlipayOpen_count > 10:
- self.timer_AlipayOpen_count = 0
- EventMesh.publish("return_prev_screen")
- else:
- if EventMesh.publish("get_alipay_init") == 0:
- #print("timeout_AlipayOpen:2")
- if self.flag == 0:
- self.flag = 1
- EventMesh.publish("alipay_1")
- else :
- #print("timeout_AlipayOpen:!!!!!!!!!!",self.timer_AlipayOpen_count)
- if self.timer_AlipayOpen_count>10 or self.timer_AlipayOpen_count == 0:
- if self.timer_AlipayOpen_count > 10:
- self.timer_AlipayOpen_count = 0
- EventMesh.publish("return_prev_screen")
- return
- EventMesh.publish_async("Alipay_init","",40*1024)
- self.timer_AlipayOpen_count = 1
- self.timer_AlipayOpen_count+=1
- # self.timer_AlipayOpen.stop()
- # self.timer_AlipayOpen.start(10000, 1, self.timeout_AlipayOpen)
-
- def post_processor_after_initialization(self):
- pass
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def Close(self):
- self.flag = 0
- self.timer_AlipayOpen.stop()
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
-
- pass
-
- 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"})
-
-alipay_1_1_screen = lv.obj()
-print("alipay_1_1_screen")
-alipay_1_1_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_1_1_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-#付款码
-alipay_imgbtn_3 = lv.img(alipay_1_1_screen)
-alipay_imgbtn_3.set_pos(8,10)
-alipay_imgbtn_3.set_size(224,69)
-alipay_imgbtn_3.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-alipay_imgbtn_3.add_flag(lv.obj.FLAG.CLICKABLE)
-alipay_imgbtn_3.set_src("E:/static/APP/alipay/1_13.png")
-alipay_imgbtn_3.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-#收钱
-alipay_imgbtn_2 = lv.img(alipay_1_1_screen)
-alipay_imgbtn_2.set_pos(8,86)
-alipay_imgbtn_2.set_size(224,69)
-alipay_imgbtn_2.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-alipay_imgbtn_2.add_flag(lv.obj.FLAG.CLICKABLE)
-alipay_imgbtn_2.set_src("E:/static/APP/alipay/1_12.png")
-alipay_imgbtn_2.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-#家长设置
-alipay_imgbtn_1 = lv.img(alipay_1_1_screen)
-alipay_imgbtn_1.set_pos(8,168)
-alipay_imgbtn_1.set_size(224,69)
-alipay_imgbtn_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-alipay_imgbtn_1.add_flag(lv.obj.FLAG.CLICKABLE)
-alipay_imgbtn_1.set_src("E:/static/APP/alipay/1_11.png")
-alipay_imgbtn_1.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-class Alipay_1_1(Screen):
- NAME = "alipay_1_1"
- #已绑定,显示功能列表
- def __init__(self):
- super().__init__()
- self.meta = alipay_1_1_screen
- #付款码
- alipay_imgbtn_3.add_event_cb(lambda e: EventMesh.callback_wrapper(self.alipay_paycode(e)),
- lv.EVENT.PRESSED, None)
- #收钱
- alipay_imgbtn_2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.alipay_collect(e)),
- lv.EVENT.PRESSED, None)
- #家长设置
- alipay_imgbtn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.alipay_parent(e)),
- lv.EVENT.PRESSED, None)
-
- def initialization(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def Close(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- def alipay_paycode(self,e):
- # Alipay.alipay.msg_send(3,"","") #发送获取付款码消息
- EventMesh.publish("get_payment_code")
-
- def alipay_collect(self,e):
- EventMesh.publish("get_collect_code")
- # EventMesh.publish("load_screen", {"screen": "alipay_collect"})
-
- def alipay_parent(self,e):
- EventMesh.publish("get_parent_code")
-
- def done_return(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"})
-
-alipay_invite_screen = lv.obj()
-print("alipay_invite_screen")
-alipay_invite_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_invite_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#背景
-alipay_invite_bg = lv.img(alipay_invite_screen)
-alipay_invite_bg.center()
-alipay_invite_bg.set_size(240,320)
-alipay_invite_bg.set_src("E:/static/APP/alipay/1_2.png")
-alipay_invite_bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#提示词
-alipay_invite_label = lv.label(alipay_invite_bg)
-alipay_invite_label.set_pos(0, 28)
-alipay_invite_label.set_size(240, 50)
-alipay_invite_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_invite_label.set_text("请家长用手机支付宝扫一扫")
-alipay_invite_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_invite_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#二维码
-alipay_invite_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
-alipay_invite_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
-
-alipay_invite_alipay_qr = lv.qrcode(alipay_invite_bg, 150, alipay_invite_fg_color, alipay_invite_bg_color)
-alipay_invite_alipay_qr.set_pos(41,103)
-# Add a border with alipay_invite_bg_color
-alipay_invite_alipay_qr.set_style_border_color(alipay_invite_bg_color, 0)
-alipay_invite_alipay_qr.set_style_border_width(5, 0)
-class Alipay_invite(Screen):
- NAME = "alipay_invite"
- #未绑定,获取二维码显示
- def __init__(self):
- super().__init__()
- self.meta = alipay_invite_screen
- self.alipay_invite = osTimer()
-
-
- def initialization(self):
- self.alipay_invite.start(1000, 1, self.alipay_invite)
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def alipay_invite(self, *args):
- print("alipay_invite:")
- EventMesh.publish("system_sleep_rest")#防止黑屏
-
-
- def post_processor_after_initialization(self):
- # 二维码数据
- self.alipay_qr_data = str(self.meta_info)
- print("alipay_invite:",str(self.meta_info))
- alipay_invite_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
-
-
- def Close(self):
- print("alipay_exit:")
- self.alipay_invite.stop()
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- def done_return(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"})
-
-alipay_inviting_screen = lv.obj()
-print("alipay_inviting_screen")
-alipay_inviting_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_inviting_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#提示词
-alipay_inviting_label = lv.label(alipay_inviting_screen)
-alipay_inviting_label.set_pos(0, 158)
-alipay_inviting_label.set_size(240, 24)
-alipay_inviting_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_inviting_label.set_text("绑定中,不要走开")
-alipay_inviting_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_inviting_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-class Alipay_inviting(Screen):
- NAME = "alipay_inviting"
-
- def __init__(self):
- super().__init__()
- self.meta = alipay_inviting_screen
-
- def initialization(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def post_processor_after_initialization(self):
- pass
-
- def Close(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- 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"})
-
-alipay_success_screen = lv.obj()
-print("alipay_success_screen")
-alipay_success_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_success_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#背景
-alipay_success_bg = lv.img(alipay_success_screen)
-alipay_success_bg.set_pos(56,30)
-alipay_success_bg.set_size(128,127)
-alipay_success_bg.set_src("E:/static/APP/alipay/1_2_1.png")
-alipay_success_bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#提示词
-alipay_success_label = lv.label(alipay_success_screen)
-alipay_success_label.set_pos(0, 168)
-alipay_success_label.set_size(240, 29)
-alipay_success_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_success_label.set_text("绑定成功")
-alipay_success_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_success_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-class Alipay_success(Screen):
- NAME = "alipay_success"
-
- def __init__(self):
- super().__init__()
- self.meta = alipay_success_screen
- self.timer_Alipay_success = osTimer()
-
- def initialization(self):
- self.timer_Alipay_success.start(1000, 0, self.timeout_Alipay_success)
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def post_processor_after_initialization(self):
- pass
-
- def timeout_Alipay_success(self, *args, **kwargs):
- EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
- self.timer_Alipay_success.stop()
-
-
- def Close(self):
- self.timer_Alipay_success.stop()
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-alipay_paycode_screen = lv.obj()
-print("alipay_paycode_screen")
-alipay_paycode_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_paycode_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-# alipay_paycode = lv.tileview(alipay_paycode_screen)
-# alipay_paycode.center()
-# alipay_paycode.set_size(240, 320)
-# alipay_paycode.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# alipay_paycode.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# # 1 - 二维码界面
-# alipay_qrcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-# alipay_paycode_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
-# alipay_paycode_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
-# #二维码
-# alipay_paycode_alipay_qr = lv.qrcode(alipay_qrcode, 150, alipay_paycode_fg_color, alipay_paycode_bg_color)
-# alipay_paycode_alipay_qr.set_pos(45,61)
-# alipay_paycode_alipay_qr.set_style_border_color(alipay_paycode_bg_color, 0)
-# alipay_paycode_alipay_qr.set_style_border_width(5, 0)
-
-# #提示词
-# alipay_paycode_label = lv.label(alipay_qrcode)
-# alipay_paycode_label.set_pos(0, 33)
-# alipay_paycode_label.set_size(240, 30)
-# alipay_paycode_label.set_long_mode(lv.label.LONG.WRAP)
-# alipay_paycode_label.set_text("收银员扫一扫完成付款")
-# alipay_paycode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# alipay_paycode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# # 2 - 条形码界面
-# alipay_barcode = alipay_paycode.add_tile(1, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-
-# alipay_paycode_cont = lv.obj(alipay_barcode)
-# alipay_paycode_cont.set_size(240,150)
-# alipay_paycode_cont.set_pos(0,85)
-# alipay_paycode_cont.add_style(style_cont_alipay, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# alipay_barcode_label = lv.label(alipay_barcode)
-# alipay_barcode_label.set_pos(0, 33)
-# alipay_barcode_label.set_size(240, 30)
-# alipay_barcode_label.set_long_mode(lv.label.LONG.WRAP)
-# alipay_barcode_label.set_text("收银员扫一扫完成付款")
-# alipay_barcode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# alipay_barcode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# alipay_barcode_num = lv.label(alipay_barcode)
-# alipay_barcode_num.set_pos(0, 240)
-# alipay_barcode_num.set_size(240, 30)
-# alipay_barcode_num.set_long_mode(lv.label.LONG.WRAP)
-# alipay_barcode_num.set_text(" ")
-# alipay_barcode_num.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# alipay_barcode_num.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-#提示词
-
-
-
-# 1 - 条形码界面
-# alipay_barcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-
-alipay_paycode_label = lv.label(alipay_paycode_screen)
-alipay_paycode_label.set_pos(0, 3)
-alipay_paycode_label.set_size(240, 25)
-alipay_paycode_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_paycode_label.set_text("收银员扫一扫完成付款")
-alipay_paycode_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_paycode_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# alipay_paycode_cont = lv.obj(alipay_paycode_screen)
-# alipay_paycode_cont.set_size(240,280)
-# alipay_paycode_cont.set_pos(0,40)
-# alipay_paycode_cont.add_style(style_cont_alipay, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-style_font_youyuan_black_20 = lv.style_t()
-style_font_youyuan_black_20.init()
-style_font_youyuan_black_20.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_black_20.set_text_font_v2("font_28.bin",28,0)
-
-# alipay_barcode_num = lv.label(alipay_paycode_screen)
-# alipay_barcode_num.set_pos(0, 130)
-# alipay_barcode_num.set_size(240, 30)
-# alipay_barcode_num.set_long_mode(lv.label.LONG.WRAP)
-# alipay_barcode_num.set_text(" ")
-# alipay_barcode_num.add_style(style_font_youyuan_black_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# 2 - 二维码界面
-
-# alipay_qrcode = alipay_paycode.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-alipay_paycode_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
-alipay_paycode_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
-#二维码
-alipay_paycode_alipay_qr = lv.qrcode(alipay_paycode_screen, 150, alipay_paycode_fg_color, alipay_paycode_bg_color)
-alipay_paycode_alipay_qr.set_pos(45,150)
-alipay_paycode_alipay_qr.set_style_border_color(alipay_paycode_bg_color, 0)
-alipay_paycode_alipay_qr.set_style_border_width(5, 0)
-
-
-class Alipay_paycode(Screen):
- NAME = "alipay_paycode"
-
- def __init__(self):
- super().__init__()
- self.meta = alipay_paycode_screen
- self.container = lv.obj(alipay_paycode_screen)
- self.container.set_pos(0, 33)
- self.container.set_size(240, 100)
- self.container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
- self.container.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
- self.timer = osTimer()
-
- def post_processor_after_initialization(self):
- self.alipay_qr_data = str(self.meta_info)
- print("alipay_paycode:",str(self.meta_info))
- alipay_paycode_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
- # alipay_bar.update(self.alipay_qr_data,len(self.alipay_qr_data))
- # alipay_barcode_num.set_text(self.alipay_qr_data)
- # left_curr_line = 0
-
- # # 删除上次的container
- # # 生成二进制码
- # binary_data = code128.encode(self.alipay_qr_data)
- # if not binary_data:
- # return
- # # print("binary_data is ",binary_data)
-
- # # 在LVGL中创建一个容器对象
- # self.container.delete()#先删除一次控件
- # self.container = lv.obj(alipay_paycode_screen)
- # self.container.set_pos(0, 30)
- # self.container.set_size(240, 100)
- # self.container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
- # self.container.add_style(style_alipay_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
- # # 计算每个条的宽度
- # bar_width = 240 // (len(binary_data))
- # # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data)))
- # # 按照二进制码中的1和0,分别创建LVGL矩形对象
- # for i in range(len(binary_data)):
- # # print("left_curr_line is :{} width:{}".format(left_curr_line,width))
- # bar = lv.obj(self.container)
- # bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
- # real_width = bar_width * 1
- # bar.set_size(1,90)
- # left = (240 - len(binary_data))//2#240-152 = 88 //2 ==44
- # bar.set_pos(left+left_curr_line,0)
- # if binary_data[i] == 0xff:
- # bar.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT)
- # else:
- # bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT)
- # left_curr_line += real_width
-
- code_128_generate_barcode(alipay_paycode_screen,self.alipay_qr_data,240,100)
- def initialization(self):
- self.timer.start(10*1000,1,self.update_alipy)
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
- def update_alipy(self,e):
- EventMesh.publish("get_payment_code")
-
- def lcd_on(self):
- self.timer.start(10*1000,1,self.update_alipy)
-
- def lcd_off(self):
- self.timer.stop()
-
- def Close(self):
- self.timer.stop()
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
- def done_click(self):
- EventMesh.publish("get_payment_code")
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-alipay_pay_success_screen = lv.obj()
-print("alipay_pay_success_screen")
-alipay_pay_success_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_pay_success_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
- #支付成功LOGO
-alipay_pay_bg = lv.img(alipay_pay_success_screen)
-alipay_pay_bg.set_pos(82, 120)
-alipay_pay_bg.set_size(78,78)
-alipay_pay_bg.set_src("E:/static/APP/alipay/1_13_1_1.png")
-alipay_pay_bg.add_flag(lv.obj.FLAG.CLICKABLE)
-alipay_pay_bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-#付款金额
-# alipay_pay_label = lv.label(alipay_pay_success_screen)
-# alipay_pay_label.set_pos(0, 220)
-# alipay_pay_label.set_size(240, 45)
-# alipay_pay_label.set_long_mode(lv.label.LONG.WRAP)
-# alipay_pay_label.set_text(" ")
-# alipay_pay_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# alipay_pay_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-#完成按钮
-alipay_pay_text = lv.label(alipay_pay_success_screen)
-alipay_pay_text.set_text("支付完成")
-alipay_pay_text.set_pos(0, 220)
-alipay_pay_text.set_size(240,45)
-alipay_pay_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_pay_text.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-class Alipay_pay_success(Screen):
- NAME = "alipay_pay_success"
-
- def __init__(self):
- super().__init__()
- self.meta = alipay_pay_success_screen
- alipay_pay_bg.add_event_cb(lambda e: EventMesh.callback_wrapper(self.button_cb(e)), lv.EVENT.CLICKED, None)
-
- def post_processor_after_initialization(self):
- print("money:",str(self.meta_info))
- # alipay_pay_label.set_text(str(self.meta_info))
-
- def button_cb(self,e):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def initialization(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def Close(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-alipay_collect_screen = lv.obj()
-print("alipay_collect_screen")
-alipay_collect_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_collect_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#二维码
-alipay_collect_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
-alipay_collect_bg_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
-
-alipay_collect_alipay_qr = lv.qrcode(alipay_collect_screen, 150, alipay_collect_bg_fg_color, alipay_collect_bg_color)
-alipay_collect_alipay_qr.set_pos(33,22)
-# Add a border with bg_color
-alipay_collect_alipay_qr.set_style_border_color(alipay_collect_bg_color, 0)
-alipay_collect_alipay_qr.set_style_border_width(5, 0)
-
-#提示词
-alipay_collect_label = lv.label(alipay_collect_screen)
-alipay_collect_label.set_pos(0, 204)
-alipay_collect_label.set_size(240, 50)
-alipay_collect_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_collect_label.set_text("请对方使用支付宝扫码")
-alipay_collect_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_collect_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-class Alipay_collect(Screen):
- NAME = "alipay_collect"
-
- def __init__(self):
- super().__init__()
- self.meta = alipay_collect_screen
-
-
-
- def initialization(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def post_processor_after_initialization(self):
- self.alipay_qr_data = str(self.meta_info)
- print("alipay_collect:",str(self.meta_info))
- alipay_collect_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
-
- def Close(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-alipay_parent_screen = lv.obj()
-print("alipay_parent_screen")
-alipay_parent_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# add style for watchface
-alipay_parent_screen.add_style(style_alipay_screen_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#家长头像
-alipay_parent_bg = lv.img(alipay_parent_screen)
-alipay_parent_bg.set_pos(8,12)
-alipay_parent_bg.set_size(81,81)
-alipay_parent_bg.set_src("E:/static/APP/alipay/1_11_1.png")
-alipay_parent_bg.add_style(style_alipay_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#提示词
-alipay_parent_label = lv.label(alipay_parent_screen)
-alipay_parent_label.set_pos(104, 12)
-alipay_parent_label.set_size(96, 29)
-alipay_parent_label.set_long_mode(lv.label.LONG.WRAP)
-alipay_parent_label.set_text("家长设置")
-alipay_parent_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_parent_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-alipay_parent_label1 = lv.label(alipay_parent_screen)
-alipay_parent_label1.set_pos(100, 43)
-alipay_parent_label1.set_size(120, 29)
-alipay_parent_label1.set_long_mode(lv.label.LONG.WRAP)
-alipay_parent_label1.set_text("零花钱管理")
-alipay_parent_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_parent_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-alipay_parent_label2 = lv.label(alipay_parent_screen)
-alipay_parent_label2.set_pos(100, 71)
-alipay_parent_label2.set_size(120, 29)
-alipay_parent_label2.set_long_mode(lv.label.LONG.WRAP)
-alipay_parent_label2.set_text("解绑退钱")
-alipay_parent_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alipay_parent_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-#家长码
-alipay_parent_bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
-alipay_parent_fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
-
-alipay_parent_alipay_qr = lv.qrcode(alipay_parent_screen, 150, alipay_parent_fg_color, alipay_parent_bg_color)
-alipay_parent_alipay_qr.set_pos(45,171)
-# Add a border with bg_color
-alipay_parent_alipay_qr.set_style_border_color(alipay_parent_bg_color, 0)
-alipay_parent_alipay_qr.set_style_border_width(5, 0)
-alipay_parent_alipay_qr.set_style_border_width(5, 0)
-
-class Alipay_parent(Screen):
- NAME = "alipay_parent"
-
- def __init__(self):
- super().__init__()
- self.meta = alipay_parent_screen
-
-
-
- def initialization(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",1)
-
- def post_processor_after_initialization(self):
- self.alipay_qr_data = str(self.meta_info)
- print("alipay_parent:",str(self.meta_info))
- alipay_parent_alipay_qr.update(self.alipay_qr_data,len(self.alipay_qr_data))
-
- def Close(self):
- EventMesh.publish("set_Alipay_Ui_isOpen",0)
- pass
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "alipay_1_1"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
\ No newline at end of file
+++ /dev/null
-import osTimer
-import lvgl as lv
-import EventMesh
-import osTimer
-import constants
-import ujson
-import ql_fs
-import audio
-from machine import Pin
-from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn
-import audio
-import utime
-import ALIPAY
-from misc import Power
-factorymode_cont_y = 0
-factorymode_screen = lv.obj()
-print("factorymode_screen")
-factorymode_screen.center()
-factorymode_screen.set_size(240, 320)
-factorymode_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-factorymode_title = lv.label(factorymode_screen)
-factorymode_title.set_pos(0, 10)
-factorymode_title.set_size(240, 40)
-factorymode_title.set_text("-工厂模式-")
-factorymode_title.set_long_mode(lv.label.LONG.WRAP)
-factorymode_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-factorymode_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-factorymode_cont_style = lv.style_t()
-factorymode_cont_style.init()
-factorymode_cont_style.set_radius(0)
-factorymode_cont_style.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-factorymode_cont_style.set_bg_grad_color(lv.color_make(0x00, 0x00, 0x00))
-factorymode_cont_style.set_bg_grad_dir(lv.GRAD_DIR.VER)
-factorymode_cont_style.set_bg_opa(255)
-factorymode_cont_style.set_border_width(0)
-factorymode_cont_style.set_pad_left(0)
-factorymode_cont_style.set_pad_right(0)
-factorymode_cont_style.set_pad_top(0)
-factorymode_cont_style.set_pad_bottom(0)
-
-factorymode_cont = lv.obj(factorymode_screen)
-factorymode_cont.set_pos(0, 50)
-factorymode_cont.set_size(240, 270)
-factorymode_cont.add_style(factorymode_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-factorymode_location = lv.btn(factorymode_cont)
-factorymode_location.set_pos(0, factorymode_cont_y)
-factorymode_location.set_size(240, 60)
-factorymode_location_label = lv.label(factorymode_location)
-factorymode_location_label.set_text("定位测试")
-factorymode_location.set_style_pad_all(0, lv.STATE.DEFAULT)
-factorymode_location_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-factorymode_location_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-factorymode_location_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-factorymode_location.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-factorymode_cont_y+=60
-factorymode_bat_test = lv.btn(factorymode_cont)
-factorymode_bat_test.set_pos(0, factorymode_cont_y)
-factorymode_bat_test.set_size(240, 60)
-factorymode_bat_test_label = lv.label(factorymode_bat_test)
-factorymode_bat_test_label.set_text("电池测试")
-factorymode_bat_test.set_style_pad_all(0, lv.STATE.DEFAULT)
-factorymode_bat_test_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-factorymode_bat_test_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-factorymode_bat_test_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-factorymode_bat_test.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-factorymode_cont_y+=200
-factorymode_alipay_init = lv.btn(factorymode_cont)
-factorymode_alipay_init.set_pos(0, factorymode_cont_y)
-factorymode_alipay_init.set_size(240, 60)
-factorymode_alipay_init_label = lv.label(factorymode_alipay_init)
-factorymode_alipay_init_label.set_text("支付宝初始化")
-factorymode_alipay_init.set_style_pad_all(0, lv.STATE.DEFAULT)
-factorymode_alipay_init_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-factorymode_alipay_init_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-factorymode_alipay_init_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-factorymode_alipay_init.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-class FactoryModeScreen(Screen):
- NAME = "factorymode"
- def __init__(self):
- super().__init__()
- self.meta = factorymode_screen
- factorymode_location.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "FactoryModeLocation"})), lv.EVENT.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.load_screen(e, {"screen": "FactoryModeBatTest"})), lv.EVENT.CLICKED, None)
-
- def done_return(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"})
-
-FactoryModeBatTest_screen = lv.obj()
-FactoryModeBatTest_screen.center()
-FactoryModeBatTest_screen.set_size(240, 320)
-FactoryModeBatTest_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-FactoryModeBatTest_label = lv.label(FactoryModeBatTest_screen)
-FactoryModeBatTest_label.set_text("Vbat:0V")
-FactoryModeBatTest_label.set_size(240, 100)
-FactoryModeBatTest_label.set_pos(50, 100)
-FactoryModeBatTest_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-FactoryModeBatTest_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-class FactoryModeBatTestScreen(Screen):
- NAME = "FactoryModeBatTest"
- def __init__(self):
- super().__init__()
- self.meta = FactoryModeBatTest_screen
- self.BatTest_timer = osTimer()
-
- def initialization(self):
- print("FactoryModeBatTestScreen")
- self.BatTest_timer.start(1000,1,self.BatTest_timer_cb)
-
- def post_processor_after_initialization(self):
- pass
-
- def BatTest_timer_cb(self,e):
- EventMesh.publish("system_sleep_rest")#防止黑屏
- temp = Power.getVbatt()
- FactoryModeBatTest_label.set_text("Vbat:{}V".format(temp))
-
- def Close(self):
- self.BatTest_timer.stop()
- pass
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-FactoryModeAlipayInit_screen = lv.obj()
-FactoryModeAlipayInit_screen.center()
-FactoryModeAlipayInit_screen.set_size(240, 320)
-FactoryModeAlipayInit_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-FactoryModeAlipayInit_label = lv.label(FactoryModeAlipayInit_screen)
-FactoryModeAlipayInit_label.set_text("支付宝初始化成功")
-FactoryModeAlipayInit_label.set_size(240, 100)
-FactoryModeAlipayInit_label.set_pos(50, 100)
-FactoryModeAlipayInit_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-FactoryModeAlipayInit_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-import atcmd
-
-class FactoryModeAlipayInitScreen(Screen):
- NAME = "FactoryModeAlipayInit"
- def __init__(self):
- super().__init__()
- self.meta = FactoryModeAlipayInit_screen
-
- def initialization(self):
- ret =EventMesh.publish("id2_clean_data")
- print("id2_clean_data:ret:{}".format(ret))
-
- def post_processor_after_initialization(self):
- resp=bytearray(50)
- atcmd.sendSync('AT+RSTSET\r\n',resp,'',200) #清nv
- print("AT+RSTSET:{}".format(resp))
- utime.sleep(5)
- Power.powerRestart()
- def Close(self):
- pass
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-FactoryModeLocation_screen = lv.obj()
-print("FactoryModeLocation_screen")
-FactoryModeLocation_screen.center()
-FactoryModeLocation_screen.set_size(240, 320)
-FactoryModeLocation_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-FactoryModeLocation_WIFI_label = lv.label(FactoryModeLocation_screen)
-FactoryModeLocation_WIFI_label.set_text("WIFI:")
-FactoryModeLocation_WIFI_label.set_size(240, 100)
-FactoryModeLocation_WIFI_label.set_pos(0, 0)
-FactoryModeLocation_WIFI_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-FactoryModeLocation_WIFI_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-FactoryModeLocation_CALL_label = lv.label(FactoryModeLocation_screen)
-FactoryModeLocation_CALL_label.set_text("CALL:")
-FactoryModeLocation_CALL_label.set_size(240, 60)
-FactoryModeLocation_CALL_label.set_pos(0, 100)
-FactoryModeLocation_CALL_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-FactoryModeLocation_CALL_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-FactoryModeLocation_GNSS_label = lv.label(FactoryModeLocation_screen)
-FactoryModeLocation_GNSS_label.set_text("GNSS:\n")
-FactoryModeLocation_GNSS_label.set_size(240, 200)
-FactoryModeLocation_GNSS_label.set_pos(0, 160)
-FactoryModeLocation_GNSS_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-FactoryModeLocation_GNSS_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-class FactoryModeLocationScreen(Screen):
- NAME = "FactoryModeLocation"
- def __init__(self):
- super().__init__()
- self.meta = FactoryModeLocation_screen
- EventMesh.subscribe("PUSH_LOCATION_DATA",self.GET_LOCATION_DATA)
- self.timer_FactoryModeLocation = osTimer()
-
- def initialization(self):
- FactoryModeLocation_GNSS_label.set_text("GNSS:\n")
- FactoryModeLocation_WIFI_label.set_text("WIFI:")
- FactoryModeLocation_CALL_label.set_text("CALL:")
- self.timer_FactoryModeLocation.start(1000, 1, self.timer_FactoryModeLocation_cb)
-
- def post_processor_after_initialization(self):
- #utime.sleep_ms(1000)
- EventMesh.publish(constants.EVENT.START_LOCATION, 1) #测试模式
-
- def timer_FactoryModeLocation_cb(self, *args, **kwargs):
- EventMesh.publish("system_sleep_rest")#防止黑屏
-
- def GET_LOCATION_DATA(self, event, msg):
- print("GPS:{}".format(msg[0]))
- print("WIFI:{}".format(msg[1]))
- print("CALL:{}".format(msg[2]))
- EventMesh.publish("system_sleep_rest")#防止黑屏
- if msg[1] != [] : #WIFI
- WIFI_len = len(msg[1][1])
- WIFI_DATA = "WIFI:"
- if WIFI_len > 3:
- WIFI_len = 3
- for i in range(WIFI_len) :
- WIFI_DATA += "{}".format(msg[1][1][i])
- FactoryModeLocation_WIFI_label.set_text(WIFI_DATA)
-
- if len(msg[0]) > 1 : #GPS
- GNSS_DATA = "GNSS:\n"
-
- gsv_data = msg[0][1].split("GSV")
- if len(gsv_data) < 2 :
- return
- gsv_data = gsv_data[1:]
-
- GSV_dict= {}
- for i in range(len(gsv_data)) :
- gsv_data[i] = gsv_data[i].split("\r\n")[0]
- gsv_tmp = gsv_data[i].split(",")
- if len(gsv_tmp) < 7 :
- break
- gsv_tmp = gsv_tmp[4:]
- #print("gsv_tmp:{}".format(gsv_tmp))
- for i in range(len(gsv_tmp)) :
- if i % 4 == 0:
- GSV_dict[gsv_tmp[i]] = gsv_tmp[i+3]
- #print("GSV_dict:{}:[{}]".format(gsv_tmp[i],gsv_tmp[i+3]))
- if len(gsv_tmp)-i < 4:
- break
- count = 0
- for key in GSV_dict :
- print("GSV_dict[key]:len".format(len(GSV_dict[key])))
- if len(GSV_dict[key]) >= 1 :
- GNSS_DATA+=" {:<3}:[{:<3}] ".format(key,GSV_dict[key])#:<3 宽度为3左对齐
- count+=1
- if count%2 == 0:
- GNSS_DATA+="\n"
- if count > 14:
- break
- print("GxGSV:{}".format(GNSS_DATA))
- FactoryModeLocation_GNSS_label.set_text(GNSS_DATA)
- if msg[2] != [] :#基站
- #print("CALL data:".format(msg[2][0]))
- if len(msg[2]) >= 2 :
- FactoryModeLocation_CALL_label.set_text("CALL:{}".format(msg[2][0]))
- def Close(self):
- EventMesh.publish(constants.EVENT.CLOSE_LOCATION)
- self.timer_FactoryModeLocation.stop()
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
\ No newline at end of file
self.read_data = {}
self.volum_size = 8
self.msg_tmp = ""
- check_txt = ql_fs.path_exists("/ext/static/storage_file/wechat_record.json")
+ check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json")
if check_txt == True :
- with open("/ext/static/storage_file/wechat_record.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/wechat_record.json","r") as fd:#音频文件编号
self.wechat_recode_list = ujson.load(fd)
if not self.wechat_recode_list:
self.wechat_recode_list = {"num":0}
self.wechat_num = self.wechat_recode_list["num"]
else :
self.wechat_recode_list = {"num":0}
- with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
ujson.dump(self.wechat_recode_list,fd)
# if self.wechat_num != 0:
- # with open("/ext/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录
+ # with open("/usr/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录
# self.wechat_recode_list = ujson.load(fd)#读取每一个amr音频文件的时长ui_setting.py
self.record_test = audio.Record()
self.aud = audio.Audio(0)
self.aud.set_pa(Pin.GPIO29)
- check_volum = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check_volum == True :
- with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("volum") in self.read_data.keys()
self.MXA_MSG = msg[0]
self.wechat_recode_list = msg[1]
self.wechat_num = self.wechat_recode_list["num"]
- with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
ujson.dump(self.wechat_recode_list,fd)
#写编号
Wechat_log("set_wechat_data2:{} ".format(self.wechat_num))
self.wechat_list_dict[i]["_btn_img"].set_size(30, 30)
if value.find("R:") != -1:
self.wechat_list_dict[i]["_btn_img"].set_pos(5, 0)
- self.wechat_list_dict[i]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png")
+ self.wechat_list_dict[i]["_btn_img"].set_src("U:/static/APP/wechat/R_3.png")
elif value.find("S:") != -1:
self.wechat_list_dict[i]["_btn_img"].set_pos(self.startWidth-50, 0)
- self.wechat_list_dict[i]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png")
+ self.wechat_list_dict[i]["_btn_img"].set_src("U:/static/APP/wechat/S_3.png")
#self.wechat_list_dict[i]["_btn_img"].add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
self.wechat_list_dict[i]["_btn_img"].clear_flag(lv.obj.FLAG.HIDDEN)
else :
self.wechat_show = self.wechat_num
self.wechat_recode_list["num"] = self.wechat_num
Wechat_log("talking1.0")
- self.record_test.start("/ext/static/storage_file/{}.amr".format(self.wechat_num),16)
+ self.record_test.start("/usr/static/storage_file/{}.amr".format(self.wechat_num),16)
self.second_timer.start(1000, 1, self.reduce_second)
self.press_state = 1
self.ble_send = 1
##隐藏显示文本 显示列表显示框
EventMesh.publish("publish_message_event_ui",{"func":self.updata_list_show,"data":2})
self.timer.start(200, 0, self.hide_label)
- with open("/ext/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd:
ujson.dump(self.wechat_recode_list,fd)
Wechat_log("send wechat data!!!!!!!!!!!!!!!!!!!!!")
- path = "/ext/static/storage_file/{}.amr".format(self.wechat_show)
+ path = "/usr/static/storage_file/{}.amr".format(self.wechat_show)
with open(path,"rb") as fd:
buf = bytearray(ql_fs.path_getsize(path))
fd.readinto(buf)
text = self.wechat_list_dict[self.paay_btn_count]["_btn_label2"].get_text()
self.play_text = text[0:2] #区分左右喇叭动画显示 "R":左边 "S:"右边 "T:":左边
if self.play_text == "R:":
- self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/R_{}.png".format(self.count_img))
+ self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/APP/wechat/R_{}.png".format(self.count_img))
elif self.play_text == "S:":
- self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/S_{}.png".format(self.count_img))
+ self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/APP/wechat/S_{}.png".format(self.count_img))
self.sec_num+=1
if self.sec_num % 2 == 0:
if self.play_sec == 0:
self.play_timer.stop()
if self.play_text == "R:":
- self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png")
+ self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/APP/wechat/R_3.png")
elif self.play_text == "S:":
- self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png")
+ self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/APP/wechat/S_3.png")
get_play = EventMesh.publish("get_audio_state")
if get_play != None:
if get_play == 0:
self.play_timer.stop()
if self.play_text == "R:":
- self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png")
+ self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/APP/wechat/R_3.png")
elif self.play_text == "S:":
- self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png")
+ self.wechat_list_dict[self.paay_btn_count]["_btn_img"].set_src("U:/static/APP/wechat/S_3.png")
Wechat_log("play_img2")
def play_label_cb(self,e): #lvgl按钮回调
Wechat_log("play_label_cb1")
text = self.wechat_list_dict[self.paay_btn_old_count]["_btn_label2"].get_text()
self.play_text = text[0:2]
if self.play_text == "R:":
- self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("E:/static/APP/wechat/R_3.png")
+ self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("U:/static/APP/wechat/R_3.png")
elif self.play_text == "S:":
- self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("E:/static/APP/wechat/S_3.png")
+ self.wechat_list_dict[self.paay_btn_old_count]["_btn_img"].set_src("U:/static/APP/wechat/S_3.png")
self.count_img = 0 #喇叭动画显示的数量
if self.play_text == "R:" or self.play_text == "S:":#过滤掉文字显示 不需要播放音频文件
self.aud = audio.Audio(0)
self.aud.stop()#
- self.aud.play(1, 1, '/ext/static/storage_file/{}.amr'.format(i)) #文件名前面要加上路径
+ self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(i)) #文件名前面要加上路径
self.paay_btn_old_count = self.paay_btn_count
Wechat_log("play_label2")
EventMesh.publish("load_screen", {"screen": "wechat_popup"})
else:
EventMesh.publish("wechat_updata_list_show")
- # path = "/ext/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num)
- path = "/ext/static/storage_file/{}.amr".format(wechat_num)
+ # path = "/usr/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num)
+ path = "/usr/static/storage_file/{}.amr".format(wechat_num)
with open(path,"w") as fd:
arm = bytearray()
j = 0
+++ /dev/null
-import lvgl as lv
-import code128
-# 界面风格1
-# style_bar = lv.style_t()
-# style_bar.init()
-# style_bar.set_border_width(0)
-# style_bar.set_radius(0)
-# style_bar.set_pad_top(0)
-# style_bar.set_pad_bottom(0)
-# style_bar.set_pad_left(0)
-# style_bar.set_pad_right(0)
-style_bar = lv.style_t()
-style_bar.init()
-style_bar.set_radius(0)
-style_bar.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-style_bar.set_bg_opa(255)
-style_bar.set_border_width(0)
-style_bar.set_pad_left(0)
-style_bar.set_pad_right(0)
-style_bar.set_pad_top(0)
-style_bar.set_pad_bottom(0)
-#screen = lv.obj()
-
-
-
-def code_128_generate_barcode(screen, data, width=180, height=80):
-
- left_curr_line = 0
-
- # 删除上次的container
- old_container = screen.get_child(-1)
- if old_container:
- old_container.delete()
-
- # 生成二进制码
- binary_data = code128.encode(data)
- if not binary_data:
- return
- # print("binary_data is ",binary_data)
-
- # 在LVGL中创建一个容器对象
- container = lv.obj(screen)
- container.set_size(width, height)
- container.set_pos(0, 33)
- container.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
- container.add_style(style_bar,lv.PART.MAIN | lv.STATE.DEFAULT)
-
- # 计算每个条的宽度
- bar_width = width // (len(binary_data))
- # print("bar_width is :{} len(binary_data):{}".format(bar_width,len(binary_data)))
- # 按照二进制码中的1和0,分别创建LVGL矩形对象
- for i in range(len(binary_data)):
- # print("left_curr_line is :{} width:{}".format(left_curr_line,width))
- bar = lv.obj(container)
- bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
- real_width = bar_width * 1
- bar.set_size(1,90)
- left = (width - len(binary_data))//2#240-152 = 88 //2 ==44
- bar.set_pos(left+left_curr_line,0)
- if binary_data[i] == 0xff:
- bar.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT)
- else:
- bar.set_style_bg_color(lv.color_make(0x00, 0x00, 0x00), lv.PART.MAIN | lv.STATE.DEFAULT)
- left_curr_line += real_width
-
-
-# if __name__ == "__main__":
-# code_39_generate_barcode(screen,"A123 321")
-# lv.scr_load(screen)
-
+++ /dev/null
-import log
-from machine import I2C
-import utime
-from machine import Pin
-import uos
-
-# from ext import capacitive_hynitron_cst816d_update_new
-import capacitive_hynitron_cst816d_update
-
-TP_HYN_I2C_UPDATE_WRITE_ADDR = (0x6A<<1)
-TP_HYN_I2C_UPDATE_READ_ADDR = ((0x6A<<1)|1)
-PER_LEN = 512
-x = 0
-y = 0
-#---------------------------------------------------------------------
-# cst816d_read_checksum
-#---------------------------------------------------------------------
-def cst816d_read_checksum():
-
- if -1 == cst816d_enter_bootmode():
- return -1
-
- i2c_obj = I2C(I2C.I2C2, I2C.FAST_MODE)
- cmd = [0]
-
- if -1 == i2c_obj.write(TP_HYN_I2C_UPDATE_WRITE_ADDR>>1, bytearray([0xa0,0x03]), 2, bytearray(cmd), 1):
- return -1
- utime.sleep_ms(500)#这里延时太短会读错checksum
-
- r_data = bytearray(2)
- if -1 == i2c_obj.read(TP_HYN_I2C_UPDATE_READ_ADDR>>1, bytearray([0xa0,0x08]), 2, r_data, 2, 0):
- return -1
- check_sum = (r_data[1] << 8) | r_data[0]
- print("check_sum的值为:",check_sum)
- return check_sum
-#---------------------------------------------------------------------
-# GPIO_ResetTP
-#---------------------------------------------------------------------
-def GPIO_ResetTP():
-
- print("GPIO_ResetTP")
-
- gpio_power = Pin(Pin.GPIO18, Pin.OUT, Pin.PULL_PU, 0)
- gpio_power.write(1)
-
- gpio_reset = Pin(Pin.GPIO32, Pin.OUT, Pin.PULL_PU, 0)
- gpio_reset.write(0)
- utime.sleep_ms(10)
- gpio_reset.write(1)
- utime.sleep_ms(10)
-
-#---------------------------------------------------------------------
-# cst816d_update
-#---------------------------------------------------------------------
-def cst816d_update(startAddr, length, data):
- print("cst816d_update")
- if -1 == cst816d_enter_bootmode():
- return -1
-
- sum_len = 0
- cmd = [0,0]
- global x
- while 1:
- x += 1
- if sum_len >= length:
- print("sum_len >= length,退出循环")
- return
- a = startAddr&0xFF
- cmd[0]=a
- b = startAddr>>8
- cmd[1]=b
- i2c_obj = I2C(I2C.I2C2, I2C.FAST_MODE)
-
- ret = i2c_obj.write(TP_HYN_I2C_UPDATE_WRITE_ADDR>>1, bytearray([0xa0,0x14]), 2, bytearray(cmd), 2)
- utime.sleep_ms(100)
-
- ret = i2c_obj.write(TP_HYN_I2C_UPDATE_WRITE_ADDR>>1, bytearray([0xa0,0x18]), 2, bytearray(data), PER_LEN)
-
- utime.sleep_ms(100)
-
- cmd[0] = 0xEE
- ret = i2c_obj.write(TP_HYN_I2C_UPDATE_WRITE_ADDR>>1, bytearray([0xa0,0x04]), 2, bytearray(cmd), 1)
-
- utime.sleep_ms(100)
-
- retrycnt = 51
- for i in range (retrycnt):
- r_data = bytearray(1)
- ret = i2c_obj.read(TP_HYN_I2C_UPDATE_READ_ADDR>>1, bytearray([0xa0,0x05]), 2, r_data, 1, 0)
- utime.sleep_ms(50)
-
- if r_data[0] == 0x55:
- print("r_data[0] = 0x55,break")
- break
-
- startAddr = startAddr + PER_LEN
- del data[0:PER_LEN]
- sum_len = sum_len + PER_LEN
-
-#---------------------------------------------------------------------
-# cst816d_enter_bootmode
-#---------------------------------------------------------------------
-def cst816d_enter_bootmode():
-
- GPIO_ResetTP()
- i2c_obj = I2C(I2C.I2C2, I2C.FAST_MODE)
-
- cmd = [0xAB]
- #进入boot模式
- retrycnt = 10
- global y
- for i in range (retrycnt):
- y += 1
- if 0 == i2c_obj.write(TP_HYN_I2C_UPDATE_WRITE_ADDR>>1, bytearray([0xa0,0x01]), 2, bytearray(cmd), 1):
- utime.sleep_ms(100)
- else:
- print("boot模式写命令失败")
-
- r_data = bytearray(1)
- if -1 == i2c_obj.read(TP_HYN_I2C_UPDATE_READ_ADDR>>1, bytearray([0xa0,0x03]), 2, r_data, 1, 0):
- utime.sleep_ms(100)
- else:
- if 0xc1 == r_data[0]:
- utime.sleep_ms(100)
- return 0
- else:
- print("boot模式进入失败")
-
- return -1
-#---------------------------------------------------------------------
-# ctp_hynitron_update
-#---------------------------------------------------------------------
-def ctp_hynitron_update():
-
- # 初始化固件数组和数组长度
- p_app_bin = []
- app_bin_len = 0
-
- #进入boot模式
- # if -1 == cst816d_enter_bootmode():
- # return
-
- # 获取固件数组
- # p_app_bin = capacitive_hynitron_cst816d_update_new.app_bin_816d
- p_app_bin = capacitive_hynitron_cst816d_update.app_bin_816d
-
- # 获取固件数组的长度
- app_bin_len = len(p_app_bin)
-
- if app_bin_len > 10:
- startAddr = p_app_bin[1]
- length = p_app_bin[3]
- checksum = p_app_bin[5] #a8 78
-
- startAddr <<= 8; startAddr |= p_app_bin[0]
- length <<= 8; length |= p_app_bin[2]
- checksum <<= 8; checksum |= p_app_bin[4]
-
- print("startAddr:%x"%startAddr)
- print("length:%x"%length)
- print("checksum:%x"%checksum)
-
-
- #检查checksum
- sum_now = cst816d_read_checksum()
- if sum_now == -1:
- print("初始化失败")
- elif sum_now != checksum:
- print("固件包checksum不相同!")
-
- del p_app_bin[0:6]
- cst816d_update(startAddr, length, p_app_bin)
-
- #升级后再次确认checksum
- if checksum == cst816d_read_checksum():
- print("固件升级成功!")
-
- elif checksum == sum_now:
- print("固件包checksum相同,退出")
-
-
-#---------------------------------------------------------------------
-# HYN_Initial
-#---------------------------------------------------------------------
-def HYN_Initial():
-
- #GPIO_ResetTP()
-
- ctp_hynitron_update()
-
- GPIO_ResetTP()
-
-
-
-
-
-
+++ /dev/null
-import lvgl as lv
-from machine import LCD, Pin
-from tp import cst816
-import _thread
-import utime
-import EventMesh
-from misc import PWM
-
-
-init_data = (
-
- 0, 0, 0x11,
- 2, 0, 120,
-
- 0, 1, 0x36,
- 1, 1, 0x00,
-
- 0, 1, 0x35,
- 1, 1, 0x00,
-
- 0, 1, 0x3a,
- 1, 1, 0x05,
-
- 0, 5, 0xB2,
- 1, 1, 0x0c,
- 1, 1, 0x0c,
- 1, 1, 0x00,
- 1, 1, 0x33,
- 1, 1, 0x33,
-
- 0, 1, 0xB7,
- 1, 1, 0x77,
-
- 0, 1, 0xBB,
- 1, 1, 0x2c,
-
- 0, 1, 0xC0,
- 1, 1, 0x2C,
-
- 0, 1, 0xC2,
- 1, 1, 0x01,
-
- 0, 1, 0xC3,
- 1, 1, 0x21,
-
- 0, 1, 0xC4,
- 1, 1, 0x20,
-
- 0, 1, 0xC6,
- 1, 1, 0x10,
-
- 0, 2, 0xD0,
- 1, 1, 0xA4,
- 1, 1, 0xA1,
-
- 0, 14, 0xE0,
- 1, 1, 0xd0,
- 1, 1, 0x03,
- 1, 1, 0x08,
- 1, 1, 0x0e,
- 1, 1, 0x12,
- 1, 1, 0x2d,
- 1, 1, 0x42,
- 1, 1, 0x45,
- 1, 1, 0x53,
- 1, 1, 0x29,
- 1, 1, 0x16,
- 1, 1, 0x15,
- 1, 1, 0x22,
- 1, 1, 0x24,
-
- 0, 14, 0xE1,
- 1, 1, 0xd0,
- 1, 1, 0x03,
- 1, 1, 0x08,
- 1, 1, 0x0e,
- 1, 1, 0x13,
- 1, 1, 0x2c,
- 1, 1, 0x42,
- 1, 1, 0x54,
- 1, 1, 0x50,
- 1, 1, 0x2c,
- 1, 1, 0x16,
- 1, 1, 0x16,
- 1, 1, 0x20,
- 1, 1, 0x27,
- #0, 0, 0x11,
- 0, 0, 0x21,
- 0, 0, 0x29,
- #0, 1, 0xe7,
- #1, 1, 0x11,
-)
-
-XSTART_H = 0xf0
-XSTART_L = 0xf1
-YSTART_H = 0xf2
-YSTART_L = 0xf3
-XEND_H = 0xE0
-XEND_L = 0xE1
-YEND_H = 0xE2
-YEND_L = 0xE3
-
-XSTART = 0xD0
-XEND = 0xD1
-YSTART = 0xD2
-YEND = 0xD3
-
-lcd = LCD()
-
-init_buf = bytearray(init_data)
-
-init_data2 = (
- 0, 4, 0x2a,
- 1, 1, XSTART_H,
- 1, 1, XSTART_L,
- 1, 1, XEND_H,
- 1, 1, XEND_L,
- 0, 4, 0x2b,
- 1, 1, YSTART_H,
- 1, 1, YSTART_L,
- 1, 1, YEND_H,
- 1, 1, YEND_L,
- 0, 0, 0x2c,
-)
-invalid = bytearray(init_data2)
-
-init_data3 = (
- 0, 0, 0x28,
- 2, 0, 120,
- 0, 0, 0x10,
-)
-displayoff = bytearray(init_data3)
-
-init_data4 = (
- 0, 0, 0x11,
- 2, 0, 20,
- 0, 0, 0x29,
-)
-displayon = bytearray(init_data4)
-# CST816初始化
-import initTP
-initTP.HYN_Initial()
-tp_cst816 = cst816(i2c_no = 2,irq=33, reset=32)
-tp_cst816.activate()
-tp_cst816.init()
-
-print("cst816 init...")
-from btn_device_ec800m import BtnDevice
-btn_device = BtnDevice(tp_cst816)
-btn_device.start()
-
-lcd_ctrl = Pin(Pin.GPIO18, Pin.OUT, Pin.PULL_DISABLE, 1)
-lcd.lcd_init(init_buf, 240, 320, 52000, 1, 4, 0, invalid, displayon, displayoff, None,TESel = True,TEPin = 17)
-# gpio_backlight = Pin(Pin.GPIO37, Pin.OUT, Pin.PULL_DISABLE, 0)
-# gpio_backlight.write(1)
-PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 0, 1)
-PWM_backlight.open()
-
-LCD_SIZE_W = 240
-LCD_SIZE_H = 320
-# pwm.close()
-# 初始化lvgl
-lv.init()
-
-# Register SDL display driver.
-disp_buf1 = lv.disp_draw_buf_t()
-buf1_1 = bytearray(LCD_SIZE_W * LCD_SIZE_H * 2)
-#buf1_2= bytearray(LCD_SIZE_W * LCD_SIZE_H * 2)
-
-disp_buf1.init(buf1_1, None, len(buf1_1))
-disp_drv = lv.disp_drv_t()
-disp_drv.init()
-disp_drv.draw_buf = disp_buf1
-disp_drv.flush_cb = lcd.lcd_write
-disp_drv.hor_res = LCD_SIZE_W
-disp_drv.ver_res = LCD_SIZE_H
-disp_drv.register()
-
-
-# LVGL触摸注册
-indev_drv = lv.indev_drv_t()
-indev_drv.init()
-indev_drv.type = lv.INDEV_TYPE.POINTER
-indev_drv.read_cb = tp_cst816.read
-indev_drv.long_press_time = 400
-indev_drv.register()
-gpio4 = Pin(Pin.GPIO33, Pin.OUT, Pin.PULL_PU, 0)
-
-# def indev_task():
-# while 1:
-# pos_s = tp_cst816.read_xy()
-# # import _thread
-# # x = _thread.get_heap_size()
-# # print('heap:',x)
-# if pos_s:
-# if 100 == pos_s[0] and 400 == pos_s[1]:
-# EventMesh.publish("done_return")
-# print("return")
-# utime.sleep_ms(200)
-# else:
-# utime.sleep_ms(200)
-
-# _thread.start_new_thread(indev_task,())
-
-# 启动lvgv线程
-lv.tick_inc(5)
-lv.task_handler()
-style_screen = lv.style_t()
-style_screen.init()
-style_screen.set_radius(0)
-style_screen.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-style_screen.set_bg_opa(255)
-style_screen.set_border_width(0)
-style_screen.set_pad_left(0)
-style_screen.set_pad_right(0)
-style_screen.set_pad_top(0)
-style_screen.set_pad_bottom(0)
-#开机画面
-style_font_youyuan_40 = lv.style_t()
-style_font_youyuan_40.init()
-style_font_youyuan_40.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_40.set_text_font_v2("font_40.bin",40,0)
-
-power_on_screen = lv.obj()
-print("power_on_screen")
-power_on_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-power_on_label = lv.label(power_on_screen)
-power_on_label.set_text("WELCOME")
-power_on_label.align(lv.ALIGN.CENTER, 0, 0)
-power_on_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-print("power_on_screen init...")
-lv.scr_load(power_on_screen)
-utime.sleep_ms(200)
-print("power_on_screen end...")
-PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 6, 10)
-PWM_backlight.open()
-import sms
-
-class App(object):
- def __init__(self):
- self.managers = []
-
- def append_manager(self, manager):
- if isinstance(manager, Abstract):
- manager.post_processor_after_instantiation()
- self.managers.append(manager)
- return self
-
- def start(self):
- for manager in self.managers:
- manager.post_processor_before_initialization()
- manager.initialization()
- manager.post_processor_after_initialization()
-
-
-class watchApp(App):
- def __init__(self):
- super(watchApp, self).__init__()
- self.__ui = None
-
- def set_ui(self, ui):
- self.__ui = ui
-
- def start(self):
- if self.__ui is not None:
- self.__ui.start()
- super().start()
-
-
-
-if __name__ == '__main__':
- import uos
- import ql_fs
- import utime
- if ql_fs.path_exists("/ext") == False:
- ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",0,3)
- uos.mount(ldev,'/ext')
- res = uos.statvfs("/ext")
- res = list(res)
- print('总ext空间:{} MB,剩余空间:{} MB'.format((((res[0] * res[2]) / 1024 / 1024)),((res[0] * res[3]) / 1024 / 1024)))
- print("init1:{}".format(utime.localtime()))
- import EventMesh
- from common import Abstract
- print("init2:{}".format(utime.localtime()))
- from lcd import tp_cst816
- print("init3:{}".format(utime.localtime()))
-
- from usr.ui_main_menu import MainMenuScreen
- # from ui_WatchFaceScreen import WatchFaceScreen
-
- from appFactoryMode import FactoryModeLocationScreen,FactoryModeScreen ,FactoryModeAlipayInitScreen
- import ui as _ui
- # import ui as _ui
- print("init4:{}".format(utime.localtime()))
- ui = _ui.UI()
- ui.post_processor_after_instantiation()
- ui.add_screen(MainMenuScreen())
- EventMesh.publish("load_screen", {"screen": "main_menu"})
- print("init5:{}".format(utime.localtime()))
-
- ui.add_screen(_ui.PopupScreen())
- ui.add_screen(_ui.PhoneScreen())
- ui.add_screen(_ui.HeartrateScreen())
- import ui_setting as _ui_setting
- ui.add_screen(_ui_setting.SettingScreen())
- ui.add_screen(_ui.ToolboxScreen())
- ui.add_screen(_ui.StepScreen())
- ui.add_screen(_ui.CountdownScreen())
- ui.add_screen(_ui.StopwatchScreen())
- ui.add_screen(_ui.WeatherScreen())
- ui.add_screen(_ui.Spo2Screen())
- ui.add_screen(_ui.TemperatureScreen())
- ui.add_screen(_ui.ContactsScreen())
- from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen
- ui.add_screen(WechatScreen())
- from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
- from ui_health import HealthScreen
- ui.add_screen(ClkListScreen())
- ui.add_screen(_ui.CountdownEndScreen())
- ui.add_screen(NewEditClk())
- ui.add_screen(CLKTimeScreen())
- ui.add_screen(ClkPeriod())
-
- # ui.add_screen(_ui_setting.LanguageScreen())
- ui.add_screen(_ui_setting.DialswitchScreen())
- # ui.add_screen(_ui.ThemeswitchScreen())
- ui.add_screen(_ui_setting.ImeiScreen())
- ui.add_screen(_ui_setting.AppScreen())
- ui.add_screen(_ui_setting.BrightnessScreen())
- ui.add_screen(_ui_setting.VolumeScreen())
- ui.add_screen(_ui_setting.RestoreScreen())
- ui.add_screen(_ui_setting.PoweroffScreen())
- ui.add_screen(_ui_setting.VersionScreen())
- ui.add_screen(_ui_setting.UpdateScreen())
- ui.add_screen(_ui_setting.AlarmvolumeScreen())
- ui.add_screen(_ui_setting.MsgvolumeScreen())
- ui.add_screen(_ui_setting.PhoneringScreen())
- ui.add_screen(_ui_setting.totalvolumeScreen())
- ui.add_screen(_ui_setting.PoweroffConfirmScreen())
- ui.add_screen(_ui.DialingScreen())
- ui.add_screen(_ui.CallLogScreen())
- from appAlipay import Alipay ,AlipayOpenScreen,Alipay_1_1,Alipay_invite,Alipay_inviting,\
- Alipay_success,Alipay_paycode,Alipay_pay_success,Alipay_collect,Alipay_parent
- ui.add_screen(AlipayOpenScreen())
- ui.add_screen(Alipay_1_1())
- ui.add_screen(Alipay_invite())
- ui.add_screen(Alipay_inviting())
- ui.add_screen(Alipay_success())
- ui.add_screen(Alipay_paycode())
- ui.add_screen(Alipay_pay_success())
- ui.add_screen(Alipay_collect())
- ui.add_screen(Alipay_parent())
- ui.add_screen(_ui.UIFINDScreen())
- ui.add_screen(_ui.MsgDetailScreen())
- ui.add_screen(_ui.IncomingCallScreen())
- ui.add_screen(_ui.OnCallScreen())
- ui.add_screen(_ui.MessageFullScreen())
- # ui.add_screen(_ui.PowerOnScreen())
- ui.add_screen(FactoryModeLocationScreen())
- ui.add_screen(FactoryModeScreen())
- ui.add_screen(FactoryModeAlipayInitScreen())
- ui.add_screen(PopupAlarmScreen())
- ui.add_screen(_ui.LowPowerScreen())
- ui.add_screen(_ui.NewMessageScreen())
- ui.add_screen(NewWechatPopupScreen())
- ui.add_screen(HealthScreen())
- # ui.add_screen(_ui.Setting3Screen())
- print("init6:{}".format(utime.localtime()))
-
-
- from protocol import LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,CENTER_ProtoCol,UPLOAD_ProtoCol,\
- TEMP_ProtoCol,DLT_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,\
- ProtoColResolver,PHL_ProtoCol,MONITOR_ProtoCol,bootoff_ProtoCol,WDSTART_ProtoCol,LOWBAT_ProtoCol,sosHome_dial_ProtoCol,SockManager,NetManager
- import mgr as mgr
- print("init7:{}".format(utime.localtime()))
-
- from mgr import ConfigStoreManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
- AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
- print("init8:{}".format(utime.localtime()))
-
-
- #from ui_WatchFaceScreen import WatchFaceScreen
-
-
- # from usr.test_sms import HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,getBrightnessManager,\
- # getStorageDataManager
- print("init9:{}".format(utime.localtime()))
- #from usr.ui_wechat import WechatScreen,TK_ProtoCol
-
- print("init10:{}".format(utime.localtime()))
-
-
- app = watchApp()
- app.set_ui(ui)
- app.append_manager(mgr.AlarmVolumeLevelManager()) \
- .append_manager(mgr.MsgVolumeLevelManager()) \
- .append_manager(mgr.PhoneVolumeLevelManager()) \
- .append_manager(mgr.DeviceInfoManager()) \
- .append_manager(mgr.BatteryManager()) \
-
- # .append_manager(mgr.StopwatchManager()) \
- # .append_manager(mgr.CountdownManager()) \
-
- app.append_manager(Alipay())
- app.append_manager(ConfigStoreManager())
- app.append_manager(NetManager())
- app.append_manager(LocationManager())
- app.append_manager(AddrBookManager())
- app.append_manager(mgr.MsgManager())
- app.append_manager(MsgdetailManager())
- app.append_manager(mgr.CallLogManager())
- app.append_manager(mgr.getWeatherDataManager())
- app.append_manager(PhoneCallingManager())
- app.append_manager(ClockManager())
- app.append_manager(gethistoryDataManager())
- app.append_manager(getHrTimeManager())
- app.append_manager(getBrightnessManager())
- app.append_manager(getStorageDataManager())
- app.append_manager(getUpLoadDataManager())
- app.append_manager(getVolumSizeManager())
- app.append_manager(getTempTimeManager())
- app.append_manager(getplayAudiodStateManager())
- app.append_manager(getLowBatManager())
- app.append_manager(getBootOffManager())
- app.append_manager(getOldTimeManager())
- app.append_manager(getSosFlagManager())
- app.append_manager(CountdownManager())
-
- print("init21:{}".format(utime.localtime()))
-
- print("init11:{}".format(utime.localtime()))
- pcr = ProtoColResolver()
- pcr.add_support(LK_ProtoCol())
- pcr.add_support(PING_ProtoCol())
- pcr.add_support(KA_ProtoCol())
- pcr.add_support(UD_ProtoCol())
- pcr.add_support(CR_ProtoCol())
- pcr.add_support(FIND_ProtoCol())
- pcr.add_support(POWEROFF_ProtoCol())
- pcr.add_support(PHL_ProtoCol())
- pcr.add_support(TK_ProtoCol())
- pcr.add_support(MESSAGE_ProtoCol())
- pcr.add_support(WT_ProtoCol())
- pcr.add_support(REMIND_ProtoCol())
- pcr.add_support(HRSTART_ProtoCol())
- pcr.add_support(HEART_ProtoCol())
- pcr.add_support(OXYGEN_ProtoCol())
- pcr.add_support(OXYGEN_One_ProtoCol())
- pcr.add_support(TEMP_ProtoCol())
- pcr.add_support(DLT_ProtoCol())
- pcr.add_support(UPLOAD_ProtoCol())
- pcr.add_support(MONITOR_ProtoCol())
- # pcr.add_support(CENTER_ProtoCol())
- pcr.add_support(CENTER_ProtoCol())
- pcr.add_support(bootoff_ProtoCol())
- pcr.add_support(WDSTART_ProtoCol())
- pcr.add_support(LOWBAT_ProtoCol())
- pcr.add_support(sosHome_dial_ProtoCol())
-
- sm = SockManager()
- sm.add_support_resolver(pcr)
- app.append_manager(sm)
- print("init11.0:{}".format(utime.localtime()))
- app.start()
- sms_data = sms.getSaveLoc()
- sms_lacv = sms_data[0][0]
- if sms_lacv != 'SM':#每次开机设置一下短信的存储位置
- sms.setSaveLoc('SM', 'SM', 'SM')
- print("init12:{}".format(utime.localtime()))
- import atcmd
- resp=bytearray(50)
- atcmd.sendSync('AT+log=52,1\r\n',resp,'',20)
- print("AT+log=52,1:{}".format(resp))
-
-
+#import main_init
+from usr.main_init import main_init
+print("main !!!!!!!")
+main_init()
\ No newline at end of file
import uos
import ql_fs
import utime
- if ql_fs.path_exists("/ext") == False:
- ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",0,3)
- uos.mount(ldev,'/ext')
- res = uos.statvfs("/ext")
+
+ res = uos.statvfs("/usr")
res = list(res)
- print('总ext空间:{} MB,剩余空间:{} MB'.format((((res[0] * res[2]) / 1024 / 1024)),((res[0] * res[3]) / 1024 / 1024)))
+ print('总usr空间:{} MB,剩余空间:{} MB'.format((((res[0] * res[2]) / 1024 / 1024)),((res[0] * res[3]) / 1024 / 1024)))
print("init1:{}".format(utime.localtime()))
import EventMesh
-
+ from btn_device_ec800m import BtnDevice
+ btn_device = BtnDevice()
+ btn_device.start()
print("init2:{}".format(utime.localtime()))
- from lcd import tp_cst816
print("init3:{}".format(utime.localtime()))
-
- from ui_main_menu import MainMenuScreen
- # from ui_WatchFaceScreen import WatchFaceScreen
- from appFactoryMode import FactoryModeLocationScreen,FactoryModeScreen ,FactoryModeAlipayInitScreen,FactoryModeBatTestScreen
import ui as _ui
# import ui as _ui
print("init4:{}".format(utime.localtime()))
ui = _ui.UI()
ui.post_processor_after_instantiation()
- ui.add_screen(_ui.SystemInitScreen())
- EventMesh.publish("load_screen", {"screen": "system_init"})
- print("init5:{}".format(utime.localtime()))
- ui.add_screen(MainMenuScreen())
- ui.add_screen(_ui.PopupScreen())
- ui.add_screen(_ui.PhoneScreen())
- ui.add_screen(_ui.HeartrateScreen())
- import ui_setting as _ui_setting
- ui.add_screen(_ui_setting.SettingScreen())
- ui.add_screen(_ui.ToolboxScreen())
- ui.add_screen(_ui.StepScreen())
- ui.add_screen(_ui.CountdownScreen())
- ui.add_screen(_ui.StopwatchScreen())
- ui.add_screen(_ui.WeatherScreen())
- ui.add_screen(_ui.Spo2Screen())
- ui.add_screen(_ui.TemperatureScreen())
- ui.add_screen(_ui.ContactsScreen())
- from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen
- ui.add_screen(WechatScreen())
- from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
- from ui_health import HealthScreen
- ui.add_screen(ClkListScreen())
- ui.add_screen(_ui.CountdownEndScreen())
- ui.add_screen(NewEditClk())
- ui.add_screen(CLKTimeScreen())
- ui.add_screen(ClkPeriod())
-
- # ui.add_screen(_ui_setting.LanguageScreen())
- ui.add_screen(_ui_setting.DialswitchScreen())
- # ui.add_screen(_ui.ThemeswitchScreen())
- ui.add_screen(_ui_setting.ImeiScreen())
- ui.add_screen(_ui_setting.AppScreen())
- ui.add_screen(_ui_setting.BrightnessScreen())
- ui.add_screen(_ui_setting.VolumeScreen())
- ui.add_screen(_ui_setting.RestoreScreen())
- ui.add_screen(_ui_setting.PoweroffScreen())
- ui.add_screen(_ui_setting.VersionScreen())
- ui.add_screen(_ui_setting.UpdateScreen())
- ui.add_screen(_ui_setting.AlarmvolumeScreen())
- ui.add_screen(_ui_setting.MsgvolumeScreen())
- ui.add_screen(_ui_setting.PhoneringScreen())
- ui.add_screen(_ui_setting.totalvolumeScreen())
- ui.add_screen(_ui_setting.PoweroffConfirmScreen())
- ui.add_screen(_ui.DialingScreen())
- ui.add_screen(_ui.CallLogScreen())
- from appAlipay import Alipay ,AlipayOpenScreen,Alipay_1_1,Alipay_invite,Alipay_inviting,\
- Alipay_success,Alipay_paycode,Alipay_pay_success,Alipay_collect,Alipay_parent
- ui.add_screen(AlipayOpenScreen())
- ui.add_screen(Alipay_1_1())
- ui.add_screen(Alipay_invite())
- ui.add_screen(Alipay_inviting())
- ui.add_screen(Alipay_success())
- ui.add_screen(Alipay_paycode())
- ui.add_screen(Alipay_pay_success())
- ui.add_screen(Alipay_collect())
- ui.add_screen(Alipay_parent())
- ui.add_screen(_ui.UIFINDScreen())
- ui.add_screen(_ui.MsgDetailScreen())
- ui.add_screen(_ui.IncomingCallScreen())
- ui.add_screen(_ui.OnCallScreen())
- ui.add_screen(_ui.MessageFullScreen())
- # ui.add_screen(_ui.PowerOnScreen())
- ui.add_screen(FactoryModeLocationScreen())
- ui.add_screen(FactoryModeScreen())
- ui.add_screen(FactoryModeAlipayInitScreen())
- ui.add_screen(FactoryModeBatTestScreen())
- ui.add_screen(PopupAlarmScreen())
- ui.add_screen(_ui.LowPowerScreen())
- ui.add_screen(_ui.NewMessageScreen())
- ui.add_screen(_ui.sosScreen())
- ui.add_screen(_ui.noSosDataScreen())
- ui.add_screen(_ui.NoSimScreen())
- ui.add_screen(_ui.NoSimPowerScreen())
- ui.add_screen(_ui.DialingNoPlayPopupScreen())
- ui.add_screen(_ui.NovaliedNumScreen())
- ui.add_screen(_ui.DialNoconnectPopupScreen())
- ui.add_screen(NewWechatPopupScreen())
- ui.add_screen(HealthScreen())
- # ui.add_screen(_ui.Setting3Screen())
+ # ui.add_screen(_ui.SystemInitScreen())
+ # print("init5:{}".format(utime.localtime()))
+ # ui.add_screen(_ui.PopupScreen())
+ # ui.add_screen(_ui.PhoneScreen())
+ # ui.add_screen(_ui.HeartrateScreen())
+ # ui.add_screen(_ui.ToolboxScreen())
+ # ui.add_screen(_ui.StepScreen())
+ # ui.add_screen(_ui.CountdownScreen())
+ # ui.add_screen(_ui.StopwatchScreen())
+ # ui.add_screen(_ui.WeatherScreen())
+ # ui.add_screen(_ui.Spo2Screen())
+ # ui.add_screen(_ui.TemperatureScreen())
+ # ui.add_screen(_ui.ContactsScreen())
+ # print("init5.1:{}".format(utime.localtime()))
+ # from appWechat import WechatScreen,TK_ProtoCol,MESSAGE_ProtoCol,NewWechatPopupScreen
+ # ui.add_screen(WechatScreen())
+ # #from alarm import ClkListScreen,ClockManager,NewEditClk,CLKTimeScreen,ClkPeriod,PopupAlarmScreen
+ # # ui.add_screen(ClkListScreen())
+
+ # # ui.add_screen(NewEditClk())
+ # # ui.add_screen(CLKTimeScreen())
+ # # ui.add_screen(ClkPeriod())
+ # # ui.add_screen(PopupAlarmScreen())
+
+ # ui.add_screen(_ui.CountdownEndScreen())
+ # ui.add_screen(_ui.DialingScreen())
+ # ui.add_screen(_ui.CallLogScreen())
+ # print("init5.10:{}".format(utime.localtime()))
+ # ui.add_screen(_ui.UIFINDScreen())
+ # ui.add_screen(_ui.MsgDetailScreen())
+ # print("init5.11:{}".format(utime.localtime()))
+ # ui.add_screen(_ui.IncomingCallScreen())
+ # ui.add_screen(_ui.OnCallScreen())
+ # ui.add_screen(_ui.MessageFullScreen())
+ # # ui.add_screen(_ui.PowerOnScreen())
+ # print("init5.2:{}".format(utime.localtime()))
+ # ui.add_screen(_ui.LowPowerScreen())
+ # ui.add_screen(_ui.NewMessageScreen())
+ # ui.add_screen(_ui.sosScreen())
+ # ui.add_screen(_ui.noSosDataScreen())
+ # ui.add_screen(_ui.NoSimScreen())
+ # ui.add_screen(_ui.NoSimPowerScreen())
+ # ui.add_screen(_ui.DialingNoPlayPopupScreen())
+ # ui.add_screen(_ui.NovaliedNumScreen())
+ # ui.add_screen(_ui.DialNoconnectPopupScreen())
+ # ui.add_screen(NewWechatPopupScreen())
+ # # ui.add_screen(_ui.Setting3Screen())
print("init6:{}".format(utime.localtime()))
-
+ from alarm import ClockManager
from protocol import LK_ProtoCol,PING_ProtoCol,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,HRSTART_ProtoCol,CENTER_ProtoCol,UPLOAD_ProtoCol,\
TEMP_ProtoCol,DLT_ProtoCol,WT_ProtoCol,UD_ProtoCol,REMIND_ProtoCol, CR_ProtoCol,KA_ProtoCol,FIND_ProtoCol,POWEROFF_ProtoCol,Time_ProtoCol,\
ProtoColResolver,PHL_ProtoCol,MONITOR_ProtoCol,bootoff_ProtoCol,WDSTART_ProtoCol,LOWBAT_ProtoCol,sosHome_dial_ProtoCol,SockManager,NetManager
from mgr import ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
print("init8:{}".format(utime.localtime()))
-
-
- #from ui_WatchFaceScreen import WatchFaceScreen
+
# from usr.test_sms import HRSTART_ProtoCol,getHrTimeManager,HEART_ProtoCol,OXYGEN_ProtoCol,OXYGEN_One_ProtoCol,getBrightnessManager,\
# .append_manager(mgr.StopwatchManager()) \
# .append_manager(mgr.CountdownManager()) \
- app.append_manager(Alipay())
app.append_manager(ConfigStoreManager())
app.append_manager(NetManager())
app.append_manager(LocationManager())
"""
def __init__(self):
- self.file_name = "/ext/conf_store.json"
+ self.file_name = "/usr/conf_store.json"
self.lock = Lock()
self.map = dict()
if temp <= 3505:
vbat = 0
elif temp <= 3699:
- vbat = 20 #"E:/vbat_20.jpg"
+ vbat = 20 #"U:/vbat_20.jpg"
elif temp <= 3772:
- vbat = 40 #"E:/vbat_40.jpg"
+ vbat = 40 #"U:/vbat_40.jpg"
elif temp <= 3882:
- vbat = 60 #"E:/vbat_60.jpg"
+ vbat = 60 #"U:/vbat_60.jpg"
elif temp <= 4070:
- vbat = 80 #"E:/vbat_80.jpg"
+ vbat = 80 #"U:/vbat_80.jpg"
else:
- vbat = 100 #"E:/vbat_100.jpg"
+ vbat = 100 #"U:/vbat_100.jpg"
result = [charge_state, vbat]
def __init__(self):
self.read_phonebook = {}
self.check_json = 0
- self.check_json = ql_fs.path_exists("/ext/static/storage_file/phonebook.json")
+ self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json")
if self.check_json == True:
- with open("/ext/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/phonebook.json","r",encoding="utf-8") as fd:
self.read_phonebook = ujson.load(fd)
print("读取电话本")
EventMesh.subscribe("set_phonebook_list", self.set)
def get(self, event, msg):
- self.check_json = ql_fs.path_exists("/ext/static/storage_file/phonebook.json")
+ self.check_json = ql_fs.path_exists("/usr/static/storage_file/phonebook.json")
return [self.check_json,self.read_phonebook]
def set(self, event, msg):
# 通话记录
def __init__(self):
self.read_call_log = {}
- self.check_json = ql_fs.path_exists("/ext/static/storage_file/Call_log.json")
+ self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json")
if self.check_json == True:
- with open("/ext/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/Call_log.json","r",encoding="utf-8") as fd:
self.read_call_log = ujson.load(fd)
print("读取通话记录")
EventMesh.subscribe("set_call_log_list", self.set)
def get(self, event, msg):
- self.check_json = ql_fs.path_exists("/ext/static/storage_file/Call_log.json")
+ self.check_json = ql_fs.path_exists("/usr/static/storage_file/Call_log.json")
return [self.check_json,self.read_call_log]
def set(self, event, msg):
self.read_histroy_hr_data = {}
self.read_histroy_temp_data = {}
self.read_histroy_spo2_data = {}
- check_json= ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check_json= ql_fs.path_exists("/usr/static/storage_file/config.json")
if check_json == True :
- with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("old_hr") in self.read_data.keys()
self.oldHr = 0
self.oldspo2 = 0
self.oldstep = 0
- check_hr= ql_fs.path_exists("/ext/static/storage_file/history_hr.json")
+ check_hr= ql_fs.path_exists("/usr/static/storage_file/history_hr.json")
if check_hr == True :
- with open("/ext/static/storage_file/history_hr.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/history_hr.json","r") as fd:#音频文件编号
self.read_histroy_hr_data = ujson.load(fd)
- check_temp= ql_fs.path_exists("/ext/static/storage_file/history_temp.json")
+ check_temp= ql_fs.path_exists("/usr/static/storage_file/history_temp.json")
if check_temp == True :
- with open("/ext/static/storage_file/history_temp.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/history_temp.json","r") as fd:#音频文件编号
self.read_histroy_temp_data = ujson.load(fd)
- check_spo2= ql_fs.path_exists("/ext/static/storage_file/history_spo2.json")
+ check_spo2= ql_fs.path_exists("/usr/static/storage_file/history_spo2.json")
if check_spo2 == True :
- with open("/ext/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/history_spo2.json","r") as fd:#音频文件编号
self.read_histroy_spo2_data = ujson.load(fd)
def post_processor_after_instantiation(self):
self.read_histroy_spo2_data["07"] = msg
else:
self.read_histroy_spo2_data["0{}".format(count+1)] = msg
- with open("/ext/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/history_spo2.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_histroy_spo2_data,fd)
self.read_histroy_temp_data["07"] = msg
else:
self.read_histroy_temp_data["0{}".format(count+1)] = msg
- with open("/ext/static/storage_file/history_temp.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/history_temp.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_histroy_temp_data,fd)
self.read_histroy_hr_data["07"] = msg
else:
self.read_histroy_hr_data["0{}".format(count+1)] = msg
- with open("/ext/static/storage_file/history_hr.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/history_hr.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_histroy_hr_data,fd)
def save_hr_value(self, event, msg):
self.read_data["old_hr"] = msg
EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
self.oldHr = msg
self.read_data["old_spo2"] = msg
EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
self.oldspo2 = msg
def __init__(self):
self.time_sec = 0
self.read_data = {}
- check_json= ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check_json= ql_fs.path_exists("/usr/static/storage_file/config.json")
if check_json == True :
- with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("old_time") in self.read_data.keys()
self.read_data = EventMesh.publish("get_storage_data")
self.read_data["old_time"] = msg
EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
self.set_hr = 0 #0关闭 1手动 2 自动测量按照时间间隔测试心率
self.set_spo2 = 0
self.get_temp = 0
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("measure_time") in self.read_data.keys()
def __init__(self):
self.set_time = 0
self.get_temp = 0
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("temp_time") in self.read_data.keys()
self.read_data = {}
self.time = 5
self.PWM_backlight = None
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
def post_processor_after_instantiation(self):
self.read_data["brightness_level"] = self.level
EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
def reduce(self, event, msg):
self.read_data = EventMesh.publish("get_storage_data")
self.read_data["brightness_level"] = self.level
EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
class getStorageDataManager(Abstract):#获取内存数据
def __init__(self):
self.read_data = {}
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
def post_processor_after_instantiation(self):
class getUpLoadDataManager(Abstract):#
def __init__(self):
self.upload_time = 1800
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("upload_time") in self.read_data.keys()
def __init__(self):
self.volume_size = 8
self.read_data = {}
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("volum") in self.read_data.keys()
self.sos_numer1 = []
self.callnumer =""
self.read_data = {}
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b1 = str("SOS_NUMBER1") in self.read_data.keys()
def __init__(self):
self.read_data = {}
self.low_btn = 0
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b1 = str("low_on") in self.read_data.keys()
self.off_msg = {}
self.off_flag = 0
self.rtc = RTC()
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b1 = str("off_on") in self.read_data.keys()
read_data["off_on"] = msg[0]
read_data["off_start"] = msg[1]
read_data["off_end"] = msg[2]
- with open("/ext/static/storage_file/config.json", 'w+',encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/config.json", 'w+',encoding='utf-8') as fd:
ujson.dump(read_data,fd)
self.off_msg = msg
# print("read_data:{} self.off_msg:{}".format(read_data,self.off_msg))
read_data["old_step"] = step
read_data["old_step_new"] = step+10
EventMesh.publish("set_storage_data", read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(read_data,fd)
old_step = step
read_data["old_step"] = step
read_data["old_step_new"] = step
EventMesh.publish("set_storage_data", read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(read_data,fd)
old_step = step
# step = str(EventMesh.publish(constants.EVENT.GET_STEP)[0])
# a = audio.Audio(0)
# a.set_pa(Pin.GPIO29)
# a.setVolume(10)
- # a.play(1, 1, 'E:/audio_audio_haixiu.mp3') #文件名前面要加上路径
+ # a.play(1, 1, 'U:/audio_audio_haixiu.mp3') #文件名前面要加上路径
EventMesh.publish("load_screen", {"screen": "FIND"})
#print("FIND_ProtoCol:recv:%s"%(msg))
phonebook_oldtmp = phonebook_tmp
# print("phonebook_oldtmp!!!:{}".format(str(phonebook_oldtmp)))
# print("phonebook!!!:{}".format(str(phonebook)))
- with open("/ext/static/storage_file/phonebook.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/phonebook.json","w",encoding="utf-8") as fd:
ujson.dump(phonebook,fd)
print("创建电话簿")
alarm_new[j] = {"idx": j, "hour": alarm_time_hour, "minute": alarm_time_min, "days":alarm_day, "enabled": alarm_switch,"repeart":alarm_day_num}
# print("self.alarm_list: {}".format(alarm_new))
- with open("/ext/static/storage_file/alarm_msg.json", 'w',encoding='utf-8') as fd:
+ with open("/usr/static/storage_file/alarm_msg.json", 'w',encoding='utf-8') as fd:
ujson.dump(alarm_new,fd)
EventMesh.publish("push_update_alarm_show")
storage_tmp = EventMesh.publish("get_storage_data")
storage_tmp["measure_time"] = hrTotal
EventMesh.publish("set_storage_data", storage_tmp)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(storage_tmp,fd)
EventMesh.publish("set_time_hr_spo2",hrTotal)
EventMesh.publish("set_storage_data", storage_tmp)
EventMesh.publish("set_temp_time",tempTotal)
print("storage_tmp:{}".format(storage_tmp))
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(storage_tmp,fd)
EventMesh.publish(constants.PROTOCOL.WDSTART_SEND)
storage_tmp["upload_time"] = upload_time
EventMesh.publish("set_storage_data", storage_tmp)
EventMesh.publish("set_upload_data", upload_time)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(storage_tmp,fd)
EventMesh.publish(constants.PROTOCOL.UPLOAD_SEND)
storage_tmp = EventMesh.publish("get_storage_data")
storage_tmp["center_dial"] = center_dial
EventMesh.publish("set_storage_data", storage_tmp)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(storage_tmp,fd)
EventMesh.publish(constants.PROTOCOL.CENTER_SEND)
if (len(msg_tmp)-1) != 0:
EventMesh.publish("set_storage_data",read_data)
# print("read_data:{}".format(read_data))
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(read_data,fd)
EventMesh.publish(constants.PROTOCOL.SOS_SEND)
read_data["low_on"] = on_bt
EventMesh.publish("set_storage_data",read_data)
EventMesh.publish("set_low_bat_btn",on_bt)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(read_data,fd)
EventMesh.publish(constants.PROTOCOL.LOWBAT_SEND)
import audio
import sms
from machine import Pin
-from lcd import lcd,lcd_ctrl,tp_cst816
-from misc import PWM
import uos
import gc
import _thread
def done_error(self):
pass
+
+ def lcd_off(self):
+ pass
+
+ def lcd_on(self):
+ pass
+
def handle_message_event(self,data):
pass
def publish_message_event(self,data):
phone_label.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0)
phone_one = lv.img(phone_screen)
- phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png")
+ phone_one.set_src("U:/static/IMAGE_NUMBER_KEY1_ICON.png")
phone_one.add_flag(lv.obj.FLAG.CLICKABLE)
phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_one.set_pos(3, 60)
phone_two = lv.img(phone_screen)
phone_two.set_size(76, 50)
- phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png")
+ phone_two.set_src("U:/static/IMAGE_NUMBER_KEY2_ICON.png")
phone_two.add_flag(lv.obj.FLAG.CLICKABLE)
phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_two.set_pos(82, 60)
phone_three = lv.img(phone_screen)
phone_three.set_size(76, 50)
- phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png")
+ phone_three.set_src("U:/static/IMAGE_NUMBER_KEY3_ICON.png")
phone_three.add_flag(lv.obj.FLAG.CLICKABLE)
phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_three.set_pos(161, 60)
phone_four = lv.img(phone_screen)
phone_four.set_size(76, 50)
- phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png")
+ phone_four.set_src("U:/static/IMAGE_NUMBER_KEY4_ICON.png")
phone_four.add_flag(lv.obj.FLAG.CLICKABLE)
phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_four.set_pos(3, 112)
phone_five = lv.img(phone_screen)
phone_five.set_size(76, 50)
- phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png")
+ phone_five.set_src("U:/static/IMAGE_NUMBER_KEY5_ICON.png")
phone_five.add_flag(lv.obj.FLAG.CLICKABLE)
phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_five.set_pos(82, 112)
phone_six = lv.img(phone_screen)
phone_six.set_size(76, 50)
- phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png")
+ phone_six.set_src("U:/static/IMAGE_NUMBER_KEY6_ICON.png")
phone_six.add_flag(lv.obj.FLAG.CLICKABLE)
phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_six.set_pos(161, 112)
phone_seven = lv.img(phone_screen)
phone_seven.set_size(76, 50)
- phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png")
+ phone_seven.set_src("U:/static/IMAGE_NUMBER_KEY7_ICON.png")
phone_seven.add_flag(lv.obj.FLAG.CLICKABLE)
phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_seven.set_pos(3, 164)
phone_eight = lv.img(phone_screen)
phone_eight.set_size(76, 50)
- phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png")
+ phone_eight.set_src("U:/static/IMAGE_NUMBER_KEY8_ICON.png")
phone_eight.add_flag(lv.obj.FLAG.CLICKABLE)
phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_eight.set_pos(82, 164)
phone_nine = lv.img(phone_screen)
phone_nine.set_size(76, 50)
- phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png")
+ phone_nine.set_src("U:/static/IMAGE_NUMBER_KEY9_ICON.png")
phone_nine.add_flag(lv.obj.FLAG.CLICKABLE)
phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_nine.set_pos(161, 164)
phone_start = lv.img(phone_screen)
phone_start.set_size(76, 50)
- phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png")
+ phone_start.set_src("U:/static/IMAGE_NUMBER_KEYSTAR_ICON.png")
phone_start.add_flag(lv.obj.FLAG.CLICKABLE)
phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_start.set_pos(3, 216)
phone_zero = lv.img(phone_screen)
phone_zero.set_size(76, 50)
- phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png")
+ phone_zero.set_src("U:/static/IMAGE_NUMBER_KEY0_ICON.png")
phone_zero.add_flag(lv.obj.FLAG.CLICKABLE)
phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_zero.set_pos(82, 216)
phone_hash = lv.img(phone_screen)
phone_hash.set_size(76, 50)
- phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png")
+ phone_hash.set_src("U:/static/IMAGE_NUMBER_KEYHASH_ICON.png")
phone_hash.add_flag(lv.obj.FLAG.CLICKABLE)
phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_hash.set_pos(161, 216)
phone_call = lv.img(phone_screen)
phone_call.set_size(76, 50)
- phone_call.set_src("E:/static/IMAGE_BUTTON_DIAL.png")
+ phone_call.set_src("U:/static/IMAGE_BUTTON_DIAL.png")
phone_call.add_flag(lv.obj.FLAG.CLICKABLE)
phone_call.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_call.set_pos(3, 270)
phone_contact = lv.img(phone_screen)
phone_contact.set_size(64, 50)
- phone_contact.set_src("E:/static/IMAGE_BUTTON_DIAL_CONTACT.png")
+ phone_contact.set_src("U:/static/IMAGE_BUTTON_DIAL_CONTACT.png")
phone_contact.add_flag(lv.obj.FLAG.CLICKABLE)
phone_contact.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_contact.set_pos(87, 270)
phone_delete = lv.img(phone_screen)
phone_delete.set_size(76, 50)
- phone_delete.set_src("E:/static/IMAGE_BUTTON_DELKEY.png")
+ phone_delete.set_src("U:/static/IMAGE_BUTTON_DELKEY.png")
phone_delete.add_flag(lv.obj.FLAG.CLICKABLE)
phone_delete.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
phone_delete.set_pos(161, 270)
dialing_img = lv.img(dialing_screen)
dialing_img.set_pos(80, 20)
dialing_img.set_size(64, 64)
- dialing_img.set_src("E:/static/IMAGE_NOTICE_CALL.png")
+ dialing_img.set_src("U:/static/IMAGE_NOTICE_CALL.png")
dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
dialing_name = lv.label(dialing_screen)
hangup_imgbtn = lv.img(dialing_screen)
hangup_imgbtn.set_size(64, 64)
- hangup_imgbtn.set_src("E:/static/hang_up.png")
+ hangup_imgbtn.set_src("U:/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, 250)
tmp["number"] = content
self.read_call_log[content] = tmp
- with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_call_log,fd)
print("创建通话记录")
EventMesh.publish("set_call_log_list", [1,self.read_call_log])
no_sim_power_screen_img.set_pos(100, 70)
no_sim_power_screen_img.set_size(61, 61)
no_sim_power_screen_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
- no_sim_power_screen_img.set_src("E:/static/poweroff_icon.png")
+ no_sim_power_screen_img.set_src("U:/static/poweroff_icon.png")
no_sim_power_screen_label = lv.label(no_sim_power_screen)
no_sim_power_screen_comfirm = lv.img(no_sim_power_screen)
no_sim_power_screen_comfirm.set_size(176, 46)
no_sim_power_screen_comfirm.set_pos(32, 190)
- no_sim_power_screen_comfirm.set_src("E:/static/off_icon.png")
+ no_sim_power_screen_comfirm.set_src("U:/static/off_icon.png")
no_sim_power_screen_comfirm.add_flag(lv.obj.FLAG.CLICKABLE)
no_sim_power_screen_comfirm.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
no_sim_power_screen_cancel = lv.img(no_sim_power_screen)
no_sim_power_screen_cancel.set_size(176, 46)
no_sim_power_screen_cancel.set_pos(32, 250)
- no_sim_power_screen_cancel.set_src("E:/static/cancel_icon.png")
+ no_sim_power_screen_cancel.set_src("U:/static/cancel_icon.png")
no_sim_power_screen_cancel.add_flag(lv.obj.FLAG.CLICKABLE)
no_sim_power_screen_cancel.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
poweroff_return_label = lv.label(no_sim_power_screen_cancel)
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.set_src("U:/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_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.set_src("U:/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)
msg_list_t_done_img = lv.img(msg_cont_list_screen)
msg_list_t_done_img.set_pos(53, 20)
msg_list_t_done_img.set_size(134, 117)
- msg_list_t_done_img.set_src("E:/static/IMAGE_NOTICE_NONE.png")
+ msg_list_t_done_img.set_src("U:/static/IMAGE_NOTICE_NONE.png")
msg_list_t_done_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
no_msg_text = lv.label(msg_cont_list_screen)
heartrate_line_bg_img = lv.img(heartrate_screen)
heartrate_line_bg_img.set_pos(5, 60)
heartrate_line_bg_img.set_size(230, 120)
- heartrate_line_bg_img.set_src("E:/static/hr_line_bg.png")
+ heartrate_line_bg_img.set_src("U:/static/hr_line_bg.png")
heartrate_done_img = lv.img(heartrate_screen)
heartrate_done_img.set_pos(20, 249)
- heartrate_done_img.set_src("E:/static/hr_gif_03.png")
+ heartrate_done_img.set_src("U:/static/hr_gif_03.png")
heartrate_reset_btn_img = lv.img(heartrate_screen)
heartrate_reset_btn_img.set_pos(0, 192)
- heartrate_reset_btn_img.set_src("E:/static/reset_hr_btn.png")
+ heartrate_reset_btn_img.set_src("U:/static/reset_hr_btn.png")
heartrate_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN)
heartrate_reset_btn_img.add_flag(lv.obj.FLAG.CLICKABLE)
if self.point%4 == 0 :
heartrate_start_label.set_text("正在测量中..")
- heartrate_done_img.set_src("E:/static/hr_gif_02.png")
+ heartrate_done_img.set_src("U:/static/hr_gif_02.png")
if self.point%4 == 1 :
heartrate_start_label.set_text("正在测量中...")
- heartrate_done_img.set_src("E:/static/hr_gif_01.png")
+ heartrate_done_img.set_src("U:/static/hr_gif_01.png")
if self.point%4 == 2 :
heartrate_start_label.set_text("正在测量中.")
- heartrate_done_img.set_src("E:/static/hr_gif_02.png")
+ heartrate_done_img.set_src("U:/static/hr_gif_02.png")
if self.point%4 == 3 :
heartrate_start_label.set_text("正在测量中.")
- heartrate_done_img.set_src("E:/static/hr_gif_03.png")
+ heartrate_done_img.set_src("U:/static/hr_gif_03.png")
if self.point > 120: #测20s
- heartrate_done_img.set_src("E:/static/hr_gif_03.png")
+ heartrate_done_img.set_src("U:/static/hr_gif_03.png")
self.heart_value = EventMesh.publish(constants.EVENT.GET_HEART)
if self.heart_value > 50:
EventMesh.publish("set_old_hr_data",self.heart_value)
toolbox_text_img = lv.img(toolbox_screen)
toolbox_text_img.set_pos(75, 10)
toolbox_text_img.set_size(90, 30)
- toolbox_text_img.set_src("E:/static/tool/tool_text.png")
+ toolbox_text_img.set_src("U:/static/tool/tool_text.png")
toolbox_text_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
toolbox_cont = lv.obj(toolbox_screen)
toolbox_step_img.set_pos(4, tool_set_y)
toolbox_step_img.set_size(232, 80)
toolbox_step_img.add_flag(lv.obj.FLAG.CLICKABLE)
- toolbox_step_img.set_src("E:/static/tool/IMAGE_SECMENU_STEP.png")
+ toolbox_step_img.set_src("U:/static/tool/IMAGE_SECMENU_STEP.png")
toolbox_step_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
tool_set_y+=90
toolbox_weather_img.set_pos(4, tool_set_y)
toolbox_weather_img.set_size(232, 80)
toolbox_weather_img.add_flag(lv.obj.FLAG.CLICKABLE)
- toolbox_weather_img.set_src("E:/static/tool/IMAGE_SECMENU_WEATHER.png")
+ toolbox_weather_img.set_src("U:/static/tool/IMAGE_SECMENU_WEATHER.png")
toolbox_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
tool_set_y+=90
toolbox_alarm_img.set_pos(4, tool_set_y)
toolbox_alarm_img.set_size(232, 80)
toolbox_alarm_img.add_flag(lv.obj.FLAG.CLICKABLE)
- toolbox_alarm_img.set_src("E:/static/tool/IMAGE_SECMENU_ALARM.png")
+ toolbox_alarm_img.set_src("U:/static/tool/IMAGE_SECMENU_ALARM.png")
toolbox_alarm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
# toolbox_sms_img.set_pos(4, tool_set_y)
# toolbox_sms_img.set_size(232, 80)
# toolbox_sms_img.add_flag(lv.obj.FLAG.CLICKABLE)
- # toolbox_sms_img.set_src("E:/static/tool/sms_setting.png")
+ # toolbox_sms_img.set_src("U:/static/tool/sms_setting.png")
# toolbox_sms_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
tool_set_y+=90
toolbox_countdown_img.set_pos(4, tool_set_y)
toolbox_countdown_img.set_size(232, 80)
toolbox_countdown_img.add_flag(lv.obj.FLAG.CLICKABLE)
- toolbox_countdown_img.set_src("E:/static/tool/IMAGE_SECMENU_COUNTDOWN.png")
+ toolbox_countdown_img.set_src("U:/static/tool/IMAGE_SECMENU_COUNTDOWN.png")
toolbox_countdown_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
tool_set_y+=90
toolbox_stopwatch_img.set_pos(4, tool_set_y)
toolbox_stopwatch_img.set_size(232, 80)
toolbox_stopwatch_img.add_flag(lv.obj.FLAG.CLICKABLE)
- toolbox_stopwatch_img.set_src("E:/static/tool/IMAGE_SECMENU_STOPWATCH.png")
+ toolbox_stopwatch_img.set_src("U:/static/tool/IMAGE_SECMENU_STOPWATCH.png")
toolbox_stopwatch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
toolbox_step_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "step"})), lv.EVENT.CLICKED, None)
self.CALL_LOG_MAX = CALL_LOG_MAX
self.read_data = {}
self.volum_size = 8
- check_volum = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check_volum == True :
- with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("volum") in self.read_data.keys()
incoming_call_img = lv.img(incoming_call_screen)
incoming_call_img.set_pos(80, 20)
incoming_call_img.set_size(64, 64)
- incoming_call_img.set_src("E:/static/IMAGE_NOTICE_CALL.png")
+ incoming_call_img.set_src("U:/static/IMAGE_NOTICE_CALL.png")
incoming_call_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
incoming_call_name_label = lv.label(incoming_call_screen)
incoming_call_answer.add_flag(lv.obj.FLAG.CLICKABLE)
incoming_call_answer.set_pos(30, 220)
incoming_call_answer.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
- incoming_call_answer.set_src("E:/static/answer.png")
+ incoming_call_answer.set_src("U:/static/answer.png")
incoming_call_hangup = lv.img(incoming_call_screen)
incoming_call_hangup.set_size(64, 64)
incoming_call_hangup.add_flag(lv.obj.FLAG.CLICKABLE)
incoming_call_hangup.set_pos(150, 220)
incoming_call_hangup.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
- incoming_call_hangup.set_src("E:/static/hang_up.png")
+ incoming_call_hangup.set_src("U:/static/hang_up.png")
incoming_call_answer.add_event_cb(lambda e: EventMesh.callback_wrapper(self.answer(e)),
lv.EVENT.CLICKED, None)
incoming_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)),
tmp["number"] = self.meta_info
self.read_call_log[self.meta_info] = tmp
- with open("/ext/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/Call_log.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_call_log,fd)
print("创建通话记录")
EventMesh.publish("set_call_log_list", [1,self.read_call_log])
on_call_volum_reduce.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_volum_reduce.set_pos(4, 178)
on_call_volum_reduce.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
- on_call_volum_reduce.set_src("E:/static/REDUCE_VOLUM_ICON.png")
+ on_call_volum_reduce.set_src("U:/static/REDUCE_VOLUM_ICON.png")
on_call_volum_reduce.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)),
lv.EVENT.CLICKED, None)
on_call_volum_add.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_volum_add.set_pos(194, 178)
on_call_volum_add.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
- on_call_volum_add.set_src("E:/static/VOLUM_ADD_ICON.png")
+ on_call_volum_add.set_src("U:/static/VOLUM_ADD_ICON.png")
on_call_volum_add.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)),
lv.EVENT.CLICKED, None)
on_call_hangup.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_hangup.set_pos(85, 245)
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.set_src("U:/static/hang_up.png")
on_call_hangup.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)),
lv.EVENT.CLICKED, None)
on_call_screen_tab_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
on_call_phone_return = lv.img(on_call_screen_tab)
- on_call_phone_return.set_src("E:/static/RED_RETURN_PNG.png")
+ on_call_phone_return.set_src("U:/static/RED_RETURN_PNG.png")
on_call_phone_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_return.set_pos(0, 30)
on_call_phone_return.set_size(36, 36)
on_call_phone_one = lv.img(on_call_screen_tab)
- on_call_phone_one.set_src("E:/static/IMAGE_NUMBER_KEY1_ICON.png")
+ on_call_phone_one.set_src("U:/static/IMAGE_NUMBER_KEY1_ICON.png")
on_call_phone_one.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_one.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_one.set_pos(3, 110)
on_call_phone_two = lv.img(on_call_screen_tab)
on_call_phone_two.set_size(76, 50)
- on_call_phone_two.set_src("E:/static/IMAGE_NUMBER_KEY2_ICON.png")
+ on_call_phone_two.set_src("U:/static/IMAGE_NUMBER_KEY2_ICON.png")
on_call_phone_two.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_two.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_two.set_pos(82, 110)
on_call_phone_three = lv.img(on_call_screen_tab)
on_call_phone_three.set_size(76, 50)
- on_call_phone_three.set_src("E:/static/IMAGE_NUMBER_KEY3_ICON.png")
+ on_call_phone_three.set_src("U:/static/IMAGE_NUMBER_KEY3_ICON.png")
on_call_phone_three.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_three.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_three.set_pos(161, 110)#1
on_call_phone_four = lv.img(on_call_screen_tab)
on_call_phone_four.set_size(76, 50)
- on_call_phone_four.set_src("E:/static/IMAGE_NUMBER_KEY4_ICON.png")
+ on_call_phone_four.set_src("U:/static/IMAGE_NUMBER_KEY4_ICON.png")
on_call_phone_four.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_four.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_four.set_pos(3, 162)
on_call_phone_five = lv.img(on_call_screen_tab)
on_call_phone_five.set_size(76, 50)
- on_call_phone_five.set_src("E:/static/IMAGE_NUMBER_KEY5_ICON.png")
+ on_call_phone_five.set_src("U:/static/IMAGE_NUMBER_KEY5_ICON.png")
on_call_phone_five.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_five.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_five.set_pos(82, 162)
on_call_phone_six = lv.img(on_call_screen_tab)
on_call_phone_six.set_size(76, 50)
- on_call_phone_six.set_src("E:/static/IMAGE_NUMBER_KEY6_ICON.png")
+ on_call_phone_six.set_src("U:/static/IMAGE_NUMBER_KEY6_ICON.png")
on_call_phone_six.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_six.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_six.set_pos(161, 162)#2
on_call_phone_seven = lv.img(on_call_screen_tab)
on_call_phone_seven.set_size(76, 50)
- on_call_phone_seven.set_src("E:/static/IMAGE_NUMBER_KEY7_ICON.png")
+ on_call_phone_seven.set_src("U:/static/IMAGE_NUMBER_KEY7_ICON.png")
on_call_phone_seven.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_seven.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_seven.set_pos(3, 214)
on_call_phone_eight = lv.img(on_call_screen_tab)
on_call_phone_eight.set_size(76, 50)
- on_call_phone_eight.set_src("E:/static/IMAGE_NUMBER_KEY8_ICON.png")
+ on_call_phone_eight.set_src("U:/static/IMAGE_NUMBER_KEY8_ICON.png")
on_call_phone_eight.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_eight.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_eight.set_pos(82, 214)
on_call_phone_nine = lv.img(on_call_screen_tab)
on_call_phone_nine.set_size(76, 50)
- on_call_phone_nine.set_src("E:/static/IMAGE_NUMBER_KEY9_ICON.png")
+ on_call_phone_nine.set_src("U:/static/IMAGE_NUMBER_KEY9_ICON.png")
on_call_phone_nine.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_nine.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_nine.set_pos(161, 214)
on_call_phone_start = lv.img(on_call_screen_tab)
on_call_phone_start.set_size(76, 50)
- on_call_phone_start.set_src("E:/static/IMAGE_NUMBER_KEYSTAR_ICON.png")
+ on_call_phone_start.set_src("U:/static/IMAGE_NUMBER_KEYSTAR_ICON.png")
on_call_phone_start.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_start.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_start.set_pos(3, 266)
on_call_phone_zero = lv.img(on_call_screen_tab)
on_call_phone_zero.set_size(76, 50)
- on_call_phone_zero.set_src("E:/static/IMAGE_NUMBER_KEY0_ICON.png")
+ on_call_phone_zero.set_src("U:/static/IMAGE_NUMBER_KEY0_ICON.png")
on_call_phone_zero.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_zero.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_zero.set_pos(82, 266)
on_call_phone_hash = lv.img(on_call_screen_tab)
on_call_phone_hash.set_size(76, 50)
- on_call_phone_hash.set_src("E:/static/IMAGE_NUMBER_KEYHASH_ICON.png")
+ on_call_phone_hash.set_src("U:/static/IMAGE_NUMBER_KEYHASH_ICON.png")
on_call_phone_hash.add_flag(lv.obj.FLAG.CLICKABLE)
on_call_phone_hash.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
on_call_phone_hash.set_pos(161, 266)
EventMesh.publish("set_storage_data", self.read_data)
EventMesh.publish("set_volum_size",self.volum_size)
# print("self.read_data:size :{}".format(self.read_data))
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
def post_processor_after_initialization(self):
step_img = lv.img(step_screen)
step_img.set_pos(100, 150)
step_img.set_size(40, 65)
- step_img.set_src("E:/static/IMAGE_STEP.png")
+ step_img.set_src("U:/static/IMAGE_STEP.png")
step_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
self.meta = step_screen
no_weather_img = lv.img(weather_screen)
no_weather_img.set_pos(10, 10)
no_weather_img.set_size(135, 120)
- no_weather_img.set_src("E:/static/update.png")
+ no_weather_img.set_src("U:/static/update.png")
no_weather_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
weather_tem_label = lv.label(weather_screen)
# print("self.weather_data:{}".format(self.weather_data))
type = self.weather_data[3]
if type == None:
- weather_img.set_src("E:/static/update.png")#天气类型
+ weather_img.set_src("U:/static/update.png")#天气类型
else:
- weather_img.set_src("E:/static/{}_weather.png".format(type))#天气类型
+ weather_img.set_src("U:/static/{}_weather.png".format(type))#天气类型
temp = self.weather_data[4]
if temp == None:
temperature_line_bg_img = lv.img(temperature_screen)
temperature_line_bg_img.set_pos(5, 50)
temperature_line_bg_img.set_size(230, 120)
- temperature_line_bg_img.set_src("E:/static/temp_line_bg.png")
+ temperature_line_bg_img.set_src("U:/static/temp_line_bg.png")
temperature_done_img = lv.img(temperature_screen)
temperature_done_img.set_pos(20, 226)
- temperature_done_img.set_src("E:/static/temp_gif03.png")
+ temperature_done_img.set_src("U:/static/temp_gif03.png")
temp_reset_btn_img = lv.img(temperature_screen)
temp_reset_btn_img.set_pos(0, 182)
- temp_reset_btn_img.set_src("E:/static/reset_hr_btn.png")
+ temp_reset_btn_img.set_src("U:/static/reset_hr_btn.png")
temp_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN)
temp_reset_btn_img.add_flag(lv.obj.FLAG.CLICKABLE)
if self.point%4 == 0 :
temperature_start_label.set_text("正在测量中..")
- temperature_done_img.set_src("E:/static/temp_gif02.png")
+ temperature_done_img.set_src("U:/static/temp_gif02.png")
if self.point%4 == 1 :
temperature_start_label.set_text("正在测量中...")
- temperature_done_img.set_src("E:/static/temp_gif01.png")
+ temperature_done_img.set_src("U:/static/temp_gif01.png")
if self.point%4 == 2 :
temperature_start_label.set_text("正在测量中.")
- temperature_done_img.set_src("E:/static/temp_gif02.png")
+ temperature_done_img.set_src("U:/static/temp_gif02.png")
if self.point%4 == 3 :
temperature_start_label.set_text("正在测量中.")
- temperature_done_img.set_src("E:/static/temp_gif03.png")
+ temperature_done_img.set_src("U:/static/temp_gif03.png")
tmp_f = str(temp).split('.')[0]
tmp_f_tmp = int(tmp_f)
if self.point > 120 : #测2min
if temp >= 37.3:
- temperature_done_img.set_src("E:/static/temp_high.png")
+ temperature_done_img.set_src("U:/static/temp_high.png")
else:
- temperature_done_img.set_src("E:/static/temp_gif03.png")
+ temperature_done_img.set_src("U:/static/temp_gif03.png")
temp_reset_btn_img.clear_flag(lv.obj.FLAG.HIDDEN)
temperature_start_label.set_text("测量结束,点击重测")
# temperature_bg_img = lv.img(temperature_screen)
# temperature_bg_img.set_pos(30, 50)
# temperature_bg_img.set_size(31, 32)
-# temperature_bg_img.set_src("E:/static/temp_hand.png")
+# temperature_bg_img.set_src("U:/static/temp_hand.png")
# temperature_bg_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
# temperature_body_label = lv.label(temperature_screen)
spo2_line_bg_img = lv.img(spo2_screen)
spo2_line_bg_img.set_pos(5, 60)
spo2_line_bg_img.set_size(230, 120)
- spo2_line_bg_img.set_src("E:/static/spo2_line_bg.png")
+ spo2_line_bg_img.set_src("U:/static/spo2_line_bg.png")
spo2_done_img = lv.img(spo2_screen)
spo2_done_img.set_pos(20, 240)
- spo2_done_img.set_src("E:/static/spo2_gif04.png")
+ spo2_done_img.set_src("U:/static/spo2_gif04.png")
spo2_reset_btn_img = lv.img(spo2_screen)
spo2_reset_btn_img.set_pos(0, 192)
- spo2_reset_btn_img.set_src("E:/static/reset_hr_btn.png")
+ spo2_reset_btn_img.set_src("U:/static/reset_hr_btn.png")
spo2_reset_btn_img.add_flag(lv.obj.FLAG.HIDDEN)
spo2_reset_btn_img.add_flag(lv.obj.FLAG.CLICKABLE)
if self.point%4 == 0 :
spo2_start_label.set_text("正在测量中..")
- spo2_done_img.set_src("E:/static/spo2_gif03.png")
+ spo2_done_img.set_src("U:/static/spo2_gif03.png")
if self.point%4 == 1 :
spo2_start_label.set_text("正在测量中...")
- spo2_done_img.set_src("E:/static/spo2_gif02.png")
+ spo2_done_img.set_src("U:/static/spo2_gif02.png")
if self.point%4 == 2 :
spo2_start_label.set_text("正在测量中.")
- spo2_done_img.set_src("E:/static/spo2_gif01.png")
+ spo2_done_img.set_src("U:/static/spo2_gif01.png")
if self.point%4 == 3 :
spo2_start_label.set_text("正在测量中.")
- spo2_done_img.set_src("E:/static/spo2_gif04.png")
+ spo2_done_img.set_src("U:/static/spo2_gif04.png")
if self.point > 120: #测20s
- spo2_done_img.set_src("E:/static/spo2_gif04.png")
+ spo2_done_img.set_src("U:/static/spo2_gif04.png")
self.spo2_value = EventMesh.publish(constants.EVENT.GET_BLOOD_OXYGEN)
if self.spo2_value >= 85:
EventMesh.publish("set_old_spo2_data",self.spo2_value)
# spo2_done_img = lv.img(spo2_screen)
# spo2_done_img.set_pos(89, 50)
# spo2_done_img.set_size(62, 84)
-# spo2_done_img.set_src("E:/static/IMAGE_SPO2_ONLY_TEST_DONE.png")
+# spo2_done_img.set_src("U:/static/IMAGE_SPO2_ONLY_TEST_DONE.png")
# spo2_label = lv.label(spo2_screen)
# spo2_label.set_size(240,30)
countdown_hour_up = lv.img(countdown_screen)
countdown_hour_up.set_size(34, 30)
countdown_hour_up.set_pos(36, 100)
- countdown_hour_up.set_src("E:/static/time_up.png")
+ countdown_hour_up.set_src("U:/static/time_up.png")
countdown_hour_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_hour_up_btn= lv.img(countdown_screen)
countdown_hour_down = lv.img(countdown_screen)
countdown_hour_down.set_size(34, 30)
countdown_hour_down.set_pos(36, 180)
- countdown_hour_down.set_src("E:/static/time_down.png")
+ countdown_hour_down.set_src("U:/static/time_down.png")
countdown_hour_down.add_flag(lv.obj.FLAG.CLICKABLE)
countdown_hour_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_min_up = lv.img(countdown_screen)
countdown_min_up.set_size(34, 30)
countdown_min_up.set_pos(99, 100)
- countdown_min_up.set_src("E:/static/time_up.png")
+ countdown_min_up.set_src("U:/static/time_up.png")
countdown_min_up.add_flag(lv.obj.FLAG.CLICKABLE)
countdown_min_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_min_down = lv.img(countdown_screen)
countdown_min_down.set_size(34, 30)
countdown_min_down.set_pos(99, 180)
- countdown_min_down.set_src("E:/static/time_down.png")
+ countdown_min_down.set_src("U:/static/time_down.png")
countdown_min_down.add_flag(lv.obj.FLAG.CLICKABLE)
countdown_min_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_sec_up = lv.img(countdown_screen)
countdown_sec_up.set_size(34, 30)
countdown_sec_up.set_pos(165, 100)
- countdown_sec_up.set_src("E:/static/time_up.png")
+ countdown_sec_up.set_src("U:/static/time_up.png")
countdown_sec_up.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_sec_up_btn = lv.img(countdown_screen)
countdown_sec_down = lv.img(countdown_screen)
countdown_sec_down.set_size(34, 30)
countdown_sec_down.set_pos(165, 180)
- countdown_sec_down.set_src("E:/static/time_down.png")
+ countdown_sec_down.set_src("U:/static/time_down.png")
countdown_sec_down.add_flag(lv.obj.FLAG.CLICKABLE)
countdown_sec_down.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_reset_img = lv.img(countdown_screen)
countdown_reset_img.set_size(99, 36)
- countdown_reset_img.set_src("E:/static/stopwatch_reset.png")
+ countdown_reset_img.set_src("U:/static/stopwatch_reset.png")
countdown_reset_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_reset_img.set_pos(10, 260)
countdown_start_img = lv.img(countdown_screen)
countdown_start_img.set_size(99, 36)
- countdown_start_img.set_src("E:/static/stopwatch_play.png")
+ countdown_start_img.set_src("U:/static/stopwatch_play.png")
countdown_start_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_start_img.set_pos(120, 260)
countdown_stop_img = lv.img(countdown_screen)
countdown_stop_img.set_size(99, 36)
- countdown_stop_img.set_src("E:/static/stopwatch_stop.png")
+ countdown_stop_img.set_src("U:/static/stopwatch_stop.png")
countdown_stop_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_stop_img.set_pos(120, 260)
countdown_stop_img.add_flag(lv.obj.FLAG.HIDDEN)
countdown_end_img = lv.img(countdown_end_screen)
countdown_end_img.set_size(140, 140)
countdown_end_img.set_pos(50, 60)
- countdown_end_img.set_src("E:/static/time_finish.png")
+ countdown_end_img.set_src("U:/static/time_finish.png")
countdown_end_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
countdown_end_label = lv.label(countdown_end_screen)
self.meta = countdown_end_screen
self.FIND_timer_count = 0
self.FIND_timer.start(3000, 1, self.FIND_timer_cb)
- self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音
+ self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3') #播放声音
def FIND_timer_cb(self, *args):
EventMesh.publish("system_sleep_rest")#防止黑屏
self.stop_FIND()
EventMesh.publish("load_screen", {"screen": "countdown"})
return
- self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3')
+ self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')
def stop_FIND(self) :
self.FIND_timer.stop()
stopwatch_reset_img = lv.img(stopwatch_screen)
stopwatch_reset_img.set_size(99, 36)
- stopwatch_reset_img.set_src("E:/static/stopwatch_reset.png")
+ stopwatch_reset_img.set_src("U:/static/stopwatch_reset.png")
stopwatch_reset_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
stopwatch_reset_img.set_pos(10, 210)
stopwatch_start_img = lv.img(stopwatch_screen)
stopwatch_start_img.set_size(99, 36)
- stopwatch_start_img.set_src("E:/static/stopwatch_play.png")
+ stopwatch_start_img.set_src("U:/static/stopwatch_play.png")
stopwatch_start_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
stopwatch_start_img.set_pos(115, 210)
stopwatch_stop_img = lv.img(stopwatch_screen)
stopwatch_stop_img.set_size(99, 36)
- stopwatch_stop_img.set_src("E:/static/stopwatch_stop.png")
+ stopwatch_stop_img.set_src("U:/static/stopwatch_stop.png")
stopwatch_stop_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
stopwatch_stop_img.set_pos(115, 210)
stopwatch_stop_img.add_flag(lv.obj.FLAG.HIDDEN)
super().__init__()
self.read_data = {}
self.volum_size = 8
- check_volum = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check_volum = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check_volum == True :
- with open("/ext/static/storage_file/config.json","r") as fd:#音频文件编号
+ with open("/usr/static/storage_file/config.json","r") as fd:#音频文件编号
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("volum") in self.read_data.keys()
watchface_mpsignal_img.set_size(160,230)
watchface_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
watchface_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE)
- watchface_mpsignal_img.set_src("E:/static/find_phone.png")
+ watchface_mpsignal_img.set_src("U:/static/find_phone.png")
watchface_mpsignal_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
self.meta = FIND_screen
self.FIND_timer_count = 0
print("self.FIND_timer_count:{}".format(self.FIND_timer_count))
self.FIND_timer.start(3000, 1, self.FIND_timer_cb)
- self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音
+ self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3') #播放声音
def FIND_timer_cb(self, *args):
EventMesh.publish("system_sleep_rest")
- self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3')
+ self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')
self.FIND_timer_count += 1
if self.FIND_timer_count > 20: #120秒
self.stop_FIND()
Lowpower_screen_img.set_size(160,230)
Lowpower_screen_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
Lowpower_screen_img.add_flag(lv.obj.FLAG.CLICKABLE)
- Lowpower_screen_img.set_src("E:/static/low_power.png")
+ Lowpower_screen_img.set_src("U:/static/low_power.png")
Lowpower_screen_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
self.meta = Lowpower_screen
sos_screen_confirm_img = lv.img(sos_screen)
sos_screen_confirm_img.set_size(176, 46)
sos_screen_confirm_img.set_pos(32, 210)
- sos_screen_confirm_img.set_src("E:/static/off_icon.png")
+ sos_screen_confirm_img.set_src("U:/static/off_icon.png")
sos_screen_confirm_img.add_flag(lv.obj.FLAG.CLICKABLE)
sos_screen_confirm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
sos_screen_return = lv.img(sos_screen)
sos_screen_return.set_size(176, 46)
sos_screen_return.set_pos(32, 270)
- sos_screen_return.set_src("E:/static/cancel_icon.png")
+ sos_screen_return.set_src("U:/static/cancel_icon.png")
sos_screen_return.add_flag(lv.obj.FLAG.CLICKABLE)
sos_screen_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
sos_screen_return_label = lv.label(sos_screen_return)
self.set_interrup_flag = 0
self.UI_high_priority_flag = 0 #如果=1,则当前ui不被打断
# print("self.read_data:{} self.level:{}".format(self.read_data,self.level))
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
+ check = ql_fs.path_exists("/usr/static/storage_file/config.json")
if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
+ with open("/usr/static/storage_file/config.json","r") as fd:
self.read_data = ujson.load(fd)
if self.read_data != {}:
b = str("brightness_level") in self.read_data.keys()
self.level = 6
self.read_data["brightness_level"] = self.level
EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
+ with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(self.read_data,fd)
else:
self.level = 6 #默认是6级别
if self.level == None:
self.level = 6
- self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10)
- self.PWM_backlight.open()
self.sleep_lock = 0
def post_processor_after_instantiation(self):
self.screen.lcd_on()
self.system_sleep_timer.start(1000, 1, self.system_sleep_timer_cb)
EventMesh.publish("set_lcd_state",self.sleep_flag)
- tp_cst816.resume()
- lcd.lcd_display_on()
utime.sleep_ms(2)
- lv.autoSleep(0)
pm.autosleep(0)
pm.sclkEx_set(0, 1, 5)
- utime.sleep_ms(60)
self.level = EventMesh.publish("get_brightness_level")
if self.level == None:
self.level = 6
self.level = 10
elif self.level <= 0:
self.level = 1
- self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, self.level, 10)
- self.PWM_backlight.open()
self.sleep_lock = 0
print("__lcd_off")
if self.sleep_lock == 1:
print("__lcd_on:sleep_lock:error!")
- utime.sleep_ms(200)
self.sleep_lock = 1
self.sleep_flag = 0
- self.PWM_backlight = PWM(PWM.PWM1, PWM.ABOVE_MS, 0, 1)
- self.PWM_backlight.open()
- #lcd_ctrl.write(0)
- #
+
lv.autoSleep(1)
pm.autosleep(1)
pm.sclkEx_set(1, 1, 5)
- utime.sleep_ms(2)
- tp_cst816.suspend()
- lcd.lcd_display_off()
#utime.sleep_ms(80)
EventMesh.publish("set_lcd_state",self.sleep_flag)
self.sleep_lock = 0
if self.screen_old != None :
self.screen_old.Close() #先关闭上一次界面
- self.lv.img.cache_invalidate_src(None) #清img cache
- self.lv.img.cache_set_size(16) #开img cache
if self.screen_old.meta_type != "popup": #不是弹窗,保存上一个界面,用来返回
self.screen_prev = self.screen_old #
self.screen_old = self.screen
print("load_screen.load()")
self.screen.load()
- self.lv.scr_load(self.screen.get_meta())
self.screen.post_processor_after_initialization()
self.__lcd_on()
+++ /dev/null
-#表盘
-import osTimer
-import lvgl as lv
-import EventMesh
-import osTimer
-import constants
-from ui import Screen,style_screen
-import ql_fs
-import ujson
-from machine import RTC
-
-
-
-# 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_22.bin",22,0)
-
-watchface_style_default = lv.style_t()
-watchface_style_default.init()
-watchface_style_default.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-watchface_style_default.set_text_font_v2("font_28.bin",28,0)
-
-
-style_font_youyuan_28 = lv.style_t()
-style_font_youyuan_28.init()
-style_font_youyuan_28.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF))
-style_font_youyuan_28.set_text_font(lv.font_28_dial)
-
-Watchface = lv.obj()
-print("Watchface")
-Watchface1 = lv.obj(Watchface)
-
-Watchface1.set_size(240,320)
-#Watchface1.set_pos(0,0)
-Watchface1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-Watchface1.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-# create style style_watchface_img_default
-style_watchface_img_default = lv.style_t()
-style_watchface_img_default.init()
-style_watchface_img_default.set_img_recolor(lv.color_make(0xff,0xff,0xff))
-style_watchface_img_default.set_img_recolor_opa(0)
-style_watchface_img_default.set_img_opa(255)
-
-
-#表盘
-
-#状态栏
-
-watchface1_mpsignal_img = lv.img(Watchface1)
-watchface1_mpsignal_img.set_pos(int(20),int(0))
-watchface1_mpsignal_img.set_size(24,17)
-watchface1_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface1_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png")
-watchface1_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface1_res_stat_battery_img = lv.img(Watchface1)
-watchface1_res_stat_battery_img.set_pos(int(200),int(0))
-watchface1_res_stat_battery_img.set_size(30,18)
-watchface1_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface1_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface1_res_stat_battery_img.set_src("E:/static/vbat_100.png")
-watchface1_res_stat_battery_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface1_res_stat_charge_in_img = lv.img(Watchface1)
-watchface1_res_stat_charge_in_img.set_pos(int(180),int(0))
-watchface1_res_stat_charge_in_img.set_size(10,18)
-watchface1_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface1_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface1_res_stat_charge_in_img.set_src("E:/static/charge_in.png")
-# add style for watchface1_res_stat_charge_in_img
-watchface1_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#主图片
-watchface1_bg_img = lv.img(Watchface1)
-watchface1_bg_img.set_pos(int(9),int(65))
-watchface1_bg_img.set_size(222,222)
-watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface1_bg_img.set_src("U:/static/bg.png")
-watchface1_bg_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-#时间
-
-
-style_font_youyuan_70_black = lv.style_t()
-style_font_youyuan_70_black.init()
-style_font_youyuan_70_black.set_text_color(lv.color_make(0x32, 0xc8, 0xdb))
-style_font_youyuan_70_black.set_text_font(lv.font_70_bold)
-#init3:(2106, 2, 7, 6, 29, 38, 6, 38)
-data = RTC().datetime()
-hour = data[4]
-min = data[5]
-
-week = data[3]
-
-date1 = data[1]
-date2 = data[2]
-print("hour:{} min:{} week:{} date1:{} date2:{} data:{}".format(hour,min,week,date1,date2,data))
-
-def get_week(msg):
- if msg == 1:
- return '一'
- elif msg == 2:
- return '二'
- elif msg == 3:
- return '三'
- elif msg == 4:
- return '四'
- elif msg == 5:
- return '五'
- elif msg == 6:
- return '六'
- elif msg == 7 or msg == 0:
- return '日'
-
-
-watchface1_time1_text = lv.label(Watchface1)
-watchface1_time1_text.set_pos(20, 50)
-watchface1_time1_text.set_size(190, 71)
-watchface1_time1_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface1_time1_text.set_text("{}:{}".format("%02d"%(hour),"%02d"%(min)))
-# watchface1_time1_text.set_text("%02d:%02d"%(hour,min))
-watchface1_time1_text.add_style(style_font_youyuan_70_black, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#日期
-watchface1_date_span = lv.label(Watchface1)
-watchface1_date_span.set_pos(8, 122)
-watchface1_date_span.set_size(140, 30)
-watchface1_date_span.set_align(lv.TEXT_ALIGN.LEFT)
-watchface1_date_span.set_text("%d月%d日"%(date1,date2))
-watchface1_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-#星期
-watchface1_week_span = lv.label(Watchface1)
-watchface1_week_span.set_pos(8, 160)
-watchface1_week_span.set_size(100, 30)
-watchface1_week_span.set_align(lv.TEXT_ALIGN.LEFT)
-watchface1_week_span.set_text("星期%s"%(get_week(week)))
-watchface1_week_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-watchface1_step_span = lv.label(Watchface1)
-watchface1_step_span.set_pos(142, 159)
-watchface1_step_span.set_size(78, 30)
-watchface1_step_span.set_align(lv.TEXT_ALIGN.LEFT)
-watchface1_step_span.set_text("0")
-watchface1_step_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-# watchface1_HB_span = lv.label(Watchface1)
-# watchface1_HB_span.set_pos(52, 235)
-# watchface1_HB_span.set_size(80, 30)
-# watchface1_HB_span.set_align(lv.TEXT_ALIGN.LEFT)
-# watchface1_HB_span.set_text("0")
-# watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface1_HB_span = lv.label(Watchface1)
-watchface1_HB_span.set_pos(5, 235)
-watchface1_HB_span.set_size(115, 30)
-watchface1_HB_span.set_text("0")
-watchface1_HB_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-watchface1_HB_span.add_style(style_font_youyuan_28, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-watchface1_SPO2_span = lv.label(Watchface1)
-watchface1_SPO2_span.set_pos(110, 235)
-watchface1_SPO2_span.set_size(120, 30)
-watchface1_SPO2_span.set_text("0")
-watchface1_SPO2_span.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-watchface1_SPO2_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-class WatchFace1():
- NAME = "Watchface1"
- # # #表盘1
- def __init__(self,main_menu):
- print("Watchface1:__init__")
- self.meta = Watchface1
- Watchface1.set_parent(main_menu)#设置父控件
-
- def initialization(self,main_menu):
- print("Watchface1:initialization")
-
- #获取信号
- signal = EventMesh.publish("screen_get_sig")
- if signal:
- self.__signal(None, signal)
- # 获取电池电量
- battery = EventMesh.publish("screen_get_battery")
- if battery:
- self.__battery(None, battery)
- time = EventMesh.publish("screen_get_time")
- #print("publish_time:"+time)
- if time:
- self.__time(None, time)
- hrValue = EventMesh.publish("get_old_hr_data")
- if hrValue:
- self.__oldHrValue(None, hrValue)
-
- spo2Value = EventMesh.publish("get_old_spo2_data")
- if spo2Value :
- self.__oldSpo2Value(None, spo2Value)
- # print("main get_step msg:{}".format(msg))
-
- # step = EventMesh.publish(constants.EVENT.GET_STEP)
- step = EventMesh.publish("get_old_step_value")
- self.__stepValue(None, step)
-
-
- def timerout_update(self):
- #获取信号
- signal = EventMesh.publish("screen_get_sig")
- if signal:
- self.__signal(None, signal)
- # 获取电池电量
- battery = EventMesh.publish("screen_get_battery")
- if battery:
- self.__battery(None, battery)
-
- time = EventMesh.publish("screen_get_time")
- #print("publish_time:"+time)
- if time:
- self.__time(None, time)
-
- hrValue = EventMesh.publish("get_old_hr_data")
- if hrValue:
- self.__oldHrValue(None, hrValue)
-
- spo2Value = EventMesh.publish("get_old_spo2_data")
- if spo2Value :
- self.__oldSpo2Value(None, spo2Value)
- # print("main get_step msg:{}".format(msg))
- # step = EventMesh.publish(constants.EVENT.GET_STEP)
- step = EventMesh.publish("get_old_step_value")
- self.__stepValue(None, step)
-
- def __time(self, event, msg):
- #时间
- watchface1_time1_text.set_text("{}:{}".format("%02d"%(msg[0][0]),"%02d"%(msg[0][1])))
-
- watchface1_date_span.set_text(msg[2])#日期
- watchface1_week_span.set_text(msg[3]) #星期
-
- def __signal(self, event, msg):
- #print("__signal_cb:",str(msg))
- # 信号强度值范围0 ~ 31,值越大表示信号强度越好
- #print("__signal_cb:{}".format(msg//8))
- if msg:
- if msg >= 0 and msg<=31 :
- watchface1_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1))
- else :
- watchface1_mpsignal_img.set_src("E:/static/mpsignal5.png")
-
- def __battery(self, event, msg):
- #print("__battery_cb:",str(msg))
- #print(msg)
- if msg[0] == '1':
- watchface1_res_stat_charge_in_img.set_src("E:/static/charge_in.png")
- else:
- watchface1_res_stat_charge_in_img.set_src("E:/static/charge_in1.png")
-
- watchface1_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png"
- pass
-
- def __oldHrValue(self, event, msg):
- watchface1_HB_span.set_text("120")
-
- def __oldSpo2Value(self, event, msg):
- watchface1_SPO2_span.set_text(str(msg))
-
- def __stepValue(self, event, msg):
- if msg == None:
- watchface1_step_span.set_text("0")
- else:
- watchface1_step_span.set_text(str(msg))
-
- def Close(self):
- pass
-
- def done_left_to_right(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def done_right_to_left(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def done_top_to_bottom(self):
- EventMesh.publish("load_screen", {"screen": "popup"})
-
- def done_bottom_to_top(self):
- EventMesh.publish("load_screen", {"screen": "call_log"})
-
-# create style style_watchface_img_default
-style_watchface_img_default = lv.style_t()
-style_watchface_img_default.init()
-style_watchface_img_default.set_img_recolor(lv.color_make(0xff,0xff,0xff))
-style_watchface_img_default.set_img_recolor_opa(0)
-style_watchface_img_default.set_img_opa(255)
-
-Watchface2 = lv.obj(Watchface)
-Watchface2.set_size(240,320)
-#Watchface2.set_pos(0,0)
-Watchface2.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-Watchface2.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#表盘
-
-#状态栏
-
-watchface2_mpsignal_img = lv.img(Watchface2)
-watchface2_mpsignal_img.set_pos(int(20),int(0))
-watchface2_mpsignal_img.set_size(24,17)
-watchface2_mpsignal_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_mpsignal_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png")
-watchface2_mpsignal_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_res_stat_battery_img = lv.img(Watchface2)
-watchface2_res_stat_battery_img.set_pos(int(200),int(0))
-watchface2_res_stat_battery_img.set_size(30,18)
-watchface2_res_stat_battery_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_res_stat_battery_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface2_res_stat_battery_img.set_src("E:/static/vbat_100.png")
-watchface2_res_stat_battery_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_res_stat_charge_in_img = lv.img(Watchface2)
-watchface2_res_stat_charge_in_img.set_pos(int(180),int(0))
-watchface2_res_stat_charge_in_img.set_size(10,18)
-watchface2_res_stat_charge_in_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_res_stat_charge_in_img.add_flag(lv.obj.FLAG.CLICKABLE)
-watchface2_res_stat_charge_in_img.set_src("E:/static/charge_in.png")
-# add style for watchface_res_stat_charge_in_img
-watchface2_res_stat_charge_in_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-style_font_youyuan_70_red = lv.style_t()
-style_font_youyuan_70_red.init()
-style_font_youyuan_70_red.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_70_red.set_text_font(lv.font_70_bold)
-#时间
-x = 30
-y = 80
-watchface2_time1_hour_text = lv.label(Watchface2)
-watchface2_time1_hour_text.set_pos(20, 80)
-watchface2_time1_hour_text.set_size(88, 70)
-watchface2_time1_hour_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_time1_hour_text.set_text("{}".format("%02d"%(hour)))
-watchface2_time1_hour_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_time1_mao_text = lv.label(Watchface2)
-watchface2_time1_mao_text.set_pos(108, 76)
-watchface2_time1_mao_text.set_size(44, 70)
-watchface2_time1_mao_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_time1_mao_text.set_text(":")
-watchface2_time1_mao_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_time1_hour1_text = lv.label(Watchface2)
-watchface2_time1_hour1_text.set_pos(152, 80)
-watchface2_time1_hour1_text.set_size(88, 70)
-watchface2_time1_hour1_text.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_time1_hour1_text.set_text("{}".format("%02d"%(min)))
-watchface2_time1_hour1_text.add_style(style_font_youyuan_70_red, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-
-#日期
-watchface2_date_span = lv.label(Watchface2)
-watchface2_date_span.set_pos(18, 170)
-watchface2_date_span.set_size(120, 35)
-watchface2_date_span.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_date_span.set_text("%d月%d日"%(date1,date2))
-watchface2_date_span.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#日期
-watchface2_week = lv.label(Watchface2)
-watchface2_week.set_pos(146, 170)
-watchface2_week.set_size(110, 35)
-watchface2_week.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_week.set_text("星期%s"%(get_week(week)))
-watchface2_week.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-#星期
-
-
-# watchface2_week = lv.img(Watchface2)
-# watchface2_week.set_pos(int(30+56+20+25),int(y+56+30))
-# watchface2_week.set_size(90,30)
-# watchface2_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-# watchface2_week.set_src("E:/static/watch_plate/style_2/week/0_week.png")
-# watchface2_week.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-watchface2_step_img = lv.img(Watchface2)
-watchface2_step_img.set_pos(int(95),int(260))
-watchface2_step_img.set_size(26,21)
-watchface2_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-watchface2_step_img.set_src("U:/static/step.png")
-watchface2_step_img.add_style(style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-watchface2_step_txt = lv.label(Watchface2)
-watchface2_step_txt.set_pos(125, 260)
-watchface2_step_txt.set_size(80, 35)
-watchface2_step_txt.set_align(lv.TEXT_ALIGN.LEFT)
-watchface2_step_txt.set_text("0")
-watchface2_step_txt.add_style(style_font_youyuan_28, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-class WatchFace2():
- NAME = "Watchface2"
- # # #表盘2
- def __init__(self,main_menu):
- print("Watchface2:__init__")
- self.meta = Watchface2
- Watchface2.set_parent(main_menu)#设置父控件
-
- def initialization(self,main_menu):
- print("Watchface2:initialization")
-
- #获取信号
- signal = EventMesh.publish("screen_get_sig")
- if signal:
- self.__signal(None, signal)
- # 获取电池电量
- battery = EventMesh.publish("screen_get_battery")
- if battery:
- self.__battery(None, battery)
- time = EventMesh.publish("screen_get_time")
- #print("publish_time:"+time)
- if time:
- self.__time(None, time)
-
- step = EventMesh.publish("get_old_step_value")
- self.__stepValue(None, step)
-
-
- def timerout_update(self):
- #获取信号
- signal = EventMesh.publish("screen_get_sig")
- if signal:
- self.__signal(None, signal)
- # 获取电池电量
- battery = EventMesh.publish("screen_get_battery")
- if battery:
- self.__battery(None, battery)
-
- time = EventMesh.publish("screen_get_time")
- #print("publish_time:"+time)
- if time:
- self.__time(None, time)
-
- step = EventMesh.publish("get_old_step_value")
- self.__stepValue(None, step)
-
- def __time(self, event, msg):
- #时间
- hour1_chose = (msg[0][0])//10%10
- hour2_chose = (msg[0][0])%10
- min1_chose = (msg[0][1])//10%10
- min2_chose = (msg[0][1])%10
- watchface2_time1_hour_text.set_text("{}".format("%02d"%(msg[0][0])))
- watchface2_time1_hour1_text.set_text("{}".format("%02d"%(msg[0][1])))
- # watchface2_time1_hour_text.set_text("{}".format("%d"%(hour1_chose)))
- # watchface2_time1_hour2_text.set_text("{}".format("%d"%(hour2_chose)))
- # watchface2_time2_min1_text.set_text("{}".format("%d"%(min1_chose)))
- # watchface2_time2_min2_text.set_text("{}".format("%d"%(min2_chose)))
- watchface2_date_span.set_text(msg[2])#日期
- watchface2_week.set_text(msg[3])#星期
- # watchface2_week.set_src("E:/static/watch_plate/style_2/week/%d_week.png"%(msg[5])) #星期
-
- def __signal(self, event, msg):
- #print("__signal_cb:",str(msg))
- # 信号强度值范围0 ~ 31,值越大表示信号强度越好
- #print("__signal_cb:{}".format(msg//8))
- if msg:
- if msg >= 0 and msg<=31 :
- watchface2_mpsignal_img.set_src("E:/static/mpsignal{}.png".format(msg//8+1))
- else :
- watchface2_mpsignal_img.set_src("E:/static/mpsignal5.png")
-
- def __battery(self, event, msg):
- #print("__battery_cb:",str(msg))
- #print(msg)
- if msg[0] == '1':
- watchface2_res_stat_charge_in_img.set_src("E:/static/charge_in.png")
- else:
- watchface2_res_stat_charge_in_img.set_src("E:/static/charge_in1.png")
-
- watchface2_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png"
- pass
- def __stepValue(self, event, msg):
- if msg == None:
- watchface2_step_txt.set_text("0")
- else:
- watchface2_step_txt.set_text(str(msg))
-
-
- # def __weather_type(self, event, msg):
- # if msg == None:
- # watchface2_temp_img.add_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
- # else:
- # type = int(msg)
- # watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_temp_img.clear_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type))
-
- # def __weather_value(self, event, msg):
- # if msg == None:
- # watchface2_temp_degree.add_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
- # else:
- # watchface2_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN)
- # watchface2_temp_txt.set_text(str(msg))
-
- def Close(self):
- pass
-
- def done_left_to_right(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def done_right_to_left(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
- def done_top_to_bottom(self):
- EventMesh.publish("load_screen", {"screen": "popup"})
-
- def done_bottom_to_top(self):
- EventMesh.publish("load_screen", {"screen": "call_log"})
-
-class WatchFace():
- #NAME = "Watchface"
-
- def __init__(self):
- #表盘
- self.meta = None
- self.watchface_style_num = "Watchface1"
- self.watchface_list = []
- self.timer_update = osTimer()
- EventMesh.subscribe("set_change_face", self.change_face)
- self.read_data = {}
- self.PWM_backlight = None
- check = ql_fs.path_exists("/ext/static/storage_file/config.json")
- if check == True:
- with open("/ext/static/storage_file/config.json","r") as fd:
- self.read_data = ujson.load(fd)
- if self.read_data != {}:
- b = str("watchface") in self.read_data.keys()
- if b == True:
- self.watchface_style_num = self.read_data["watchface"]
- else:
- self.watchface_style_num = "Watchface1"
- else:
- self.watchface_style_num = "Watchface1"
-
- def initialization(self,main_menu):
- if self.watchface_list == [] : #第一次初始化
- self.watchface_list.append( WatchFace1(main_menu))
- self.watchface_list.append( WatchFace2(main_menu))
- print("watchface INIT !!!!!!!!:",self.watchface_style_num)
- for wat in self.watchface_list:
- if wat.NAME == self.watchface_style_num :
- self.watchface_style = wat
- wat.meta.add_flag(lv.obj.FLAG.HIDDEN) #隐藏
- self.watchface_style.initialization(main_menu)
- self.meta = self.watchface_style.meta
- self.watchface_style.meta.clear_flag(lv.obj.FLAG.HIDDEN)#显示
- self.timer_update.start(10000, 1, self.timerout_update)
-
- def timerout_update(self, *args, **kwargs):
- self.watchface_style.timerout_update()
-
- def change_face(self, event=None, msg=None):
- print("change_face :",msg)
- self.watchface_style_num = str(msg)
-
- 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):
- # EventMesh.publish("load_screen", {"screen": "main_menu"})
- # def done_top_to_bottom(self):
- # EventMesh.publish("load_screen", {"screen": "popup"})
-
- # def done_bottom_to_top(self):
- # EventMesh.publish("load_screen", {"screen": "call_log"})
- # def done_return(self):
- # EventMesh.publish("load_screen", {"screen": "Watchface"})
-
- # def btn1_release(self):
- # EventMesh.publish("load_screen", {"screen": "Watchface"})
-
- # def btn8_press(self):
- # EventMesh.publish("load_screen", {"screen": "Watchface"})
-
- def Close(self):
- print("watchface Close !!!!!!!!")
- self.timer_update.stop()
- self.watchface_style.Close()
- return
-
-
-
-
+++ /dev/null
-
-import lvgl as lv
-import ql_fs
-import EventMesh
-from misc import Power
-from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn
-import constants
-import osTimer
-import audio
-from machine import Pin
-import ujson
-from lcd import style_font_youyuan_40
-# -------------------------------------------setting screen----------------------------------------------------------
-
-style_bar = lv.style_t()
-style_bar.init()
-style_bar.set_radius(10)
-style_bar.set_bg_color(lv.color_make(0xA0, 0xA0, 0xA0))
-style_bar.set_bg_grad_color(lv.color_make(0xA0, 0xA0, 0xA0))
-style_bar.set_bg_grad_dir(lv.GRAD_DIR.VER)
-style_bar.set_bg_opa(60)
-style_bar.set_pad_left(0)
-style_bar.set_pad_right(0)
-style_bar.set_pad_top(0)
-style_bar.set_pad_bottom(0)
-
-style_volume_btn = lv.style_t()
-style_volume_btn.init()
-style_volume_btn.set_shadow_opa(0)
-style_volume_btn.set_border_width(0)
-style_volume_btn.set_bg_color(lv.color_make(0x80, 0x80, 0x80))
-
-style_bar_indic = lv.style_t()
-style_bar_indic.init()
-style_bar_indic.set_radius(10)
-style_bar_indic.set_bg_color(lv.color_make(0xff, 0x61, 0x3a))
-style_bar_indic.set_bg_grad_color(lv.color_make(0xff, 0x61, 0x3a))
-style_bar_indic.set_bg_grad_dir(lv.GRAD_DIR.VER)
-style_bar_indic.set_bg_opa(255)
-
-health_cont_y = 0
-health_screen = lv.obj()
-print("health_screen")
-health_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-health_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-health_title_img = lv.img(health_screen)
-health_title_img.set_pos(58, 10)
-health_title_img.set_size(124, 30)
-health_title_img.set_src("E:/static/health/health_text.png")
-health_title_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-
-setting_cont_style = lv.style_t()
-setting_cont_style.init()
-setting_cont_style.set_radius(0)
-setting_cont_style.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-setting_cont_style.set_bg_grad_color(lv.color_make(0x00, 0x00, 0x00))
-setting_cont_style.set_bg_grad_dir(lv.GRAD_DIR.VER)
-setting_cont_style.set_bg_opa(255)
-setting_cont_style.set_border_width(0)
-setting_cont_style.set_pad_left(0)
-setting_cont_style.set_pad_right(0)
-setting_cont_style.set_pad_top(0)
-setting_cont_style.set_pad_bottom(0)
-
-health_list_screen = lv.obj(health_screen)
-health_list_screen.set_pos(0, 50)
-health_list_screen.set_size(240, 270)
-health_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-health_list_screen.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-setting_cont = lv.obj(health_list_screen)
-setting_cont.set_pos(0, 0)
-setting_cont.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-setting_cont.set_size(240, 271)
-setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-health_hr = lv.btn(setting_cont)
-health_hr.set_pos(0, health_cont_y)
-health_hr.set_size(0, 0)
-health_hr_label = lv.label(health_hr)
-health_hr_label.set_text("心率")
-health_hr.set_style_pad_all(0, lv.STATE.DEFAULT)
-health_hr_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-health_hr_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-health_hr_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_hr.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_hr_img = lv.img(setting_cont)
-health_hr_img.set_pos(0, health_cont_y)
-health_hr_img.set_size(232, 80)
-health_hr_img.add_flag(lv.obj.FLAG.CLICKABLE)
-health_hr_img.set_src("E:/static/health/health_hr.png")
-health_hr_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_cont_y+=90
-
-
-
-health_spo2 = lv.btn(setting_cont)
-health_spo2.set_pos(0, health_cont_y)
-health_spo2.set_size(0, 0)
-health_spo2_label = lv.label(health_spo2)
-health_spo2_label.set_text("血氧")
-health_spo2.set_style_pad_all(0, lv.STATE.DEFAULT)
-health_spo2_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-health_spo2_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-health_spo2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_spo2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_spo2_img = lv.img(setting_cont)
-health_spo2_img.set_pos(0, health_cont_y)
-health_spo2_img.set_size(232, 80)
-health_spo2_img.add_flag(lv.obj.FLAG.CLICKABLE)
-health_spo2_img.set_src("E:/static/health/health_spo2.png")
-health_spo2_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_cont_y+=90
-
-health_temp = lv.btn(setting_cont)
-health_temp.set_pos(0, health_cont_y)
-health_temp.set_size(0, 0)
-health_temp_label = lv.label(health_temp)
-health_temp_label.set_text("体温")
-health_temp.set_style_pad_all(0, lv.STATE.DEFAULT)
-health_temp_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-health_temp_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-health_temp_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_temp.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_temp_img = lv.img(setting_cont)
-health_temp_img.set_pos(0, health_cont_y)
-health_temp_img.set_size(232, 80)
-health_temp_img.add_flag(lv.obj.FLAG.CLICKABLE)
-health_temp_img.set_src("E:/static/health/health_temp.png")
-health_temp_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-health_cont_y+=90
-
-
-
-
-class HealthScreen(Screen):#健康测量
- NAME = "health"
-
- def __init__(self):
- super().__init__()
- self.meta = health_screen
- # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None)
- health_hr_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "heartrate"})), lv.EVENT.CLICKED, None)
- # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None)
- health_spo2_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "spo2"})), lv.EVENT.CLICKED, None)
- health_temp_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "temperature"})), lv.EVENT.CLICKED, None)
-
- def done_return(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"})
-##################################################################
-# -------------------------------------------language screen----------------------------------------------------------
+++ /dev/null
-#主菜单
-import utime
-import osTimer
-import lvgl as lv
-import EventMesh
-from machine import Timer
-import voiceCall
-import osTimer
-import constants
-from misc import Power
-import pm
-from ui import Screen
-from ui_WatchFaceScreen import WatchFace
-style_MainMenu_screen_default = lv.style_t()
-style_MainMenu_screen_default.init()
-style_MainMenu_screen_default.set_radius(0)
-style_MainMenu_screen_default.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-style_MainMenu_screen_default.set_bg_opa(255)
-style_MainMenu_screen_default.set_border_width(0)
-style_MainMenu_screen_default.set_pad_left(0)
-style_MainMenu_screen_default.set_pad_right(0)
-style_MainMenu_screen_default.set_pad_top(0)
-style_MainMenu_screen_default.set_pad_bottom(0)
-
-style_MainMenu_img_default = lv.style_t()
-style_MainMenu_img_default.init()
-style_MainMenu_img_default.set_img_recolor(lv.color_make(0xff,0xff,0xff))
-style_MainMenu_img_default.set_img_recolor_opa(0)
-style_MainMenu_img_default.set_img_opa(255)
-
-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_28.bin",28,0)
-
-style_font_youyuan_25 = lv.style_t()
-style_font_youyuan_25.init()
-style_font_youyuan_25.set_text_color(lv.color_make(0xff, 0xff, 0xff))
-style_font_youyuan_25.set_text_font_v2("font_28.bin",28,0)
-
-style_btn = lv.style_t()
-style_btn.init()
-style_btn.set_bg_opa(lv.OPA.TRANSP)
-style_btn.set_shadow_opa(0)
-style_btn.set_border_width(0)
-
-
-# MainMenu = lv.obj()
-# class MainMenuScreen(Screen):
-# NAME = "main_menu"
-
-# def __init__(self):
-# super().__init__()
-# #主菜单
-# self.meta = MainMenu
-# self.main_menu_style_num = "MainMenu2"
-
-# def initialization(self):
-# print("main_menu INIT !!!!!!!!")
-# EventMesh.publish("load_screen", {"screen": self.main_menu_style_num})
-
-
-# def post_processor_after_instantiation(self):
-# EventMesh.subscribe("change_style", self.change_style)
-
-
-# def change_style(self, event=None, msg=None): #换风格
-# self.main_menu_style_num = msg
-# EventMesh.publish("load_screen", {"screen": self.main_menu_style_num})
-
-# def Close(self):
-# return
-
-
-# def done_return(self):
-# EventMesh.publish("load_screen", {"screen": "Watchface"})
-
-# def btn1_release(self):
-# EventMesh.publish("load_screen", {"screen": "Watchface"})
-
-# def btn8_press(self):
-# EventMesh.publish("load_screen", {"screen": "Watchface"})
-
-
-
-
-
-style_font_youyuan_font_60 = lv.style_t()
-style_font_youyuan_font_60.init()
-style_font_youyuan_font_60.set_text_color(lv.color_make(0xFF, 0xFF, 0xFF))
-style_font_youyuan_font_60.set_text_font(lv.font_60_main_menu)
-
-MainMenu2 = lv.obj()
-print("MainMenu2")
-MainMenu2_til = lv.tileview(MainMenu2)
-MainMenu2_til.set_scrollbar_mode(0)
-MainMenu2_til.add_style(style_MainMenu_screen_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-#表盘
-MainMenu2_Watchface = MainMenu2_til.add_tile(0, 1, lv.DIR.LEFT | lv.DIR.RIGHT)
-
-label_text = lv.label(MainMenu2_Watchface)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("0")
-#支付宝
-MainMenu2_alipay = MainMenu2_til.add_tile(0, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-#MainMenu2_alipay.set_tile_act(7,0,lv.ANIM.ON)#设置拼接
-label_text = lv.label(MainMenu2_alipay)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("1")
-MainMenu2_img_alipay_text = lv.label(MainMenu2_alipay)
-MainMenu2_img_alipay_text.set_pos(int(0),int(220))
-MainMenu2_img_alipay_text.set_size(240,100)
-MainMenu2_img_alipay_text.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_alipay_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_alipay_text.set_text("支付宝")
-MainMenu2_img_alipay_text.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-MainMenu2_img_alipay = lv.img(MainMenu2_alipay)
-MainMenu2_img_alipay.set_size(160,160)
-MainMenu2_img_alipay.set_pos(40,20)
-MainMenu2_img_alipay.set_src("U:/static/alipay_.png")
-MainMenu2_img_alipay.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_alipay.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# label_alipay.set_long_mode(lv.label.LONG.WRAP)
-# label_alipay.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# label_alipay.add_style(style_font_youyuan_25, lv.PART.MAIN | lv.STATE.DEFAULT)
-#拨号盘
-MainMenu2_phone = MainMenu2_til.add_tile(1, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-label_text = lv.label(MainMenu2_phone)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("2")
-MainMenu2_img_phone = lv.img(MainMenu2_phone)
-MainMenu2_img_phone.set_size(160,160)
-MainMenu2_img_phone.set_pos(40,20)
-MainMenu2_img_phone.set_src("U:/static/IMAGE_ONE_PAGE_CALL.png")
-MainMenu2_img_phone.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_phone.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_phone_text = lv.label(MainMenu2_phone)
-MainMenu2_img_phone_text.set_pos(int(0),int(220))
-MainMenu2_img_phone_text.set_size(240,100)
-MainMenu2_img_phone_text.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_phone_text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_phone_text.set_text("拨号盘")
-MainMenu2_img_phone_text.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-#通讯录
-MainMenu2_contacts = MainMenu2_til.add_tile(2, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-label_text = lv.label(MainMenu2_contacts)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("3")
-MainMenu2_img_contacts = lv.img(MainMenu2_contacts)
-MainMenu2_img_contacts.set_size(160,160)
-MainMenu2_img_contacts.set_pos(40,20)
-MainMenu2_img_contacts.set_src("U:/static/IMAGE_ONE_PAGE_CONTACTS.png")
-MainMenu2_img_contacts.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_contacts.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_contacts_txt = lv.label(MainMenu2_contacts)
-MainMenu2_img_contacts_txt.set_pos(int(0),int(220))
-MainMenu2_img_contacts_txt.set_size(240,100)
-MainMenu2_img_contacts_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_contacts_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_contacts_txt.set_text("联系人")
-MainMenu2_img_contacts_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#短信
-MainMenu2_SMS = MainMenu2_til.add_tile(3, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-label_text = lv.label(MainMenu2_SMS)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("4")
-MainMenu2_img_sms = lv.img(MainMenu2_SMS)
-MainMenu2_img_sms.set_size(160,160)
-MainMenu2_img_sms.set_pos(40,20)
-MainMenu2_img_sms.set_src("U:/static/IMAGE_ONE_PAGE_SMS.png")
-MainMenu2_img_sms.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_sms.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_sms_txt = lv.label(MainMenu2_SMS)
-MainMenu2_img_sms_txt.set_pos(int(0),int(220))
-MainMenu2_img_sms_txt.set_size(240,100)
-MainMenu2_img_sms_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_sms_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_sms_txt.set_text("短信")
-MainMenu2_img_sms_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#微聊
-MainMenu2_wechat = MainMenu2_til.add_tile(4, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-label_text = lv.label(MainMenu2_wechat)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("5")
-MainMenu2_img_wechat = lv.img(MainMenu2_wechat)
-MainMenu2_img_wechat.set_size(160,160)
-MainMenu2_img_wechat.set_pos(40,20)
-MainMenu2_img_wechat.set_src("U:/static/IMAGE_ONE_PAGE_WECHAT.png")
-MainMenu2_img_wechat.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_wechat.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_wechat_txt = lv.label(MainMenu2_wechat)
-MainMenu2_img_wechat_txt.set_pos(int(0),int(220))
-MainMenu2_img_wechat_txt.set_size(240,100)
-MainMenu2_img_wechat_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_wechat_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_wechat_txt.set_text("微聊")
-MainMenu2_img_wechat_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-#心律检测
-MainMenu2_heartrate = MainMenu2_til.add_tile(5, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-label_text = lv.label(MainMenu2_heartrate)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("6")
-MainMenu2_img_health = lv.img(MainMenu2_heartrate)
-MainMenu2_img_health.set_size(160,160)
-MainMenu2_img_health.set_pos(40,20)
-MainMenu2_img_health.set_src("U:/static/IMAGE_ONE_PAGE_HEALTH.png")
-MainMenu2_img_health.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_health.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_health_txt = lv.label(MainMenu2_heartrate)
-MainMenu2_img_health_txt.set_pos(int(0),int(220))
-MainMenu2_img_health_txt.set_size(240,100)
-MainMenu2_img_health_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_health_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_health_txt.set_text("健康测量")
-MainMenu2_img_health_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-#血样检测
-# MainMenu2_spo2 = MainMenu2_til.add_tile(4, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-# label_text = lv.label(MainMenu2_spo2)
-# label_text.set_pos(0, 240)
-# label_text.set_size(0, 0)
-# label_text.set_text("5")
-# MainMenu2_img_spo2 = lv.img(MainMenu2_spo2)
-# MainMenu2_img_spo2.set_size(160,160)
-# MainMenu2_img_spo2.set_pos(40,20)
-# MainMenu2_img_spo2.set_src("U:/static/IMAGE_ONE_PAGE_SPO2_DETECT.png")
-# MainMenu2_img_spo2.add_flag(lv.obj.FLAG.CLICKABLE)
-# MainMenu2_img_spo2.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# MainMenu2_img_spo2_txt = lv.label(MainMenu2_spo2)
-# MainMenu2_img_spo2_txt.set_pos(int(0),int(220))
-# MainMenu2_img_spo2_txt.set_size(240,100)
-# MainMenu2_img_spo2_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-# MainMenu2_img_spo2_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# MainMenu2_img_spo2_txt.set_text("血氧检测")
-# MainMenu2_img_spo2_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-#工具箱
-MainMenu2_toolbox = MainMenu2_til.add_tile(6, 0, lv.DIR.LEFT | lv.DIR.RIGHT)
-label_text = lv.label(MainMenu2_toolbox)
-label_text.set_pos(0, 240)
-label_text.set_size(0, 0)
-label_text.set_text("7")
-MainMenu2_img_toolbox = lv.img(MainMenu2_toolbox)
-MainMenu2_img_toolbox.set_size(160,160)
-MainMenu2_img_toolbox.set_pos(40,20)
-MainMenu2_img_toolbox.set_src("U:/static/IMAGE_ONE_PAGE_TOOLS.png")
-MainMenu2_img_toolbox.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_toolbox.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_toolbox_txt = lv.label(MainMenu2_toolbox)
-MainMenu2_img_toolbox_txt.set_pos(int(0),int(220))
-MainMenu2_img_toolbox_txt.set_size(240,100)
-MainMenu2_img_toolbox_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_toolbox_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_toolbox_txt.set_text("工具箱")
-MainMenu2_img_toolbox_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-#设置
-MainMenu2_setting = MainMenu2_til.add_tile(7, 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("8")
-MainMenu2_img_setting = lv.img(MainMenu2_setting)
-MainMenu2_img_setting.set_size(160,160)
-MainMenu2_img_setting.set_pos(40,20)
-MainMenu2_img_setting.set_src("U:/static/IMAGE_ONE_PAGE_SETTINGS.png")
-MainMenu2_img_setting.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_setting.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-MainMenu2_img_setting_txt = lv.label(MainMenu2_setting)
-MainMenu2_img_setting_txt.set_pos(int(0),int(220))
-MainMenu2_img_setting_txt.set_size(240,100)
-MainMenu2_img_setting_txt.add_flag(lv.obj.FLAG.CLICKABLE)
-MainMenu2_img_setting_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-MainMenu2_img_setting_txt.set_text("设置")
-MainMenu2_img_setting_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT)
-
-
-
-
-
-
-
-
-#主菜单风格2,单页
-class MainMenuScreen(Screen):
- NAME = "main_menu"
- def __init__(self):
- self.meta = MainMenu2
- self.watchface = WatchFace()
- self.menu_id = "0"
- print("MainMenu1:__init__")
- #MainMenu2_til.add_event_cb(lambda e: EventMesh.callback_wrapper(self.scroll_begin_event(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_alipay.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "alipay_open")), lv.EVENT.CLICKED, None)
-
- EventMesh.subscribe("watch_top_show", self.watch_top_show)
- #MainMenu2_img_alipay.add_event_cb(lambda e: img_cb(e, "Watchface_set"), lv.EVENT.CLICKED, None)
-
- def initialization(self):
- self.watchface.initialization(MainMenu2_Watchface)
-
- if self.menu_id =="0":
- MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)
- # if self.meta_info in globals() :
- # MainMenu2_til.set_tile_id(self.meta_info[0],self.meta_info[1],lv.ANIM.OFF)
- pass#
-
- def scroll_begin_event(self, e):
- print("MainMenu2:scroll_begin_event!")
- MainMenu = e.get_target()
- code = e.get_code()
- if code == lv.EVENT.SCROLL_END:
- pass
- def watch_top_show(self, event, msg): #
- MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)
-
- def img_cb(self, e, msg):
- print("MainMenu2:img_cb:{}".format(msg))
- EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
-
- def lcd_on(self):
- self.watchface.watchface_style.timerout_update()
- self.watchface.timer_update.start(10000, 1, self.watchface.timerout_update)
-
- def lcd_off(self):
- self.watchface.timer_update.stop()
-
- def done_return(self):
- MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)
-
- def btn1_release(self):
- flag = EventMesh.publish("get_lcd_state")
- if flag == 0:
- EventMesh.publish(constants.EVENT.SYSTEM_UP)
- else:
- if MainMenu2_til.get_tile_act() != None:
- id = MainMenu2_til.get_tile_act().get_child(0).get_text()
- if id != "0":
- MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)
- else:
- MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF)
-
-
- def btn8_press(self):
- flag = EventMesh.publish("get_lcd_state")
- if MainMenu2_til.get_tile_act() != None:
- id = MainMenu2_til.get_tile_act().get_child(0).get_text()
- if id == "0":
- if flag == 1:
- EventMesh.publish(constants.EVENT.SYSTEM_SLEEP)
- else:
- EventMesh.publish(constants.EVENT.SYSTEM_UP)
- else:
- if flag == 1:
- MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)
- else:
- EventMesh.publish(constants.EVENT.SYSTEM_UP)
- else:
- if flag == 1:
- MainMenu2_til.set_tile_id(0,1,lv.ANIM.OFF)
- else:
- EventMesh.publish(constants.EVENT.SYSTEM_UP)
-
- def done_bottom_to_top(self):
- id = MainMenu2_til.get_tile_act().get_child(0).get_text()
- if id == "0":
- EventMesh.publish("load_screen", {"screen": "call_log"})
- self.menu_id = id
-
- def done_top_to_bottom(self):
- id = MainMenu2_til.get_tile_act().get_child(0).get_text()
- if id == "0":
- EventMesh.publish("load_screen", {"screen": "popup"})
- self.menu_id = id
- def done_left_to_right(self):
- id = MainMenu2_til.get_tile_act().get_child(0).get_text()
- print("done_left_to_right:ID{}".format(id))
- if id == "0":
- MainMenu2_til.set_tile_id(7,0,lv.ANIM.OFF)
- elif self.menu_id != '2' and id == '1':
- MainMenu2_til.set_tile_id(7,0,lv.ANIM.OFF)
- self.menu_id = id
- def done_right_to_left(self):
- id = MainMenu2_til.get_tile_act().get_child(0).get_text()
- print("done_right_to_left:ID{}".format(id))
- if id == "0":
- MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF)
- elif (self.menu_id != '7' ) and id == '8':
- MainMenu2_til.set_tile_id(0,0,lv.ANIM.OFF)
- self.menu_id = id
-
- def Close(self):
- self.watchface.Close()
- print("main_menu Close !!!!!!!!")
- return
-
+++ /dev/null
-
-import lvgl as lv
-import ql_fs
-import EventMesh
-from misc import Power
-from ui import style_screen,style_font_youyuan_20,style_btn,style_img,Screen,style_contact_btn,style_bar,style_bar_indic
-import constants
-import osTimer
-import audio
-from machine import Pin
-import ujson
-from lcd import style_font_youyuan_40
-# -------------------------------------------setting screen----------------------------------------------------------
-
-
-
-style_volume_btn = lv.style_t()
-style_volume_btn.init()
-style_volume_btn.set_shadow_opa(0)
-style_volume_btn.set_border_width(0)
-style_volume_btn.set_bg_color(lv.color_make(0x80, 0x80, 0x80))
-
-
-
-setting_cont_y = 0
-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(75, 10)
-setting_imei_img.set_size(90, 30)
-setting_imei_img.set_src("E:/static/setting/setting_text.png")
-setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-# setting_title = lv.label(setting)
-# setting_title.set_pos(0, 10)
-# setting_title.set_size(240, 40)
-# setting_title.set_text("设置")
-# setting_title.set_long_mode(lv.label.LONG.WRAP)
-# setting_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# setting_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_style = lv.style_t()
-setting_cont_style.init()
-setting_cont_style.set_radius(0)
-setting_cont_style.set_bg_color(lv.color_make(0x00, 0x00, 0x00))
-setting_cont_style.set_bg_grad_color(lv.color_make(0x00, 0x00, 0x00))
-setting_cont_style.set_bg_grad_dir(lv.GRAD_DIR.VER)
-setting_cont_style.set_bg_opa(255)
-setting_cont_style.set_border_width(0)
-setting_cont_style.set_pad_left(0)
-setting_cont_style.set_pad_right(0)
-setting_cont_style.set_pad_top(0)
-setting_cont_style.set_pad_bottom(0)
-
-
-setting_cont = lv.obj(setting_screen)
-setting_cont.set_pos(0, 50)
-setting_cont.set_size(240, 270)
-setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# setting_language = lv.btn(setting_cont)
-# setting_language.set_pos(0, setting_cont_y)
-# setting_language.set_size(240, 54)
-# setting_language_label = lv.label(setting_language)
-# setting_language_label.set_text("语言设置")
-# setting_language.set_style_pad_all(0, lv.STATE.DEFAULT)
-# setting_language_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-# setting_language_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-# setting_language_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-# setting_language.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-# setting_language_img = lv.img(setting_cont)
-# setting_language_img.set_pos(10, setting_cont_y)set_size(47, 47)
-# setting_language_img.set_size(232, 80)
-# setting_language_img.add_flag(lv.obj.FLAG.CLICKABLE)
-# setting_language_img.set_src("E:/static/menu_language.png")
-# setting_language_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-#setting_cont_y += 60
-
-setting_dialswitch = lv.btn(setting_cont)
-setting_dialswitch.set_pos(0, setting_cont_y)
-setting_dialswitch.set_size(0, 0)
-setting_dialswitch_label = lv.label(setting_dialswitch)
-setting_dialswitch_label.set_text("表盘切换")
-setting_dialswitch.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_dialswitch_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_dialswitch_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_dialswitch_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_dialswitch.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_dialswitch_img = lv.img(setting_cont)
-setting_dialswitch_img.set_pos(0, setting_cont_y)
-setting_dialswitch_img.set_size(232, 80)
-setting_dialswitch_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_dialswitch_img.set_src("E:/static/setting/menu_watch_switch.png")
-setting_dialswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-
-# setting_themeswitch = lv.btn(setting_cont)
-# setting_themeswitch.set_pos(0, 120)
-# setting_themeswitch.set_size(240, 54)
-# setting_themeswitch_label = lv.label(setting_themeswitch)
-# setting_themeswitch_label.set_text("主题切换")
-# setting_themeswitch.set_style_pad_all(0, lv.STATE.DEFAULT)
-# setting_themeswitch_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-# setting_themeswitch_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-# setting_themeswitch_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-# setting_themeswitch.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-# setting_themeswitch_img = lv.img(setting_cont)
-# setting_themeswitch_img.set_pos(10, 120)
-# setting_themeswitch_img.set_size(232, 80)
-# setting_themeswitch_img.add_flag(lv.obj.FLAG.CLICKABLE)
-# setting_themeswitch_img.set_src("E:/static/menu_theme_switch.png")
-# setting_themeswitch_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-#setting_cont_y+=60
-
-setting_imei = lv.btn(setting_cont)
-setting_imei.set_pos(0, setting_cont_y)
-setting_imei.set_size(0, 0)
-setting_imei_label = lv.label(setting_imei)
-setting_imei_label.set_text("设备IMEI号")
-setting_imei.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_imei_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_imei_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_imei.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_imei_img = lv.img(setting_cont)
-setting_imei_img.set_pos(0, setting_cont_y)
-setting_imei_img.set_size(232, 80)
-setting_imei_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_imei_img.set_src("E:/static/setting/menu_imei_qrcode.png")
-setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_app = lv.btn(setting_cont)
-setting_app.set_pos(0, setting_cont_y)
-setting_app.set_size(0, 0)
-setting_app_label = lv.label(setting_app)
-setting_app_label.set_text("手机安装APP")
-setting_app.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_app_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_app_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_app_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_app.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_app_img = lv.img(setting_cont)
-setting_app_img.set_pos(0, setting_cont_y)
-setting_app_img.set_size(232, 80)
-setting_app_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_app_img.set_src("E:/static/setting/menu_app_qrcode.png")
-setting_app_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_bright = lv.btn(setting_cont)
-setting_bright.set_pos(0, setting_cont_y)
-setting_bright.set_size(0, 0)
-setting_bright_label = lv.label(setting_bright)
-setting_bright_label.set_text("屏幕调节")
-setting_bright.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_bright_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_bright_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_bright_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_bright.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_bright_img = lv.img(setting_cont)
-setting_bright_img.set_pos(0, setting_cont_y)
-setting_bright_img.set_size(232, 80)
-setting_bright_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_bright_img.set_src("E:/static/setting/menu_bright.png")
-setting_bright_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_volume = lv.btn(setting_cont)
-setting_volume.set_pos(0, setting_cont_y)
-setting_volume.set_size(0, 0)
-setting_volume_label = lv.label(setting_volume)
-setting_volume_label.set_text("铃声")
-setting_volume.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_volume_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_volume_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_volume_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_volume.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_volume_img = lv.img(setting_cont)
-setting_volume_img.set_pos(0, setting_cont_y)
-setting_volume_img.set_size(232, 80)
-setting_volume_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_volume_img.set_src("E:/static/setting/menu_volume.png")
-setting_volume_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_restore = lv.btn(setting_cont)
-setting_restore.set_pos(0, setting_cont_y)
-setting_restore.set_size(0, 0)
-setting_restore_label = lv.label(setting_restore)
-setting_restore_label.set_text("恢复出厂设置")
-setting_restore.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_restore_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_restore_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_restore_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_restore.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_restore_img = lv.img(setting_cont)
-setting_restore_img.set_pos(0, setting_cont_y)
-setting_restore_img.set_size(232, 80)
-setting_restore_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_restore_img.set_src("E:/static/setting/menu_restore.png")
-setting_restore_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_poweroff = lv.btn(setting_cont)
-setting_poweroff.set_pos(0, setting_cont_y)
-setting_poweroff.set_size(0, 0)
-setting_poweroff_label = lv.label(setting_poweroff)
-setting_poweroff_label.set_text("关机")
-setting_poweroff.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_poweroff_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_poweroff_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_poweroff_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_poweroff.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_poweroff_img = lv.img(setting_cont)
-setting_poweroff_img.set_pos(0, setting_cont_y)
-setting_poweroff_img.set_size(232, 80)
-setting_poweroff_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_poweroff_img.set_src("E:/static/setting/menu_poweroff.png")
-setting_poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_version = lv.btn(setting_cont)
-setting_version.set_pos(0, setting_cont_y)
-setting_version.set_size(0, 0)
-setting_version_label = lv.label(setting_version)
-setting_version_label.set_text("关于设备")
-setting_version.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_version_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_version_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_version_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_version.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_version_img = lv.img(setting_cont)
-setting_version_img.set_pos(0, setting_cont_y)
-setting_version_img.set_size(232, 80)
-setting_version_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_version_img.set_src("E:/static/setting/menu_version.png")
-setting_version_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_cont_y+=90
-
-setting_update = lv.btn(setting_cont)
-setting_update.set_pos(0, setting_cont_y)
-setting_update.set_size(0, 0)
-setting_update_label = lv.label(setting_update)
-setting_update_label.set_text("系统升级")
-setting_update.set_style_pad_all(0, lv.STATE.DEFAULT)
-setting_update_label.align(lv.ALIGN.LEFT_MID, 70, 0)
-setting_update_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_update.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_update_img = lv.img(setting_cont)
-setting_update_img.set_pos(0, setting_cont_y)
-setting_update_img.set_size(232, 80)
-setting_update_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_update_img.set_src("E:/static/setting/menu_upgrade.png")
-setting_update_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-class SettingScreen(Screen):
- NAME = "setting"
-
- def __init__(self):
- super().__init__()
- self.meta = setting_screen
- # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None)
- setting_dialswitch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "dialswitch"})), lv.EVENT.CLICKED, None)
- # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None)
- setting_imei.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "imei"})), lv.EVENT.CLICKED, None)
- setting_app.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "app"})), lv.EVENT.CLICKED, None)
- setting_bright.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "brightness"})), lv.EVENT.CLICKED, None)
- setting_volume.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "totalvolume"})), lv.EVENT.CLICKED, None)
- setting_restore.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "restore"})), lv.EVENT.CLICKED, None)
- setting_poweroff.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "poweroff"})), lv.EVENT.CLICKED, None)
- setting_update.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "update"})), lv.EVENT.CLICKED, None)
- setting_version.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "version"})), lv.EVENT.CLICKED, None)
-
- # img regist btton
- # setting_language.add_event_cb(lambda e: self.load_screen(e, {"screen": "language"}), lv.EVENT.CLICKED, None)
- setting_dialswitch_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "dialswitch"})), lv.EVENT.CLICKED, None)
- # setting_themeswitch.add_event_cb(lambda e: self.load_screen(e, {"screen": "themeswitch"}), lv.EVENT.CLICKED, None)
- setting_imei_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "imei"})), lv.EVENT.CLICKED, None)
- setting_app_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "app"})), lv.EVENT.CLICKED, None)
- setting_bright_img.add_event_cb(lambda e:EventMesh.callback_wrapper( self.load_screen(e, {"screen": "brightness"})), lv.EVENT.CLICKED, None)
- setting_volume_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "totalvolume"})), lv.EVENT.CLICKED, None)
- setting_restore_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "restore"})), lv.EVENT.CLICKED, None)
- setting_poweroff_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "poweroff"})), lv.EVENT.CLICKED, None)
- setting_update_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "update"})), lv.EVENT.CLICKED, None)
- setting_version_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "version"})), lv.EVENT.CLICKED, None)
-
-
-
- def done_return(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"})
-##################################################################
-# -------------------------------------------language screen----------------------------------------------------------
-language_screen = lv.obj()
-print("language_screen")
-language_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-language_title = lv.label(language_screen)
-language_title.set_pos(0, 10)
-language_title.set_size(240, 40)
-language_title.set_text("语言设置")
-language_title.set_long_mode(lv.label.LONG.WRAP)
-language_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-language_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-language_english_btn = lv.btn(language_screen)
-language_english_btn.set_size(240,50)
-language_english_btn.set_pos(0, 60)
-language_english_btn.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-language_english_btn.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-language_english_btn_label = lv.label(language_english_btn)
-language_english_btn_label.set_text("English")
-language_english_btn_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-language_english_btn_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-language_chinese_btn = lv.btn(language_screen)
-language_chinese_btn.set_size(240,50)
-language_chinese_btn.set_pos(0, 120)
-language_chinese_btn.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-language_chinese_btn.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-language_chinese_btn_label = lv.label(language_chinese_btn)
-language_chinese_btn_label.set_text("简体中文")
-language_chinese_btn_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-language_chinese_btn_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# -------------------------------------------dialswitch screen----------------------------------------------------------
-dialswitch_screen = lv.obj()
-dialswitch_screen.set_pos(0,0)
-dialswitch_screen.set_size(240,320)
-print("dialswitch_screen")
-dialswitch_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-dialswitch_title = lv.label(dialswitch_screen)
-dialswitch_title.set_pos(0, 10)
-dialswitch_title.set_size(240, 40)
-dialswitch_title.set_text("表盘切换")
-dialswitch_title.set_long_mode(lv.label.LONG.WRAP)
-dialswitch_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-dialswitch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-dialswitch_img1 = lv.img(dialswitch_screen)#表盘预览图
-dialswitch_img1.set_pos(50, 60)
-dialswitch_img1.set_size(140, 172)
-dialswitch_img1.set_src("U:/static/DIAL_PREV01.png")
-dialswitch_img1.add_flag(lv.obj.FLAG.CLICKABLE)
-dialswitch_img1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-
-dialswitch_btn1_label = lv.label(dialswitch_screen)#显示表盘1 表盘2
-dialswitch_btn1_label.set_text(" ")
-dialswitch_btn1_label.align(lv.ALIGN.TOP_MID, 0, 260)
-dialswitch_btn1_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-dialswitch_butoom_crcile1 = lv.img(dialswitch_screen)#底部显示圆点
-dialswitch_butoom_crcile1.set_pos(95, 300)
-dialswitch_butoom_crcile1.set_size(10, 10)
-dialswitch_butoom_crcile1.set_src("E:/static/point_white.png")
-dialswitch_butoom_crcile1.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-dialswitch_butoom_crcile2 = lv.img(dialswitch_screen)#底部显示圆点
-dialswitch_butoom_crcile2.set_pos(140, 300)
-dialswitch_butoom_crcile2.set_size(10, 10)
-dialswitch_butoom_crcile2.set_src("E:/static/point_black.png")
-dialswitch_butoom_crcile2.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# dialswitch_btn2 = lv.btn(dialswitch_screen)
-# dialswitch_btn2.set_size(240,54)
-# dialswitch_btn2.set_pos(0, 104)
-# dialswitch_btn2.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-# dialswitch_btn2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-# dialswitch_btn2_label = lv.label(dialswitch_btn2)
-# dialswitch_btn2_label.set_text("表盘2")
-# dialswitch_btn2_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-# dialswitch_btn2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# btn1_switch = lv.switch(dialswitch_btn1)
-# btn1_switch.set_pos(185, 3)
-# btn1_switch.set_size(10, 10)
-# btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-# btn1_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-# btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
-# btn2_switch = lv.switch(dialswitch_btn2)
-# btn2_switch.set_pos(185, 3)
-# btn2_switch.set_size(10, 10)
-# btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-# btn2_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-# btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
-# -------------------------------------------menustyle screen----------------------------------------------------------
-menustyle_screen = lv.obj()
-print("menustyle_screen")
-menustyle_screen.center()
-menustyle_screen.set_size(240, 320)
-menustyle_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-menustyle_title = lv.label(menustyle_screen)
-menustyle_title.set_pos(0, 10)
-menustyle_title.set_size(240, 40)
-menustyle_title.set_text("主菜单风格")
-menustyle_title.set_long_mode(lv.label.LONG.WRAP)
-menustyle_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-menustyle_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-menustyle_btn1 = lv.btn(menustyle_screen)
-menustyle_btn1.set_size(240,54)
-menustyle_btn1.set_pos(0, 50)
-menustyle_btn1.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-menustyle_btn1.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-menustyle_btn1_label = lv.label(menustyle_btn1)
-menustyle_btn1_label.set_text("四宫格")
-menustyle_btn1_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-menustyle_btn1_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-menu_btn1_switch = lv.switch(menustyle_btn1)
-menu_btn1_switch.set_pos(185, 3)
-menu_btn1_switch.set_size(10, 10)
-menu_btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-menu_btn1_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-menu_btn1_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
-menustyle_btn2 = lv.btn(menustyle_screen)
-menustyle_btn2.set_size(240,54)
-menustyle_btn2.set_pos(0, 104)
-menustyle_btn2.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-menustyle_btn2.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-menustyle_btn2_label = lv.label(menustyle_btn2)
-menustyle_btn2_label.set_text("单页")
-menustyle_btn2_label.align(lv.ALIGN.LEFT_MID, 10, 0)
-menustyle_btn2_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-menu_btn2_switch = lv.switch(menustyle_btn2)
-menu_btn2_switch.set_pos(185, 3)
-menu_btn2_switch.set_size(10, 10)
-menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.MAIN | lv.PART.INDICATOR)
-menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0x00, 0x00),lv.PART.KNOB | lv.STATE.CHECKED)
-menu_btn2_switch.set_style_bg_color(lv.color_make(0xff, 0xff, 0xff),lv.PART.KNOB)
-
-
-
-
-
-# -------------------------------------------app screen----------------------------------------------------------
-#app_screen = lv.obj()
-app_screen = lv.obj()
-print("app_screen")
-app_screen.center()
-app_screen.set_size(240, 320)
-app_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-app_img = lv.img(app_screen)
-app_img.set_pos(int(20),int(40))
-app_img.set_size(200,200)
-app_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-app_img.add_flag(lv.obj.FLAG.CLICKABLE)
-app_img.set_src("E:/static/IMAGE_APP_QR_CODE.png")
-app_img.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
-# app_qr = lv.qrcode(imei, 150, fg_color, bg_color)
-# app_qr.center()
-# Add a border with bg_color
-# app_qr.set_style_border_color(bg_color, 0)
-# app_qr.set_style_border_width(5, 0)
-# app_qr_data = str("https://fangzoudiu.xcloudtech.com/xiao_jian")
-# app_qr.update(app_qr_data,len(app_qr_data))
-
-app_label = lv.label(app_screen)
-app_label.set_pos(0, 280)
-app_label.set_size(240, 20)
-app_label.set_text(" ")
-app_label.set_long_mode(lv.label.LONG.WRAP)
-app_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-app_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# -------------------------------------------volume screen----------------------------------------------------------
-volume_screen = lv.obj()
-print("volume_screen")
-volume_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-volume_phone_btn = lv.btn(volume_screen)
-volume_phone_btn.set_size(240,40)
-volume_phone_btn.set_pos(0,30)
-volume_phone_btn.add_style(style_volume_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-volume_phone_label = lv.label(volume_phone_btn)
-volume_phone_label.set_text("电话铃声")
-volume_phone_label.align(lv.ALIGN.CENTER, 0, 0)
-volume_phone_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-volume_alarm_btn = lv.btn(volume_screen)
-volume_alarm_btn.set_size(240,40)
-volume_alarm_btn.set_pos(0,100)
-volume_alarm_btn.add_style(style_volume_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-volume_alarm_label = lv.label(volume_alarm_btn)
-volume_alarm_label.set_text("闹钟铃声")
-volume_alarm_label.align(lv.ALIGN.CENTER, 0, 0)
-volume_alarm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-volume_message_btn = lv.btn(volume_screen)
-volume_message_btn.set_size(240,40)
-volume_message_btn.set_pos(0,170)
-volume_message_btn.add_style(style_volume_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-volume_message_label = lv.label(volume_message_btn)
-volume_message_label.set_text("消息铃声")
-volume_message_label.align(lv.ALIGN.CENTER, 0, 0)
-volume_message_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# -------------------------------------------phonering screen----------------------------------------------------------
-phonering_screen = lv.obj()
-print("phonering_screen")
-phonering_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-phonering_title = lv.label(phonering_screen)
-phonering_title.set_pos(0, 10)
-phonering_title.set_size(240, 40)
-phonering_title.set_text("电话铃声")
-phonering_title.set_long_mode(lv.label.LONG.WRAP)
-phonering_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-phonering_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-phonering_label1 = lv.label(phonering_screen)
-phonering_label1.set_pos(10, 70)
-phonering_label1.set_size(230, 40)
-phonering_label1.set_text("电话铃声:")
-phonering_label1.set_long_mode(lv.label.LONG.WRAP)
-phonering_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-phonering_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-phonering_bar = lv.bar(phonering_screen)
-phonering_bar.set_pos(20, 120)
-phonering_bar.set_size(200, 15)
-phonering_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-phonering_bar.set_mode(lv.bar.MODE.NORMAL)
-phonering_bar.set_value(50, lv.ANIM.OFF)
-phonering_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-phonering_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-
-phonering_reduce_imgbtn = lv.img(phonering_screen)
-phonering_reduce_imgbtn.set_pos(0, 150)
-phonering_reduce_imgbtn.set_size(110, 46)
-phonering_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-phonering_reduce_imgbtn.set_src("E:/static/reduce_btn.png")
-phonering_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-phonering_add_imgbtn = lv.img(phonering_screen)
-phonering_add_imgbtn.set_pos(120, 150)
-phonering_add_imgbtn.set_size(110, 46)
-phonering_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-phonering_add_imgbtn.set_src("E:/static/add_btn.png")
-
-phonering_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# -------------------------------------------alarmvolume screen----------------------------------------------------------
-alarmvolume_screen = lv.obj()
-print("alarmvolume_screen")
-alarmvolume_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-alarmvolume_title = lv.label(alarmvolume_screen)
-alarmvolume_title.set_pos(0, 10)
-alarmvolume_title.set_size(240, 40)
-alarmvolume_title.set_text("闹钟铃声")
-alarmvolume_title.set_long_mode(lv.label.LONG.WRAP)
-alarmvolume_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-alarmvolume_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-alarmvolume_label1 = lv.label(alarmvolume_screen)
-alarmvolume_label1.set_pos(10, 70)
-alarmvolume_label1.set_size(230, 40)
-alarmvolume_label1.set_text("闹钟铃声:")
-alarmvolume_label1.set_long_mode(lv.label.LONG.WRAP)
-alarmvolume_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-alarmvolume_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-alarmvolume_bar = lv.bar(alarmvolume_screen)
-alarmvolume_bar.set_pos(20, 120)
-alarmvolume_bar.set_size(200, 15)
-alarmvolume_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-alarmvolume_bar.set_mode(lv.bar.MODE.NORMAL)
-alarmvolume_bar.set_value(50, lv.ANIM.OFF)
-alarmvolume_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-alarmvolume_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-
-alarmvolume_reduce_imgbtn = lv.img(alarmvolume_screen)
-alarmvolume_reduce_imgbtn.set_pos(5, 150)
-alarmvolume_reduce_imgbtn.set_size(110, 46)
-alarmvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-alarmvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png")
-
-alarmvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-alarmvolume_add_imgbtn = lv.img(alarmvolume_screen)
-alarmvolume_add_imgbtn.set_pos(125, 150)
-alarmvolume_add_imgbtn.set_size(110, 46)
-alarmvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-alarmvolume_add_imgbtn.set_src("E:/static/add_btn.png")
-
-alarmvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# -------------------------------------------msgvolume screen----------------------------------------------------------
-msgvolume_screen = lv.obj()
-print("msgvolume_screen")
-msgvolume_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-msgvolume_title = lv.label(msgvolume_screen)
-msgvolume_title.set_pos(0, 10)
-msgvolume_title.set_size(240, 40)
-msgvolume_title.set_text("消息铃声")
-msgvolume_title.set_long_mode(lv.label.LONG.WRAP)
-msgvolume_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-msgvolume_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-msgvolume_label1 = lv.label(msgvolume_screen)
-msgvolume_label1.set_pos(10, 70)
-msgvolume_label1.set_size(230, 40)
-msgvolume_label1.set_text("消息铃声:")
-msgvolume_label1.set_long_mode(lv.label.LONG.WRAP)
-msgvolume_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-msgvolume_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-msgvolume_bar = lv.bar(msgvolume_screen)
-msgvolume_bar.set_pos(20, 120)
-msgvolume_bar.set_size(200, 15)
-msgvolume_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-msgvolume_bar.set_mode(lv.bar.MODE.NORMAL)
-msgvolume_bar.set_value(50, lv.ANIM.OFF)
-msgvolume_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-msgvolume_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-
-msgvolume_reduce_imgbtn = lv.img(msgvolume_screen)
-msgvolume_reduce_imgbtn.set_pos(5, 150)
-msgvolume_reduce_imgbtn.set_size(110, 46)
-msgvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-msgvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png")
-
-msgvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-msgvolume_add_imgbtn = lv.img(msgvolume_screen)
-msgvolume_add_imgbtn.set_pos(125, 150)
-msgvolume_add_imgbtn.set_size(110, 46)
-msgvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-msgvolume_add_imgbtn.set_src("E:/static/add_btn.png")
-
-msgvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-# -------------------------------------------restore screen----------------------------------------------------------
-restore_screen = lv.obj()
-print("restore_screen")
-restore_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-restore_label = lv.label(restore_screen)
-restore_label.set_pos(0, 100)
-restore_label.set_size(240, 40)
-restore_label.set_text("恢复出厂设置?")
-restore_label.set_long_mode(lv.label.LONG.WRAP)
-restore_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-restore_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-restore_confirm_label = lv.label(restore_screen)
-restore_confirm_label.set_text("确认")
-restore_confirm_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-restore_confirm_label.set_size(120, 60)
-restore_confirm_label.set_pos(0,180)
-restore_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-restore_confirm = lv.label(restore_screen)
-restore_confirm.set_text(" ")
-restore_confirm.set_size(120, 80)
-restore_confirm.set_pos(0,160)
-restore_confirm.add_flag(lv.obj.FLAG.CLICKABLE)
-
-restore_cancel_label = lv.label(restore_screen)
-restore_cancel_label.set_text("返回")
-restore_cancel_label.set_size(120, 60)
-restore_cancel_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-restore_cancel_label.set_pos(120,180)
-restore_cancel_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-restore_cancel = lv.label(restore_screen)
-restore_cancel.set_text(" ")
-restore_cancel.set_size(120, 80)
-restore_cancel.set_pos(120,160)
-restore_cancel.add_flag(lv.obj.FLAG.CLICKABLE)
-
-
-
-
-
-# -------------------------------------------version screen----------------------------------------------------------
-version_screen = lv.obj()
-print("version_screen")
-version_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_msg = "Software Version:\n\
-MMI\n\
-Version:UIX8910_C55_V\n\
-1.0_Release\n\
-Build Time:\n\
-2-17-2023\n\
-9:32:5\n\
-IMEI:\n\
-"
-import versions
-
-version_label1 = lv.label(version_screen)
-version_label1.set_pos(0, 30)
-version_label1.set_size(240, 30)
-version_label1.set_long_mode(lv.label.LONG.WRAP)
-version_label1.set_text("Software Version:")
-version_label1.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-version_label2 = lv.label(version_screen)
-version_label2.set_pos(0, 60)
-version_label2.set_size(240, 30)
-version_label2.set_long_mode(lv.label.LONG.WRAP)
-version_label2.set_text("Python Lvgl")
-version_label2.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label2.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_label3 = lv.label(version_screen)
-version_label3.set_pos(0, 90)
-version_label3.set_size(240, 30)
-version_label3.set_long_mode(lv.label.LONG.WRAP)
-version_label3.set_text("Version:")
-version_label3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_label3 = lv.label(version_screen)
-version_label3.set_pos(0, 120)
-version_label3.set_size(240, 30)
-version_label3.set_long_mode(lv.label.LONG.WRAP)
-version_label3.set_text(versions.Version)
-version_label3.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label3.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# version_label4 = lv.label(version_screen)
-# version_label4.set_pos(0, version_label_y)
-# version_label4.set_size(240, 30)
-# version_label4.set_long_mode(lv.label.LONG.WRAP)
-# version_label4.set_text("")
-# version_label4.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# version_label4.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_label5 = lv.label(version_screen)
-version_label5.set_pos(0, 150)
-version_label5.set_size(240, 30)
-version_label5.set_long_mode(lv.label.LONG.WRAP)
-version_label5.set_text("Build Time:")
-version_label5.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label5.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_label6 = lv.label(version_screen)
-version_label6.set_pos(0, 180)
-version_label6.set_size(240, 30)
-version_label6.set_long_mode(lv.label.LONG.WRAP)
-version_label6.set_text(versions.Build_Time)
-version_label6.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label6.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-# version_label7 = lv.label(version_screen)
-# version_label7.set_pos(0, 210)
-# version_label7.set_size(240, 30)
-# version_label7.set_long_mode(lv.label.LONG.WRAP)
-# version_label7.set_text(versions.Build_Time.split(" ")[1])
-# version_label7.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-# version_label7.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_label8 = lv.label(version_screen)
-version_label8.set_pos(0, 210)
-version_label8.set_size(240, 30)
-version_label8.set_long_mode(lv.label.LONG.WRAP)
-version_label8.set_text("IMEI:")
-version_label8.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label8.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-version_label9 = lv.label(version_screen)
-version_label9.set_pos(20, 240)
-version_label9.set_size(220, 30)
-version_label9.set_long_mode(lv.label.LONG.WRAP)
-version_label9.set_text(" ")
-version_label9.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-version_label9.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-
-# -------------------------------------------update screen----------------------------------------------------------
-update_screen = lv.obj()
-print("update_screen")
-update_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-update_title = lv.label(update_screen)
-update_title.set_pos(0, 10)
-update_title.set_size(240, 40)
-update_title.set_text("系统更新")
-update_title.set_long_mode(lv.label.LONG.WRAP)
-update_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-update_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-update_label = lv.label(update_screen)
-update_label.set_text(" 已经是最新版本")
-update_label.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-update_label.set_size(240, 50)
-update_label.set_pos(0,50)
-update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-update_return = lv.label(update_screen)
-update_return.set_text("返回")
-update_return.set_size(240, 40)
-update_return.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-update_return.set_pos(0,240)
-update_return.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-update_return.add_flag(lv.obj.FLAG.CLICKABLE)
-
-class RestoreScreen(Screen):
- NAME = "restore"
-
- def __init__(self):
- super().__init__()
- self.meta = restore_screen
- restore_confirm.add_event_cb(lambda e: EventMesh.callback_wrapper(self.confirm(e)),lv.EVENT.CLICKED, None)
- restore_cancel.add_event_cb(lambda e: EventMesh.callback_wrapper(self.concel(e)),lv.EVENT.CLICKED, None)
-
-
- def confirm(self, e):
- ret = 0
- ret = ql_fs.path_exists("/ext/static/storage_file")#电话本
- if ret == True:
- ql_fs.rmdirs("/ext/static/storage_file")
- ql_fs.mkdirs("/ext/static/storage_file")
- EventMesh.publish("alipay_unbind")
- EventMesh.publish(constants.PROTOCOL.DLT_SEND)
-
- def concel(self, e):
- 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 btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-class UpdateScreen(Screen):
- NAME = "update"
-
- def __init__(self):
- super().__init__()
- self.meta = update_screen
- update_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.back(e)),lv.EVENT.CLICKED, None)
-
- def back(self,e):
- 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 btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-class VersionScreen(Screen):
- NAME = "version"
-
- def __init__(self):
- super().__init__()
- self.meta = version_screen
- self.btn_count = 0
- def initialization(self):
- imei = EventMesh.publish(constants.EVENT.GET_IMEI)
- version_label9.set_text(imei)
-
- def Close(self):
- self.btn_count = 0
-
- def done_click(self):
- self.btn_count += 1
- if self.btn_count >= 5 :
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def done_bottom_to_top(self):
- self.btn_count += 1
- if self.btn_count >= 5 :
- EventMesh.publish("load_screen", {"screen": "factorymode"})
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-# -------------------------------------------poweroff screen----------------------------------------------------------
-poweroff_screen = lv.obj()
-print("poweroff_screen")
-poweroff_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-poweroff_img = lv.img(poweroff_screen)
-poweroff_img.set_pos(100, 30)
-poweroff_img.set_size(61, 61)
-poweroff_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-poweroff_img.set_src("E:/static/poweroff_icon.png")
-
-poweroff_label = lv.label(poweroff_screen)
-poweroff_label.set_text("是否关机?")
-poweroff_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-poweroff_label.set_size(240, 20)
-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(176, 46)
-poweroff_confirm_img.set_pos(32, 150)
-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)
-
-poweroff_confirm_label = lv.label(poweroff_confirm_img)
-poweroff_confirm_label.set_text("关机")
-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(176, 46)
-poweroff_return.set_pos(32, 210)
-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)
-poweroff_return_label = lv.label(poweroff_return)
-poweroff_return_label.set_text("返回")
-poweroff_return_label.align(lv.ALIGN.CENTER, 0, 5)
-poweroff_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-poweroff_return.set_ext_click_area(20)
-
-
-class PoweroffScreen(Screen):
- NAME = "poweroff"
-
- def __init__(self):
- super().__init__()
- 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)
-
- def initialization(self):
- pass
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def confirm(self, e):
- EventMesh.publish("load_screen", {"screen": "poweroff_comfirm"})
-
-
- def concel(self, e):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-
-poweroff_confirm_screen = lv.obj()
-print("poweroff_confirm_screen")
-poweroff_confirm_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-poweroff_confirm_label = lv.label(poweroff_confirm_screen)
-poweroff_confirm_label.set_text("Goodbye")
-poweroff_confirm_label.align(lv.ALIGN.CENTER, 0, 0)
-poweroff_confirm_label.add_style(style_font_youyuan_40, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-import utime
-class PoweroffConfirmScreen(Screen):
- NAME = "poweroff_comfirm"
-
- def __init__(self):
- super().__init__()
- self.meta = poweroff_confirm_screen
- self.timer = osTimer()
- self.read_data = {}
- def initialization(self):
- step = EventMesh.publish("get_old_step_value")
- self.read_data = EventMesh.publish("get_storage_data")
- if step != 0:
- self.read_data["old_step"] = step
- date_tmp = utime.localtime()
- self.read_data["old_timesecond"] = date_tmp#关机保存一个是时间
- #print("self.read_data:{}".format(self.read_data))
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
- ujson.dump(self.read_data,fd)
- self.timer.start(3*1000,0,self.power_off)
-
- def power_off(self,*args):
-
- Power.powerDown()
-
- def done_return(self):
- pass
-
- def btn1_release(self):
- pass
-
- def btn8_press(self):
- pass
-from common import Abstract
-class TimePoweroffScreen(Abstract):
-
-
- def __init__(self):
- super().__init__()
- self.power_off_flag = 0
- self.read_data = {}
- EventMesh.subscribe("get_time_power_off", self.get_time_power_off)
- EventMesh.subscribe("power_off_callback", self.power_off_callback)
- EventMesh.subscribe("set_time_power_off", self.set_time_power_off)
-
-
- def power_off_callback(self,event,msg):
- if self.power_off_flag == 0:
- self.power_off_flag = 1
- EventMesh.publish("set_time_power_off")
- Power.powerDown()
-
- elif self.power_off_flag == 1:
- self.power_off_flag = 0
- EventMesh.publish("set_time_power_off")
- Power.powerRestart()
-
-
- def get_time_power_off(self,event,msg):
- if self.power_off_flag == 0:
- self.power_off_flag = 1
- elif self.power_off_flag == 1:
- self.power_off_flag = 0
-
- def set_time_power_off(self,event,msg):
- self.read_data = EventMesh.publish("get_storage_data")
- if self.read_data != {}:
- b = str("off_on") in self.read_data().keys()
- if b == True:
- pass
-
-
-
-
- def done_return(self):
- pass
-
- def btn1_release(self):
- pass
-
- def btn8_press(self):
- pass
-
-class LanguageScreen(Screen):
- NAME = "language"
-
- def __init__(self):
- super().__init__()
- self.meta = language_screen
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
-
-class DialswitchScreen(Screen):
- NAME = "dialswitch"
-
- def __init__(self):
- super().__init__()
- self.meta = dialswitch_screen
- self.read_data = {}
- self.watchface_style_num = "Watchface1"
- dialswitch_img1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface01(e)),
- lv.EVENT.CLICKED, None)
- self.dial_num = 1
- self.move = 0
- self.timer= osTimer()
-
- def initialization(self):
- self.dial_num = 1
- self.move = 0
- self.read_data = EventMesh.publish("get_storage_data")
- if self.read_data != {}:
- b = str("watchface") in self.read_data.keys()
- if b == True:
- self.watchface_style_num = self.read_data["watchface"]
- if self.watchface_style_num == "Watchface1":
- self.dial_num = 1
- else:
- self.dial_num = 2
- self.show_info()
-
-
-
- def watchface01(self,e):
- code = e.get_code()
- if code == lv.EVENT.CLICKED:
- self.timer.start(50,0,self.enter_main_show)
-
- def enter_main_show(self,e):
- self.read_data = EventMesh.publish("get_storage_data")
- self.read_data["watchface"] = "Watchface{}".format(self.dial_num)
- EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
- ujson.dump(self.read_data,fd)
- EventMesh.publish("set_change_face", "Watchface{}".format(self.dial_num))
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def done_left_to_right(self):#右滑
- #print("done_left_to_right!!!!!!!!!")
- self.move = 1
- if self.dial_num > 1:
- self.dial_num-=1
- else:
- self.dial_num = 2
- self.timer.stop()
- self.show_info()
-
- def done_right_to_left(self):#左滑
- #print("done_right_to_left!!!!!!!!!")
- self.move = 2
- self.dial_num+=1
- if self.dial_num > 2:
- self.dial_num = 1
- self.show_info()
- self.timer.stop()
-
- def done_bottom_to_top(self):
- self.move = 3
- self.timer.stop()
-
- def done_top_to_bottom(self):
- self.move = 4
- self.timer.stop()
-
- def show_info(self):
- dialswitch_img1.set_src("U:/static/DIAL_PREV0{}.png".format(self.dial_num))
- dialswitch_btn1_label.set_text("表盘{}".format(self.dial_num))
- if(self.dial_num == 1):
- dialswitch_butoom_crcile1.set_src("E:/static/point_white.png")
- dialswitch_butoom_crcile2.set_src("E:/static/point_black.png")
- else:
- dialswitch_butoom_crcile1.set_src("E:/static/point_black.png")
- dialswitch_butoom_crcile2.set_src("E:/static/point_white.png")
- def Close(self):
- self.timer.stop()
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-class ThemeswitchScreen(Screen):
- NAME = "themeswitch"
-
- def __init__(self):
- super().__init__()
- self.meta = menustyle_screen
- menustyle_btn1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.fun1(e)),
- lv.EVENT.PRESSED, None)
-
- menustyle_btn2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.fun2(e)),
- lv.EVENT.PRESSED, None)
-
- def fun1(self,e):
- menu_btn1_switch.add_state(lv.STATE.CHECKED)
- menu_btn2_switch.clear_state(lv.STATE.CHECKED)
- EventMesh.publish("change_style", "MainMenu1")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def fun2(self,e):
- menu_btn1_switch.clear_state(lv.STATE.CHECKED)
- menu_btn2_switch.add_state(lv.STATE.CHECKED)
- EventMesh.publish("change_style", "MainMenu2")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def done_return(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": "setting"})
-
-# -------------------------------------------imei screen----------------------------------------------------------
-imei_screen = lv.obj()
-print("imei_screen")
-imei_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
-fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
-
-imei_qr = lv.qrcode(imei_screen, 150, fg_color, bg_color)
-imei_qr.center()
-# Add a border with bg_color
-imei_qr.set_style_border_color(bg_color, 0)
-imei_qr.set_style_border_width(5, 0)
-
-
-imei_label = lv.label(imei_screen)
-imei_label.set_pos(0, 280)
-imei_label.set_size(240, 20)
-imei_label.set_text(" ")
-imei_label.set_long_mode(lv.label.LONG.WRAP)
-imei_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-imei_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-class ImeiScreen(Screen):
- NAME = "imei"
-
- def __init__(self):
- super().__init__()
- self.meta = imei_screen
-
- def initialization(self):
-
- imei = EventMesh.publish(constants.EVENT.GET_IMEI)
- imei_qr_data = str(imei)
- imei_qr.update(imei_qr_data,len(imei_qr_data))
- imei_label.set_text(imei)
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-class AppScreen(Screen):
- NAME = "app"
-
- def __init__(self):
- super().__init__()
- self.meta = app_screen
- def initialization(self):
- imei = EventMesh.publish(constants.EVENT.GET_IMEI)
- app_label.set_text(imei)
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-# -------------------------------------------brightness screen----------------------------------------------------------
-brightness_screen = lv.obj()
-print("brightness_screen")
-brightness_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-brightness_title = lv.label(brightness_screen)
-brightness_title.set_pos(0, 10)
-brightness_title.set_size(240, 40)
-brightness_title.set_text("屏幕调节")
-brightness_title.set_long_mode(lv.label.LONG.WRAP)
-brightness_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-brightness_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_label1 = lv.label(brightness_screen)
-brightness_label1.set_pos(10, 70)
-brightness_label1.set_size(230, 40)
-brightness_label1.set_text("亮度:")
-brightness_label1.set_long_mode(lv.label.LONG.WRAP)
-brightness_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-brightness_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_bar = lv.bar(brightness_screen)
-brightness_bar.set_pos(20, 100)
-brightness_bar.set_size(200, 25)
-brightness_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-brightness_bar.set_mode(lv.bar.MODE.NORMAL)
-brightness_bar.set_value(50, lv.ANIM.OFF)
-brightness_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-brightness_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-
-brightness_reduce_imgbtn = lv.img(brightness_screen)
-brightness_reduce_imgbtn.set_pos(5, 195)
-brightness_reduce_imgbtn.set_size(110, 46)
-brightness_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-brightness_reduce_imgbtn.set_src("E:/static/reduce_btn.png")
-brightness_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-brightness_add_imgbtn = lv.img(brightness_screen)
-brightness_add_imgbtn.set_pos(125, 195)
-brightness_add_imgbtn.set_size(110, 46)
-brightness_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-brightness_add_imgbtn.set_src("E:/static/add_btn.png")
-brightness_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_label_time = lv.label(brightness_screen)
-brightness_label_time.set_pos(10, 150)
-brightness_label_time.set_size(80, 30)
-brightness_label_time.set_text("时间:")
-brightness_label_time.set_long_mode(lv.label.LONG.WRAP)
-brightness_label_time.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-brightness_label_time.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_time_reduce_img = lv.img(brightness_screen)
-brightness_time_reduce_img.set_pos(90, 145)
-brightness_time_reduce_img.set_size(30, 34)
-brightness_time_reduce_img.set_src("E:/static/time_up2.png")
-brightness_time_reduce_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_time_reduce_imgbtn= lv.img(brightness_screen)
-brightness_time_reduce_imgbtn.set_size(80, 45)
-brightness_time_reduce_imgbtn.set_pos(90, 140)
-brightness_time_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-
-brightness_label_time_text = lv.label(brightness_screen)
-brightness_label_time_text.set_pos(130, 152)
-brightness_label_time_text.set_size(60, 30)
-brightness_label_time_text.set_text("5秒")
-brightness_label_time_text.set_long_mode(lv.label.LONG.WRAP)
-brightness_label_time_text.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-brightness_label_time_text.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_time_add_img = lv.img(brightness_screen)
-brightness_time_add_img.set_pos(190, 145)
-brightness_time_add_img.set_size(30, 34)
-brightness_time_add_img.set_src("E:/static/time_up1.png")
-brightness_time_add_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-brightness_time_add_imgbtn= lv.img(brightness_screen)
-brightness_time_add_imgbtn.set_size(70, 45)
-brightness_time_add_imgbtn.set_pos(170, 140)
-brightness_time_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-
-
-
-class BrightnessScreen(Screen):
- NAME = "brightness"
-
- def __init__(self):
- super().__init__()
- self.level = 6
- self.time = 10
- self.read_data = {}
- self.meta = brightness_screen
- brightness_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)),
- lv.EVENT.CLICKED, None)
- brightness_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_level(e)),
- lv.EVENT.CLICKED, None)
-
- brightness_time_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_time_level(e)),
- lv.EVENT.CLICKED, None)
-
- brightness_time_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_time_level(e)),
- lv.EVENT.CLICKED, None)
- def initialization(self):
- self.level = EventMesh.publish("get_brightness_level")
- self.time = EventMesh.publish("get_brightness_time")
- print("self.time:{}".format(self.time))
- if self.time == None:
- self.time = 5
- brightness_label_time_text.set_text("{}秒".format(self.time))
- self.show_bar()
- def add_level(self, e):
- EventMesh.publish("push_add_brightness_level")
- self.level = EventMesh.publish("get_brightness_level")
- print("self.level:{}".format(self.level))
- self.show_bar()
-
- def reduce_level(self, e):
- EventMesh.publish("push_reduce_brightness_level")
- self.level = EventMesh.publish("get_brightness_level")
- self.show_bar()
-
- def reduce_time_level(self, e):
- if self.time > 5:
- self.time-=5
- EventMesh.publish("set_brightness_time",self.time)
- self.read_data = EventMesh.publish("get_storage_data")
- self.read_data["brightness_time"] = self.time
-
- EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
- ujson.dump(self.read_data,fd)
- brightness_label_time_text.set_text("{}秒".format(self.time))
- print("reduce_time_level:{}".format(self.read_data))
-
- def add_time_level(self, e):
- self.time+=5
- if self.time >= 30:
- self.time = 30
- EventMesh.publish("set_brightness_time",self.time)
- self.read_data = EventMesh.publish("get_storage_data")
- self.read_data["brightness_time"] = self.time
-
- EventMesh.publish("set_storage_data", self.read_data)
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
- ujson.dump(self.read_data,fd)
- brightness_label_time_text.set_text("{}秒".format(self.time))
- print("add_time_level:{}".format(self.read_data))
-
-
-
- def show_bar(self):
- if self.level == None:
- self.level = 6
- brightness_bar.set_value((100 // 10) * self.level, lv.ANIM.OFF)
-
-
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
-
-class VolumeScreen(Screen):
- NAME = "volume"
-
- def __init__(self):
- super().__init__()
- self.meta = volume_screen
- volume_phone_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "phonering"})), lv.EVENT.CLICKED, None)
- volume_message_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "msgvolume"})), lv.EVENT.CLICKED, None)
- volume_alarm_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.load_screen(e, {"screen": "alarmvolume"})), lv.EVENT.CLICKED, None)
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
-
-
-class PhoneringScreen(Screen):
- NAME = "phonering"
-
- def __init__(self):
- super().__init__()
- self.level = 0
- self.meta = phonering_screen
- phonering_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)),
- lv.EVENT.CLICKED, None)
- phonering_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_level(e)),
- lv.EVENT.CLICKED, None)
- phonering_add_imgbtn.set_ext_click_area(20)
- phonering_reduce_imgbtn.set_ext_click_area(20)
-
- def add_level(self, e):
- EventMesh.publish("push_add_phonering_level")
- self.level = EventMesh.publish("get_phonering_level")
- self.show_bar()
-
- def reduce_level(self, e):
- EventMesh.publish("push_reduce_phonering_level")
- self.level = EventMesh.publish("get_phonering_level")
- self.show_bar()
-
- def show_bar(self):
- phonering_bar.set_value((100 // 7) * self.level, lv.ANIM.OFF)
-
- def initialization(self):
- self.level = EventMesh.publish("get_phonering_level")
- self.show_bar()
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "volume"})
-
- def done_left_to_right(self):
- pass
-
- def done_right_to_left(self):
- pass
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "volume"})
-
-
-
-class AlarmvolumeScreen(Screen):
- NAME = "alarmvolume"
-
- def __init__(self):
- super().__init__()
- self.level = 0
- self.meta = alarmvolume_screen
- alarmvolume_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)),
- lv.EVENT.CLICKED, None)
- alarmvolume_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_level(e)),
- lv.EVENT.CLICKED, None)
-
- def add_level(self, e):
- EventMesh.publish("push_add_alarmvolume_level")
- self.level = EventMesh.publish("get_alarmvolume_level")
- self.show_bar()
-
- def reduce_level(self, e):
- EventMesh.publish("push_reduce_alarmvolume_level")
- self.level = EventMesh.publish("get_alarmvolume_level")
- self.show_bar()
-
- def show_bar(self):
- alarmvolume_bar.set_value((100 // 7) * self.level, lv.ANIM.OFF)
-
- def initialization(self):
- self.level = EventMesh.publish("get_alarmvolume_level")
- self.show_bar()
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "volume"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "volume"})
-
-
-
-class MsgvolumeScreen(Screen):
- NAME = "msgvolume"
-
- def __init__(self):
- super().__init__()
- self.level = 0
- self.meta = msgvolume_screen
- msgvolume_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_level(e)),
- lv.EVENT.CLICKED, None)
- msgvolume_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_level(e)),
- lv.EVENT.CLICKED, None)
-
- def add_level(self, e):
- EventMesh.publish("push_add_msgvolume_level")
- self.level = EventMesh.publish("get_msgvolume_level")
- self.show_bar()
-
- def reduce_level(self, e):
- EventMesh.publish("push_reduce_msgvolume_level")
- self.level = EventMesh.publish("get_msgvolume_level")
- self.show_bar()
-
- def show_bar(self):
- msgvolume_bar.set_value((100 // 7) * self.level, lv.ANIM.OFF)
-
- def initialization(self):
- self.level = EventMesh.publish("get_msgvolume_level")
- self.show_bar()
-
- def done_return(self):
- EventMesh.publish("load_screen", {"screen": "volume"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
- def btn8_press(self):
- EventMesh.publish("load_screen", {"screen": "volume"})
-
-
-
-#-----------------------------------------Total--volum-------------------------------
-
-volume_adjust_screen = lv.obj()
-print("volume_adjust_screen")
-volume_adjust_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-totalvolume_title = lv.label(volume_adjust_screen)
-totalvolume_title.set_pos(0, 10)
-totalvolume_title.set_size(240, 40)
-totalvolume_title.set_text("铃声调节")
-totalvolume_title.set_long_mode(lv.label.LONG.WRAP)
-totalvolume_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
-totalvolume_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-totalvolume_label1 = lv.label(volume_adjust_screen)
-totalvolume_label1.set_pos(10, 70)
-totalvolume_label1.set_size(230, 40)
-totalvolume_label1.set_text("铃声:")
-totalvolume_label1.set_long_mode(lv.label.LONG.WRAP)
-totalvolume_label1.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0)
-totalvolume_label1.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-totalvolume_bar = lv.bar(volume_adjust_screen)
-totalvolume_bar.set_pos(20, 100)
-totalvolume_bar.set_size(200, 25)
-totalvolume_bar.set_style_anim_time(1000, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-totalvolume_bar.set_mode(lv.bar.MODE.NORMAL)
-totalvolume_bar.set_value(50, lv.ANIM.OFF)
-totalvolume_bar.add_style(style_bar, lv.PART.MAIN | lv.STATE.DEFAULT)
-totalvolume_bar.add_style(style_bar_indic, lv.PART.INDICATOR | lv.STATE.DEFAULT)
-
-totalvolume_reduce_imgbtn = lv.img(volume_adjust_screen)
-totalvolume_reduce_imgbtn.set_pos(5, 145)
-totalvolume_reduce_imgbtn.set_size(110, 46)
-totalvolume_reduce_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-totalvolume_reduce_imgbtn.set_src("E:/static/reduce_btn.png")
-totalvolume_reduce_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-
-totalvolume_add_imgbtn = lv.img(volume_adjust_screen)
-totalvolume_add_imgbtn.set_pos(125, 145)
-totalvolume_add_imgbtn.set_size(110, 46)
-totalvolume_add_imgbtn.add_flag(lv.obj.FLAG.CLICKABLE)
-totalvolume_add_imgbtn.set_src("E:/static/add_btn.png")
-totalvolume_add_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-class totalvolumeScreen(Screen):
- NAME = "totalvolume"
-
- def __init__(self):
- super().__init__()
- self.meta = volume_adjust_screen
- totalvolume_add_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)),
- lv.EVENT.CLICKED, None)
- totalvolume_reduce_imgbtn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)),
- lv.EVENT.CLICKED, None)
- self.read_data = {}
- self.volum_size = 8
- self.aud = audio.Audio(0)
- self.aud.set_pa(Pin.GPIO29)
-
- def initialization(self):
- self.read_data = EventMesh.publish("get_storage_data")
- # print("self.read_data:{}".format(self.read_data))
- num = EventMesh.publish("get_volum_size")
- if num == None:
- self.volum_size = 8
- else:
- self.volum_size = num
- self.aud.setVolume(self.volum_size)
- self.show_bar(0)
-
- def add_volum_size(self, e):
- self.volum_size+=2
- if self.volum_size >= 11:
- self.volum_size = 11
- self.show_bar(1)
-
- def reduce_volum_size(self, e):
-
- self.volum_size -= 2
- if self.volum_size < 0:
- self.volum_size = 0
- self.show_bar(1)
-
- def show_bar(self,msg):
- totalvolume_bar.set_value((100 // 11) * self.volum_size, lv.ANIM.OFF)
- if msg == 1:
- self.read_data = EventMesh.publish("get_storage_data")
- self.read_data["volum"] = self.volum_size
- self.aud.setVolume(self.volum_size)
- EventMesh.publish("set_storage_data", self.read_data)
- EventMesh.publish("set_volum_size",self.volum_size)
- # print("self.read_data:size :{}".format(self.read_data))
- with open("/ext/static/storage_file/config.json","w",encoding="utf-8") as fd:
- ujson.dump(self.read_data,fd)
- self.aud.play(1, 1, 'E:/static/audio_audio_haixiu.mp3') #播放声音
-
- def Close(self):
- self.aud.stop()
-
- def done_return(self):
- self.aud.stop()
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn1_release(self):
- EventMesh.publish("load_screen", {"screen": "setting"})
-
- def btn8_press(self):
- EventMesh.publish("watch_top_show")
- EventMesh.publish("load_screen", {"screen": "main_menu"})
Version="810M_D10_V1.0"
-Build_Time="2023-07-20 15:01:42"
+Build_Time="2023-07-21 9:46:53"
import main_init
-main_init.main_init()
\ No newline at end of file
+main_init()
\ No newline at end of file