self.count+=1
def one(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("1")
self.phone_num = ''.join(self.phone_list)
def two(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("2")
self.phone_num = ''.join(self.phone_list)
def three(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("3")
self.phone_num = ''.join(self.phone_list)
def four(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("4")
self.phone_num = ''.join(self.phone_list)
def five(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("5")
self.phone_num = ''.join(self.phone_list)
def six(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("6")
self.phone_num = ''.join(self.phone_list)
def seven(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("7")
self.phone_num = ''.join(self.phone_list)
def eight(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("8")
self.phone_num = ''.join(self.phone_list)
def nine(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
+ #self.phone_list.pop(0)
return
self.phone_list.append("9")
self.phone_num = ''.join(self.phone_list)
def zero(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字
+ #self.phone_list.pop(0)
return
self.phone_list.append("0")
self.phone_num = ''.join(self.phone_list)
def endpressed_start(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字
+ #self.phone_list.pop(0)
return
if self.button == 1:#长按
def hash(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:#限制拨号数量20个数字
+ #self.phone_list.pop(0)
return
self.phone_list.append("#")
self.phone_num = ''.join(self.phone_list)
voiceCall.callStart(self.phone_num)
def show_num(self):
+ #print("self.phone_num ",self.phone_num,self.phone_list)
len_t = len(self.phone_list)*40
if len_t > 230:
len_t = 230
self.g_end = 0
self.total = 0
self.time_tmp = 0
+ self.timer_cb = 0
def initialization(self):
global countdown_screen ,countdown_title,countdown_hour ,countdown_mao ,countdown_mao ,countdown_mao1 ,\
# -------------------------------------------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_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
dialswitch_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-dialswitch_btn1 = lv.btn(dialswitch_screen)
-dialswitch_btn1.set_size(240,54)
-dialswitch_btn1.set_pos(0, 50)
-dialswitch_btn1.add_style(style_contact_btn, lv.PART.MAIN | lv.STATE.PRESSED)
-dialswitch_btn1.add_style(style_btn, lv.PART.MAIN | lv.STATE.DEFAULT)
-dialswitch_btn1_label = lv.label(dialswitch_btn1)
-dialswitch_btn1_label.set_text("表盘1")
-dialswitch_btn1_label.align(lv.ALIGN.LEFT_MID, 10, 0)
+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_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)
+
+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()
self.meta = dialswitch_screen
self.read_data = {}
self.watchface_style_num = "Watchface1"
- dialswitch_btn1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface01(e)),
- lv.EVENT.PRESSED, None)
+ 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()
- dialswitch_btn2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.watchface02(e)),
- lv.EVENT.PRESSED, None)
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":
- btn1_switch.add_state(lv.STATE.CHECKED)
- btn2_switch.clear_state(lv.STATE.CHECKED)
+ self.dial_num = 1
else:
- btn1_switch.clear_state(lv.STATE.CHECKED)
- btn2_switch.add_state(lv.STATE.CHECKED)
-
+ self.dial_num = 2
+ self.show_info()
+
+
def watchface01(self,e):
- btn1_switch.add_state(lv.STATE.CHECKED)
- btn2_switch.clear_state(lv.STATE.CHECKED)
+ 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"] = "Watchface1"
+ 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", "Watchface1")
+ EventMesh.publish("set_change_face", "Watchface{}".format(self.dial_num))
EventMesh.publish("watch_top_show")
EventMesh.publish("load_screen", {"screen": "main_menu"})
- def watchface02(self,e):
- btn1_switch.clear_state(lv.STATE.CHECKED)
- btn2_switch.add_state(lv.STATE.CHECKED)
- self.read_data = EventMesh.publish("get_storage_data")
- self.read_data["watchface"] = "Watchface2"
- 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", "Watchface2")
- 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"})