global toolbox_screen,toolbox_text_img,toolbox_cont,toolbox_step_img,toolbox_weather_img ,toolbox_alarm_img ,\
toolbox_countdown_img,toolbox_stopwatch_img
if toolbox_screen == None:
- tool_set_y = 0
+ tool_set_y = 5
toolbox_screen = lv.obj()
print("toolbox_screen")
toolbox_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
# toolbox_text_img.set_size(90, 30)
# 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_title = lv.label(toolbox_screen)
- toolbox_title.set_pos(0, 5)
- toolbox_title.set_size(128, 20)
- toolbox_title.set_text("工具箱")
- toolbox_title.set_long_mode(lv.label.LONG.WRAP)
- toolbox_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
- toolbox_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ # toolbox_title = lv.label(toolbox_screen)
+ # toolbox_title.set_pos(0, 5)
+ # toolbox_title.set_size(128, 20)
+ # toolbox_title.set_text("工具箱")
+ # toolbox_title.set_long_mode(lv.label.LONG.WRAP)
+ # toolbox_title.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ # toolbox_title.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
toolbox_cont = lv.obj(toolbox_screen)
- toolbox_cont.set_pos(0, 25)
- toolbox_cont.set_size(128, 128-25)
+ toolbox_cont.set_pos(0, 0)
+ toolbox_cont.set_size(128, 128)
toolbox_cont.add_style(toolbox_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
self.phone_list = []
self.button = 0
self.mute_state = 0
+ on_call_volum_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
def show_num(self):
global on_call_screen_tab_label
charge_out_screen = None
charge_out_screen_label = None
-#没有设置紧急联系人的号码
+#
class chargeOutScreen(Screen):
NAME = "charge_out"
def __init__(self):
-setting_cont_y = 0
+setting_cont_y = 5
setting_screen = lv.obj()
print("setting_screen")
setting_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
# setting_imei_img.set_size(90, 30)
# setting_imei_img.set_src("U:/static/setting/setting_text.png")
# setting_imei_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
-setting_title = lv.label(setting_screen)
-setting_title.set_pos(0, 5)
-setting_title.set_size(128, 20)
-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_title = lv.label(setting_screen)
+# setting_title.set_pos(0, 5)
+# setting_title.set_size(128, 20)
+# 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 = lv.obj(setting_screen)
-setting_cont.set_pos(0, 25)
-setting_cont.set_size(128, 128-25)
+setting_cont.set_pos(0, 0)
+setting_cont.set_size(128, 128)
setting_cont.add_style(setting_cont_style,lv.PART.MAIN | lv.STATE.DEFAULT)
# setting_language = lv.btn(setting_cont)
with open("/usr/static/storage_file/config.json","w",encoding="utf-8") as fd:
ujson.dump(read_data,fd)
self.count = 0
- self.aud.play(1, 1, '/usr/static/R_VOLUME_SET_1.mp3') #文件名前面要加上路径
+ self.aud.play(1, 1, 'U:/static/R_VOLUME_SET_1.mp3') #文件名前面要加上路径
self.timer.start(1*1000,1,self.power_off)
def power_off(self,*args):
incoming_call_answer = lv.img(incoming_call_screen)
incoming_call_answer.set_size(64, 64)
incoming_call_answer.add_flag(lv.obj.FLAG.CLICKABLE)
- incoming_call_answer.set_pos(30, 220)
+ incoming_call_answer.set_pos(150, 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_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.set_pos(30, 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_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)),
self.phone_num = ''
self.phone_list = []
self.button = 0
+ self.mute_btn = 0
def initialization(self):
EventMesh.publish("set_UI_high_priority", 1)
on_call_volum_reduce = lv.img(on_call_obj)
on_call_volum_reduce.set_size(36, 36)
- 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.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)),
- lv.EVENT.CLICKED, None)
+
+
+ on_call_volum_reduce_btn = lv.label(on_call_obj)
+ on_call_volum_reduce_btn.set_pos(0, 170)
+ on_call_volum_reduce_btn.add_flag(lv.obj.FLAG.CLICKABLE)
+ on_call_volum_reduce_btn.set_size(60, 50)
+ on_call_volum_reduce_btn.set_text(" ")
+ on_call_volum_reduce_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.reduce_volum_size(e)),
+ lv.EVENT.CLICKED, None)
on_call_volum_add = lv.img(on_call_obj)
on_call_volum_add.set_size(36, 36)
- 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.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)),
- lv.EVENT.CLICKED, None)
+
+
+ on_call_volum_add_btn = lv.label(on_call_obj)
+ on_call_volum_add_btn.set_pos(180, 170)
+ on_call_volum_add_btn.add_flag(lv.obj.FLAG.CLICKABLE)
+ on_call_volum_add_btn.set_size(60, 50)
+ on_call_volum_add_btn.set_text(" ")
+ on_call_volum_add_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.add_volum_size(e)),
+ lv.EVENT.CLICKED, None)
on_call_volum_label = lv.label(on_call_obj)
on_call_label_name.set_text(name)
# on_call_label.set_text(str(self.meta_info))
on_call_second_label.set_text("00:00")
+ on_call_volum_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
self.phone_num = ''
self.phone_list = []
self.button = 0
-
+ self.mute_btn = 0
def show_num(self):
global on_call_screen_tab_label
def open_volum_show(self, e):
global on_call_screen_tab,on_call_screen,on_call_obj
+ if self.mute_btn == 0:#默认是开启
+ self.mute_btn = 1
+ on_call_volum_label.set_style_text_color(lv.color_make(128, 128, 128), lv.STATE.DEFAULT)
+ else:
+ on_call_volum_label.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
+ self.mute_btn = 0
# self.aud.setVolume(0)
# if self.open_volum_state == 1:
# self.open_volum_state = 0
def show_bar(self,msg):
on_call_bar.set_value((100 // 11) * self.volum_size, lv.ANIM.OFF)
if msg == 1:
-
-
self.aud.setVolume(self.volum_size)
-
EventMesh.publish("set_volum_size",self.volum_size)
if on_call_screen_tab != None:
on_call_screen_tab.add_flag(lv.obj.FLAG.HIDDEN)
self.show_num()
-
-
def refresh(self,e):
+ EventMesh.publish("publish_message_event_ui",{"func":self.refresh_do,"data":0})
+
+ def refresh_do(self,data):
# print("call_in")
global on_call_screen,on_call_label_name,on_call_second_label ,on_call_hangup
min = self.count_sec/60
def Close(self):
self.system_init_timer.stop()
-
+charge_in_screen = None
+charge_in_screen_label = None
+
+#正在充电
+class chargeInScreen(Screen):
+ NAME = "charge_in"
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+ self.count = 0
+ self.timer = osTimer()
+
+ def initialization(self):
+ global charge_in_screen ,charge_in_screen_label
+ if charge_in_screen == None :
+ charge_in_screen = lv.obj()
+ print("charge_in_screen")
+ charge_in_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+ # add style for watchface
+ charge_in_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
+ #进入图片
+
+ charge_in_screen_label = lv.label(charge_in_screen)
+ charge_in_screen_label.set_pos(0, 170)
+ charge_in_screen_label.set_size(240, 20)
+ charge_in_screen_label.set_text(" ")
+ charge_in_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ charge_in_screen_label.set_long_mode(lv.label.LONG.WRAP)
+ charge_in_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
+
+ self.meta = charge_in_screen
+
+
+ def post_processor_after_initialization(self):
+ global charge_in_screen_label
+ self.count = 0
+ self.timer.start(1000,1,self.timer_cb_onescond)
+ charge_in_screen_label.set_text("正在充电")
+
+ def Close(self):
+ self.timer.stop()
+
+ def timer_cb_onescond(self,e):
+ EventMesh.publish("system_sleep_rest")#防止黑屏
+ self.count+=1
+ if self.count >= 5:
+ self.count = 0
+ EventMesh.publish("return_prev_screen")
+
+
+ def done_left_to_right(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_right_to_left(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_bottom_to_top(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_top_to_bottom(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_return(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_click(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+
+ def btn8_press(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def btn1_press(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def btn1_release(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+
+
+charge_out_screen = None
+charge_out_screen_label = None
+
+#充电已移出
+class chargeOutScreen(Screen):
+ NAME = "charge_out"
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+ self.count = 0
+ self.timer = osTimer()
+
+
+ def initialization(self):
+ global charge_out_screen ,charge_out_screen_label
+ if charge_out_screen == None :
+ charge_out_screen = lv.obj()
+ print("charge_out_screen")
+ charge_out_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+ # add style for watchface
+ charge_out_screen.add_style(style_screen, lv.PART.MAIN|lv.STATE.DEFAULT)
+ #进入图片
+
+ charge_out_screen_label = lv.label(charge_out_screen)
+ charge_out_screen_label.set_pos(0, 170)
+ charge_out_screen_label.set_size(240, 20)
+ charge_out_screen_label.set_text(" ")
+ charge_out_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ charge_out_screen_label.set_long_mode(lv.label.LONG.WRAP)
+ charge_out_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
+
+ self.meta = charge_out_screen
+
+
+
+ def post_processor_after_initialization(self):
+ global charge_out_screen_label
+ self.count = 0
+ self.timer.start(1000,1,self.timer_cb_onescond)
+ charge_out_screen_label.set_text("充电已移出")
+
+ def Close(self):
+ self.timer.stop()
+
+ def timer_cb_onescond(self,e):
+ EventMesh.publish("system_sleep_rest")#防止黑屏
+ self.count+=1
+ if self.count >= 5:
+ self.count = 0
+ EventMesh.publish("return_prev_screen")
+
+
+ def done_left_to_right(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_right_to_left(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_bottom_to_top(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_top_to_bottom(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_return(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def done_click(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+
+ def btn8_press(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def btn1_press(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+ def btn1_release(self):
+ EventMesh.publish("return_prev_screen")
+ pass
+
#from usr.ui_WatchFaceScreen import WatchFaceScreen
class UI(object):