From: d15521469561 Date: Wed, 19 Apr 2023 09:29:12 +0000 (+0800) Subject: 1.主界面不显示步数 X-Git-Url: http://git.snicker.com.cn/img/static/gitweb.css?a=commitdiff_plain;h=32a93641235b5c3abca21828fe9af2fbb0d20b22;p=mirrors%2FASR1603_G5.git 1.主界面不显示步数 2.表盘切换存储和显示 --- diff --git a/3.code/1.watch/2.code/static/find_phone.png b/3.code/1.watch/2.code/static/find_phone.png new file mode 100644 index 00000000..732b1c3e Binary files /dev/null and b/3.code/1.watch/2.code/static/find_phone.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_app_qrcode.png b/3.code/1.watch/2.code/static/setting/menu_app_qrcode.png new file mode 100644 index 00000000..c3bc579a Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_app_qrcode.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_bright.png b/3.code/1.watch/2.code/static/setting/menu_bright.png new file mode 100644 index 00000000..fec820d1 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_bright.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_imei_qrcode.png b/3.code/1.watch/2.code/static/setting/menu_imei_qrcode.png new file mode 100644 index 00000000..2e6a3797 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_imei_qrcode.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_language.png b/3.code/1.watch/2.code/static/setting/menu_language.png new file mode 100644 index 00000000..eea06312 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_language.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_poweroff.png b/3.code/1.watch/2.code/static/setting/menu_poweroff.png new file mode 100644 index 00000000..c8bc1a9f Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_poweroff.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_restore.png b/3.code/1.watch/2.code/static/setting/menu_restore.png new file mode 100644 index 00000000..4f790aa7 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_restore.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_theme_switch.png b/3.code/1.watch/2.code/static/setting/menu_theme_switch.png new file mode 100644 index 00000000..186bf8c7 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_theme_switch.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_upgrade.png b/3.code/1.watch/2.code/static/setting/menu_upgrade.png new file mode 100644 index 00000000..01202406 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_upgrade.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_version.png b/3.code/1.watch/2.code/static/setting/menu_version.png new file mode 100644 index 00000000..0b961822 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_version.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_volume.png b/3.code/1.watch/2.code/static/setting/menu_volume.png new file mode 100644 index 00000000..db3848e8 Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_volume.png differ diff --git a/3.code/1.watch/2.code/static/setting/menu_watch_switch.png b/3.code/1.watch/2.code/static/setting/menu_watch_switch.png new file mode 100644 index 00000000..bbdf05bb Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/menu_watch_switch.png differ diff --git a/3.code/1.watch/2.code/static/setting/setting_text.png b/3.code/1.watch/2.code/static/setting/setting_text.png new file mode 100644 index 00000000..da32b21c Binary files /dev/null and b/3.code/1.watch/2.code/static/setting/setting_text.png differ diff --git a/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_ALARM.png b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_ALARM.png new file mode 100644 index 00000000..43a640a7 Binary files /dev/null and b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_ALARM.png differ diff --git a/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_COUNTDOWN.png b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_COUNTDOWN.png new file mode 100644 index 00000000..783242a0 Binary files /dev/null and b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_COUNTDOWN.png differ diff --git a/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_STEP.png b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_STEP.png new file mode 100644 index 00000000..13444069 Binary files /dev/null and b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_STEP.png differ diff --git a/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_STOPWATCH.png b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_STOPWATCH.png new file mode 100644 index 00000000..ad52858d Binary files /dev/null and b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_STOPWATCH.png differ diff --git a/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_WEATHER.png b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_WEATHER.png new file mode 100644 index 00000000..afd87172 Binary files /dev/null and b/3.code/1.watch/2.code/static/tool/IMAGE_SECMENU_WEATHER.png differ diff --git a/3.code/1.watch/2.code/static/tool/tool_text.png b/3.code/1.watch/2.code/static/tool/tool_text.png new file mode 100644 index 00000000..cfc75d23 Binary files /dev/null and b/3.code/1.watch/2.code/static/tool/tool_text.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/0_main2_weather.png b/3.code/1.watch/2.code/static/watch_plate/style_2/0_main2_weather.png new file mode 100644 index 00000000..3663868f Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/0_main2_weather.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/1_main2_weather.png b/3.code/1.watch/2.code/static/watch_plate/style_2/1_main2_weather.png new file mode 100644 index 00000000..bc1edac1 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/1_main2_weather.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/2_main2_weather.png b/3.code/1.watch/2.code/static/watch_plate/style_2/2_main2_weather.png new file mode 100644 index 00000000..26a5e63a Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/2_main2_weather.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/3_main2_weather.png b/3.code/1.watch/2.code/static/watch_plate/style_2/3_main2_weather.png new file mode 100644 index 00000000..b1b9abd7 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/3_main2_weather.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/degree.png b/3.code/1.watch/2.code/static/watch_plate/style_2/degree.png new file mode 100644 index 00000000..080a3fbf Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/degree.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/0.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/0.png new file mode 100644 index 00000000..b63f4d30 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/0.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/1.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/1.png new file mode 100644 index 00000000..23ce1cb9 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/1.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/2.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/2.png new file mode 100644 index 00000000..75606130 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/2.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/3.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/3.png new file mode 100644 index 00000000..8aa96644 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/3.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/4.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/4.png new file mode 100644 index 00000000..86c53aaa Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/4.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/5.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/5.png new file mode 100644 index 00000000..67ee008e Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/5.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/6.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/6.png new file mode 100644 index 00000000..c028667b Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/6.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/7.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/7.png new file mode 100644 index 00000000..bc794b97 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/7.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/8.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/8.png new file mode 100644 index 00000000..f2580de8 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/8.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/time/9.png b/3.code/1.watch/2.code/static/watch_plate/style_2/time/9.png new file mode 100644 index 00000000..b0737826 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/time/9.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/0_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/0_week.png new file mode 100644 index 00000000..4461b249 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/0_week.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/1_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/1_week.png new file mode 100644 index 00000000..3e9729c8 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/1_week.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/2_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/2_week.png new file mode 100644 index 00000000..e8becc59 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/2_week.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/3_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/3_week.png new file mode 100644 index 00000000..1cbbe77f Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/3_week.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/4_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/4_week.png new file mode 100644 index 00000000..06223678 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/4_week.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/5_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/5_week.png new file mode 100644 index 00000000..e080f60a Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/5_week.png differ diff --git a/3.code/1.watch/2.code/static/watch_plate/style_2/week/6_week.png b/3.code/1.watch/2.code/static/watch_plate/style_2/week/6_week.png new file mode 100644 index 00000000..1dadb7b8 Binary files /dev/null and b/3.code/1.watch/2.code/static/watch_plate/style_2/week/6_week.png differ diff --git a/3.code/1.watch/2.code/ui.py b/3.code/1.watch/2.code/ui.py index 3df09c6e..51fd43b3 100644 --- a/3.code/1.watch/2.code/ui.py +++ b/3.code/1.watch/2.code/ui.py @@ -1935,7 +1935,7 @@ class StepScreen(Screen): self.step = 0 self.timer = osTimer() - def post_processor_after_initialization(self): + def initialization(self): step = EventMesh.publish(constants.EVENT.GET_STEP) step_label_01.set_text("{}æ­¥".format(step[0])) self.timer.start(5000, 1, self.revcing) @@ -3402,7 +3402,7 @@ class UI(object): for scr in self.screen_list: if scr.NAME == msg["screen"]: # 每次屏幕切换开始息屏倒计时 - + self.__lcd_on() if scr.NAME == 'main_menu': self.main_flag = 1 else : @@ -3422,15 +3422,13 @@ class UI(object): self.screen.load() self.lv.scr_load_anim(self.screen.get_meta(),lv.SCR_LOAD_ANIM.MOVE_BOTTOM,100,0,0) self.screen.post_processor_after_initialization() - print("__lcd_on......01.........") - self.__lcd_on() def load_screen_animtop(self, topic, msg): print("msg={}".format(msg)) for scr in self.screen_list: if scr.NAME == msg["screen"]: # 每次屏幕切换开始息屏倒计时 - + self.__lcd_on() if scr.NAME == 'main_menu': self.main_flag = 1 else : @@ -3450,8 +3448,8 @@ class UI(object): self.screen.load() self.lv.scr_load_anim(self.screen.get_meta(),lv.SCR_LOAD_ANIM.MOVE_TOP,100,0,0) self.screen.post_processor_after_initialization() - print("__lcd_on......02.........") - self.__lcd_on() + + diff --git a/3.code/1.watch/2.code/ui_WatchFaceScreen.py b/3.code/1.watch/2.code/ui_WatchFaceScreen.py index e6c8afd8..a4c4f906 100644 --- a/3.code/1.watch/2.code/ui_WatchFaceScreen.py +++ b/3.code/1.watch/2.code/ui_WatchFaceScreen.py @@ -5,17 +5,20 @@ from ext import EventMesh import osTimer from ext import constants from ext.ui import Screen,style_screen +import ql_fs +import ujson 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_20.bin",20,0) -class Watchface2(): - NAME = "Watchface2" + +class Watchface1(): + NAME = "Watchface1" # # #表盘1 def __init__(self,main_menu): - print("Watchface2:__init__") + print("Watchface1:__init__") self.meta = lv.obj(main_menu) self.meta.set_size(240,320) @@ -70,48 +73,55 @@ class Watchface2(): # add style for watchface_res_stat_charge_in_img self.watchface_res_stat_charge_in_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - # #主图片 - # self.watchface1_bg_img = lv.img(self.meta) - # self.watchface1_bg_img.set_pos(int(0),int(40)) - # self.watchface1_bg_img.set_size(240,280) - # self.watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # self.watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) - # self.watchface1_bg_img.set_src("E:/static/watch_plate/style_1/bg.png") - # self.watchface1_bg_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + #主图片 + self.watchface1_bg_img = lv.img(self.meta) + self.watchface1_bg_img.set_pos(int(0),int(40)) + self.watchface1_bg_img.set_size(240,280) + self.watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) + self.watchface1_bg_img.set_src("E:/static/watch_plate/style_1/bg.png") + self.watchface1_bg_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #时间 - x = 30 + x = 40 y = 80 self.watchface1_time1_img = lv.img(self.meta) self.watchface1_time1_img.set_pos(int(x),int(y)) - self.watchface1_time1_img.set_size(56,56) + self.watchface1_time1_img.set_size(36,44) self.watchface1_time1_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time1_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_2/time/1.png") + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/1.png") self.watchface1_time1_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time2_img = lv.img(self.meta) - self.watchface1_time2_img.set_pos(int(x+60),int(y)) - self.watchface1_time2_img.set_size(56,56) + self.watchface1_time2_img.set_pos(int(x+36),int(y)) + self.watchface1_time2_img.set_size(36,44) self.watchface1_time2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time2_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_2/time/3.png") + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/3.png") self.watchface1_time2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_time3_img = lv.img(self.meta) + self.watchface1_time3_img.set_pos(int(x+36+36+4),int(y+11)) + self.watchface1_time3_img.set_size(8,24) + self.watchface1_time3_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_time3_img.add_flag(lv.obj.FLAG.CLICKABLE) + self.watchface1_time3_img.set_src("E:/static/watch_plate/style_1/time/colon.png") + self.watchface1_time3_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time4_img = lv.img(self.meta) - self.watchface1_time4_img.set_pos(int(x),int(y+20+56)) - self.watchface1_time4_img.set_size(56,56) + self.watchface1_time4_img.set_pos(int(x+36+36+4+12),int(y)) + self.watchface1_time4_img.set_size(36,44) self.watchface1_time4_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time4_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_2/time/2.png") + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/2.png") self.watchface1_time4_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time5_img = lv.img(self.meta) - self.watchface1_time5_img.set_pos(int(x+60),int(y+20+56)) - self.watchface1_time5_img.set_size(56,56) + self.watchface1_time5_img.set_pos(int(x+36+36+4+12+36),int(y)) + self.watchface1_time5_img.set_size(36,44) self.watchface1_time5_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time5_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_2/time/3.png") + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/3.png") self.watchface1_time5_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) # create style self.watchface1_style_default self.watchface1_style_default = lv.style_t() @@ -130,6 +140,11 @@ class Watchface2(): self.watchface1_style_default.set_pad_bottom(0) self.watchface1_style_default.set_text_font_v2("font_20.bin",20,0) #将外部字体库与该style对象绑定 + 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_v2("font_70.bin",70,0) + # self.watchface1_time1_text = lv.label(self.meta) # self.watchface1_time1_text.set_pos(44, 60) # self.watchface1_time1_text.set_size(190, 100) @@ -152,14 +167,14 @@ class Watchface2(): #日期 self.watchface1_date = lv.spangroup(self.meta) - self.watchface1_date.set_pos(int(30+56+20+56),int(100)) + self.watchface1_date.set_pos(int(24),int(131)) self.watchface1_date.set_size(84,25) self.watchface1_date.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_date.set_align(lv.TEXT_ALIGN.LEFT) self.watchface1_date.set_overflow(lv.SPAN_OVERFLOW.CLIP) self.watchface1_date.set_mode(lv.SPAN_MODE.BREAK) self.watchface1_date_span = self.watchface1_date.new_span() - self.watchface1_date_span.set_text("12月9") + self.watchface1_date_span.set_text("12月9日") self.watchface1_date_span.style.set_text_color(lv.color_make(0xe0,0xd7,0xd7)) self.watchface1_date_span.style.set_text_decor(lv.TEXT_DECOR.NONE) self.watchface1_date_span.style.set_size(100) @@ -168,70 +183,114 @@ class Watchface2(): # add style for main_style_1_spangroup_date self.watchface1_date.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) #星期 - # self.watchface1_week = lv.spangroup(self.meta) - # self.watchface1_week.set_pos(int(29),int(166)) - # self.watchface1_week.set_size(80,25) - # self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # self.watchface1_week.set_align(lv.TEXT_ALIGN.LEFT) - # self.watchface1_week.set_overflow(lv.SPAN_OVERFLOW.CLIP) - # self.watchface1_week.set_mode(lv.SPAN_MODE.BREAK) - # self.watchface1_week_span = self.watchface1_week.new_span() - # self.watchface1_week_span.set_text("星期四") - # self.watchface1_week_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - # self.watchface1_week_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - # self.watchface1_week.refr_mode() + self.watchface1_week = lv.spangroup(self.meta) + self.watchface1_week.set_pos(int(29),int(166)) + self.watchface1_week.set_size(80,25) + self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_week.set_align(lv.TEXT_ALIGN.LEFT) + self.watchface1_week.set_overflow(lv.SPAN_OVERFLOW.CLIP) + self.watchface1_week.set_mode(lv.SPAN_MODE.BREAK) + self.watchface1_week_span = self.watchface1_week.new_span() + self.watchface1_week_span.set_text("星期四") + self.watchface1_week_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + self.watchface1_week_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + self.watchface1_week.refr_mode() + # add style for main_style_1_spangroup_week + self.watchface1_week.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + + # #阴历 + # self.watchface1_lunar_calendar = lv.spangroup(self.meta) + # self.watchface1_lunar_calendar.set_pos(int(124),int(131)) + # self.watchface1_lunar_calendar.set_size(110,17) + # self.watchface1_lunar_calendar.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # self.watchface1_lunar_calendar.set_align(lv.TEXT_ALIGN.LEFT) + # self.watchface1_lunar_calendar.set_overflow(lv.SPAN_OVERFLOW.CLIP) + # self.watchface1_lunar_calendar.set_mode(lv.SPAN_MODE.BREAK) + # self.watchface1_lunar_calendar_span = self.watchface1_lunar_calendar.new_span() + # self.watchface1_lunar_calendar_span.set_text("三月初三") + # self.watchface1_lunar_calendar_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + # self.watchface1_lunar_calendar_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + # self.watchface1_lunar_calendar.refr_mode() # # add style for main_style_1_spangroup_week - # self.watchface1_week.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + # self.watchface1_lunar_calendar.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_week = lv.img(self.meta) - self.watchface1_week.set_pos(int(30+15),int(y+20+56+56+30)) - self.watchface1_week.set_size(90,30) - self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_week.set_src("E:/static/watch_plate/style_2/week/0_week.png") - self.watchface1_week.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + #计步 + self.watchface1_step_img = lv.img(self.meta) + self.watchface1_step_img.set_pos(int(130),int(160)) + self.watchface1_step_img.set_size(26,24) + self.watchface1_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_step_img.add_flag(lv.obj.FLAG.CLICKABLE) + self.watchface1_step_img.set_src("E:/static/watch_plate/style_1/step.png") + self.watchface1_step_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_step_txt = lv.spangroup(self.meta) + self.watchface1_step_txt.set_pos(int(170),int(163)) + self.watchface1_step_txt.set_size(70,25) + self.watchface1_step_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_step_txt.set_align(lv.TEXT_ALIGN.LEFT) + self.watchface1_step_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) + self.watchface1_step_txt.set_mode(lv.SPAN_MODE.BREAK) + self.watchface1_step_span = self.watchface1_step_txt.new_span() + self.watchface1_step_span.set_text("0") + self.watchface1_step_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + self.watchface1_step_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + #self.watchface1_week_step_span.style.set_text_font(lv.font_harmony_19) + self.watchface1_step_txt.refr_mode() + # add style for main_style_1_spangroup_week + self.watchface1_step_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + #心律 + self.watchface1_HB_img = lv.img(self.meta) + self.watchface1_HB_img.set_pos(int(53),int(198)) + self.watchface1_HB_img.set_size(30,27) + self.watchface1_HB_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_HB_img.add_flag(lv.obj.FLAG.CLICKABLE) + self.watchface1_HB_img.set_src("E:/static/watch_plate/style_1/heart.png") + self.watchface1_HB_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - #天气 - self.watchface1_temp_img = lv.img(self.meta) - self.watchface1_temp_img.set_pos(int(x+56+56+20),int(y+56+20)) - self.watchface1_temp_img.set_size(65,45) - self.watchface1_temp_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_temp_img.set_src("E:/static/watch_plate/style_2/0_main2_weather.png") - self.watchface1_temp_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_HB_txt = lv.spangroup(self.meta) + self.watchface1_HB_txt.set_pos(int(55),int(235)) + self.watchface1_HB_txt.set_size(80,25) + self.watchface1_HB_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_HB_txt.set_align(lv.TEXT_ALIGN.LEFT) + self.watchface1_HB_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) + self.watchface1_HB_txt.set_mode(lv.SPAN_MODE.BREAK) + self.watchface1_HB_span = self.watchface1_HB_txt.new_span() + self.watchface1_HB_span.set_text("0") + self.watchface1_HB_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + self.watchface1_HB_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + #self.watchface1_week_HB_span.style.set_text_font(lv.font_harmony_19) + self.watchface1_HB_txt.refr_mode() + # add style for main_style_1_spangroup_week + self.watchface1_HB_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_temp_degree = lv.img(self.meta) - self.watchface1_temp_degree.set_pos(int(x+56+56+65),int(215)) - self.watchface1_temp_degree.set_size(10,10) - self.watchface1_temp_degree.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_temp_degree.set_src("E:/static/watch_plate/style_2/degree.png") - self.watchface1_temp_degree.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + #血氧 + self.watchface1_SPO2_img = lv.img(self.meta) + self.watchface1_SPO2_img.set_pos(int(161),int(193)) + self.watchface1_SPO2_img.set_size(23,32) + self.watchface1_SPO2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_SPO2_img.add_flag(lv.obj.FLAG.CLICKABLE) + self.watchface1_SPO2_img.set_src("E:/static/watch_plate/style_1/blood.png") + self.watchface1_SPO2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + + self.watchface1_SPO2_txt = lv.spangroup(self.meta) + self.watchface1_SPO2_txt.set_pos(int(160),int(235)) + self.watchface1_SPO2_txt.set_size(80,25) + self.watchface1_SPO2_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_SPO2_txt.set_align(lv.TEXT_ALIGN.LEFT) + self.watchface1_SPO2_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) + self.watchface1_SPO2_txt.set_mode(lv.SPAN_MODE.BREAK) + self.watchface1_SPO2_span = self.watchface1_SPO2_txt.new_span() + self.watchface1_SPO2_span.set_text("0") + self.watchface1_SPO2_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + self.watchface1_SPO2_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + #self.watchface1_week_SPO2_span.style.set_text_font(lv.font_harmony_19) + self.watchface1_SPO2_txt.refr_mode() + # add style for main_style_1_spangroup_week + self.watchface1_SPO2_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_temp_txt = lv.label(self.meta) - self.watchface1_temp_txt.set_pos(int(x+56+56+39),int(215)) - self.watchface1_temp_txt.set_size(240-(x+56+56+34),30) - self.watchface1_temp_txt.set_align(lv.TEXT_ALIGN.LEFT) - self.watchface1_temp_txt.set_text("00") - self.watchface1_temp_txt.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_no_temp_txt = lv.spangroup(self.meta) - self.watchface1_no_temp_txt.set_pos(int(30+56+56+20),int(176)) - self.watchface1_no_temp_txt.set_size(80,30) - self.watchface1_no_temp_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_no_temp_txt.set_align(lv.TEXT_ALIGN.LEFT) - self.watchface1_no_temp_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) - self.watchface1_no_temp_txt.set_mode(lv.SPAN_MODE.BREAK) - self.watchface1_no_temp_span = self.watchface1_no_temp_txt.new_span() - self.watchface1_no_temp_span.set_text("无数据") - self.watchface1_no_temp_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - self.watchface1_no_temp_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - #self.watchface1_week_step_span.style.set_text_font(lv.font_harmony_19) - self.watchface1_no_temp_txt.refr_mode() - self.watchface1_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) - # add style for main_style_1_spangroup_week - self.watchface1_no_temp_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - def initialization(self): #获取信号 signal = EventMesh.publish("screen_get_sig") @@ -245,26 +304,14 @@ class Watchface2(): #print("publish_time:"+time) if time: self.__time(None, time) + hrValue = EventMesh.publish("get_old_hr_data") + self.__oldHrValue(None, hrValue) - connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态 - self.weather_data = EventMesh.publish("get_weather_data") - if connect != 0: - no_data = self.weather_data[8] - if no_data != 0: - type = self.weather_data[3] - if type == None: - self.__weather_type(None,None) - else: - self.__weather_type(None,type) - - temp = self.weather_data[4] - if temp == None: - self.__weather_value(None,None) - else: - self.__weather_value(None,temp) - else: - self.__weather_type(None,None) - self.__weather_value(None,None) + spo2Value = EventMesh.publish("get_old_spo2_data") + self.__oldSpo2Value(None, spo2Value) + # print("main get_step msg:{}".format(msg)) + step = EventMesh.publish(constants.EVENT.GET_STEP) + self.__stepValue(None, step[0]) def timerout_update(self): #获取信号 @@ -281,25 +328,13 @@ class Watchface2(): if time: self.__time(None, time) - connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态 - self.weather_data = EventMesh.publish("get_weather_data") - if connect != 0: - no_data = self.weather_data[8] - if no_data != 0: - type = self.weather_data[3] - if type == None: - self.__weather_type(None,None) - else: - self.__weather_type(None,type) + hrValue = EventMesh.publish("get_old_hr_data") + self.__oldHrValue(None, hrValue) - temp = self.weather_data[4] - if temp == None: - self.__weather_value(None,None) - else: - self.__weather_value(None,temp) - else: - self.__weather_type(None,None) - self.__weather_value(None,None) + spo2Value = EventMesh.publish("get_old_spo2_data") + self.__oldSpo2Value(None, spo2Value) + step = EventMesh.publish(constants.EVENT.GET_STEP) + self.__stepValue(None, step[0]) def __time(self, event, msg): #时间 @@ -308,12 +343,12 @@ class Watchface2(): min1_chose = (msg[0][1])//10%10 min2_chose = (msg[0][1])%10 # self.watchface1_time1_text.set_text("{}:{}".format("%02d"%(msg[0][0]),"%02d"%(msg[0][1]))) - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(hour1_chose)) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(hour2_chose)) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(min1_chose)) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(min2_chose)) + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(hour1_chose)) + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(hour2_chose)) + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(min1_chose)) + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(min2_chose)) self.watchface1_date_span.set_text(msg[2])#日期 - self.watchface1_week.set_src("E:/static/watch_plate/style_2/week/%d_week.png"%(msg[5])) #星期 + self.watchface1_week_span.set_text(msg[3]) #星期 def __signal(self, event, msg): #print("__signal_cb:",str(msg)) @@ -336,35 +371,22 @@ class Watchface2(): self.watchface_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png" pass - def __weather_type(self, event, msg): - if msg == None: - self.watchface1_temp_img.add_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN) - else: - type = int(msg) - self.watchface1_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_temp_img.clear_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type)) + def __oldHrValue(self, event, msg): + self.watchface1_HB_span.set_text(str(msg)) - def __weather_value(self, event, msg): - if msg == None: - self.watchface1_temp_degree.add_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) - else: - self.watchface1_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN) - self.watchface1_temp_txt.set_text(str(msg)) - + def __oldSpo2Value(self, event, msg): + self.watchface1_SPO2_span.set_text(str(msg)) + def __stepValue(self, event, msg): + self.watchface1_step_span.set_text(str(msg)) -class Watchface1(): - NAME = "Watchface1" + +class Watchface2(): + NAME = "Watchface2" # # #表盘1 def __init__(self,main_menu): - print("Watchface1:__init__") + print("Watchface2:__init__") self.meta = lv.obj(main_menu) self.meta.set_size(240,320) @@ -419,55 +441,48 @@ class Watchface1(): # add style for watchface_res_stat_charge_in_img self.watchface_res_stat_charge_in_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - #主图片 - self.watchface1_bg_img = lv.img(self.meta) - self.watchface1_bg_img.set_pos(int(0),int(40)) - self.watchface1_bg_img.set_size(240,280) - self.watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_bg_img.set_src("E:/static/watch_plate/style_1/bg.png") - self.watchface1_bg_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + # #主图片 + # self.watchface1_bg_img = lv.img(self.meta) + # self.watchface1_bg_img.set_pos(int(0),int(40)) + # self.watchface1_bg_img.set_size(240,280) + # self.watchface1_bg_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # self.watchface1_bg_img.add_flag(lv.obj.FLAG.CLICKABLE) + # self.watchface1_bg_img.set_src("E:/static/watch_plate/style_1/bg.png") + # self.watchface1_bg_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) #时间 - x = 40 + x = 30 y = 80 self.watchface1_time1_img = lv.img(self.meta) self.watchface1_time1_img.set_pos(int(x),int(y)) - self.watchface1_time1_img.set_size(36,44) + self.watchface1_time1_img.set_size(56,56) self.watchface1_time1_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time1_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/1.png") + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_2/time/1.png") self.watchface1_time1_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time2_img = lv.img(self.meta) - self.watchface1_time2_img.set_pos(int(x+36),int(y)) - self.watchface1_time2_img.set_size(36,44) + self.watchface1_time2_img.set_pos(int(x+60),int(y)) + self.watchface1_time2_img.set_size(56,56) self.watchface1_time2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time2_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/3.png") + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_2/time/3.png") self.watchface1_time2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_time3_img = lv.img(self.meta) - self.watchface1_time3_img.set_pos(int(x+36+36+4),int(y+11)) - self.watchface1_time3_img.set_size(8,24) - self.watchface1_time3_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_time3_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time3_img.set_src("E:/static/watch_plate/style_1/time/colon.png") - self.watchface1_time3_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time4_img = lv.img(self.meta) - self.watchface1_time4_img.set_pos(int(x+36+36+4+12),int(y)) - self.watchface1_time4_img.set_size(36,44) + self.watchface1_time4_img.set_pos(int(x),int(y+20+56)) + self.watchface1_time4_img.set_size(56,56) self.watchface1_time4_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time4_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/2.png") + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_2/time/2.png") self.watchface1_time4_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) self.watchface1_time5_img = lv.img(self.meta) - self.watchface1_time5_img.set_pos(int(x+36+36+4+12+36),int(y)) - self.watchface1_time5_img.set_size(36,44) + self.watchface1_time5_img.set_pos(int(x+60),int(y+20+56)) + self.watchface1_time5_img.set_size(56,56) self.watchface1_time5_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_time5_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/3.png") + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_2/time/3.png") self.watchface1_time5_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) # create style self.watchface1_style_default self.watchface1_style_default = lv.style_t() @@ -486,11 +501,6 @@ class Watchface1(): self.watchface1_style_default.set_pad_bottom(0) self.watchface1_style_default.set_text_font_v2("font_20.bin",20,0) #将外部字体库与该style对象绑定 - 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_v2("font_70.bin",70,0) - # self.watchface1_time1_text = lv.label(self.meta) # self.watchface1_time1_text.set_pos(44, 60) # self.watchface1_time1_text.set_size(190, 100) @@ -513,14 +523,14 @@ class Watchface1(): #日期 self.watchface1_date = lv.spangroup(self.meta) - self.watchface1_date.set_pos(int(24),int(131)) + self.watchface1_date.set_pos(int(30+56+20+56),int(100)) self.watchface1_date.set_size(84,25) self.watchface1_date.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.watchface1_date.set_align(lv.TEXT_ALIGN.LEFT) self.watchface1_date.set_overflow(lv.SPAN_OVERFLOW.CLIP) self.watchface1_date.set_mode(lv.SPAN_MODE.BREAK) self.watchface1_date_span = self.watchface1_date.new_span() - self.watchface1_date_span.set_text("12月9日") + self.watchface1_date_span.set_text("12月9") self.watchface1_date_span.style.set_text_color(lv.color_make(0xe0,0xd7,0xd7)) self.watchface1_date_span.style.set_text_decor(lv.TEXT_DECOR.NONE) self.watchface1_date_span.style.set_size(100) @@ -529,114 +539,70 @@ class Watchface1(): # add style for main_style_1_spangroup_date self.watchface1_date.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) #星期 - self.watchface1_week = lv.spangroup(self.meta) - self.watchface1_week.set_pos(int(29),int(166)) - self.watchface1_week.set_size(80,25) - self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_week.set_align(lv.TEXT_ALIGN.LEFT) - self.watchface1_week.set_overflow(lv.SPAN_OVERFLOW.CLIP) - self.watchface1_week.set_mode(lv.SPAN_MODE.BREAK) - self.watchface1_week_span = self.watchface1_week.new_span() - self.watchface1_week_span.set_text("星期四") - self.watchface1_week_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - self.watchface1_week_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - self.watchface1_week.refr_mode() - # add style for main_style_1_spangroup_week - self.watchface1_week.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - - # #阴历 - # self.watchface1_lunar_calendar = lv.spangroup(self.meta) - # self.watchface1_lunar_calendar.set_pos(int(124),int(131)) - # self.watchface1_lunar_calendar.set_size(110,17) - # self.watchface1_lunar_calendar.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - # self.watchface1_lunar_calendar.set_align(lv.TEXT_ALIGN.LEFT) - # self.watchface1_lunar_calendar.set_overflow(lv.SPAN_OVERFLOW.CLIP) - # self.watchface1_lunar_calendar.set_mode(lv.SPAN_MODE.BREAK) - # self.watchface1_lunar_calendar_span = self.watchface1_lunar_calendar.new_span() - # self.watchface1_lunar_calendar_span.set_text("三月初三") - # self.watchface1_lunar_calendar_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - # self.watchface1_lunar_calendar_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - # self.watchface1_lunar_calendar.refr_mode() + # self.watchface1_week = lv.spangroup(self.meta) + # self.watchface1_week.set_pos(int(29),int(166)) + # self.watchface1_week.set_size(80,25) + # self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + # self.watchface1_week.set_align(lv.TEXT_ALIGN.LEFT) + # self.watchface1_week.set_overflow(lv.SPAN_OVERFLOW.CLIP) + # self.watchface1_week.set_mode(lv.SPAN_MODE.BREAK) + # self.watchface1_week_span = self.watchface1_week.new_span() + # self.watchface1_week_span.set_text("星期四") + # self.watchface1_week_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + # self.watchface1_week_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + # self.watchface1_week.refr_mode() # # add style for main_style_1_spangroup_week - # self.watchface1_lunar_calendar.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + # self.watchface1_week.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - #计步 - self.watchface1_step_img = lv.img(self.meta) - self.watchface1_step_img.set_pos(int(130),int(160)) - self.watchface1_step_img.set_size(26,24) - self.watchface1_step_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_step_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_step_img.set_src("E:/static/watch_plate/style_1/step.png") - self.watchface1_step_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_week = lv.img(self.meta) + self.watchface1_week.set_pos(int(30+15),int(y+20+56+56+30)) + self.watchface1_week.set_size(90,30) + self.watchface1_week.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_week.set_src("E:/static/watch_plate/style_2/week/0_week.png") + self.watchface1_week.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_step_txt = lv.spangroup(self.meta) - self.watchface1_step_txt.set_pos(int(170),int(163)) - self.watchface1_step_txt.set_size(70,25) - self.watchface1_step_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_step_txt.set_align(lv.TEXT_ALIGN.LEFT) - self.watchface1_step_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) - self.watchface1_step_txt.set_mode(lv.SPAN_MODE.BREAK) - self.watchface1_step_span = self.watchface1_step_txt.new_span() - self.watchface1_step_span.set_text("0") - self.watchface1_step_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - self.watchface1_step_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - #self.watchface1_week_step_span.style.set_text_font(lv.font_harmony_19) - self.watchface1_step_txt.refr_mode() - # add style for main_style_1_spangroup_week - self.watchface1_step_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) - #心律 - self.watchface1_HB_img = lv.img(self.meta) - self.watchface1_HB_img.set_pos(int(53),int(198)) - self.watchface1_HB_img.set_size(30,27) - self.watchface1_HB_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_HB_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_HB_img.set_src("E:/static/watch_plate/style_1/heart.png") - self.watchface1_HB_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - self.watchface1_HB_txt = lv.spangroup(self.meta) - self.watchface1_HB_txt.set_pos(int(55),int(235)) - self.watchface1_HB_txt.set_size(80,25) - self.watchface1_HB_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_HB_txt.set_align(lv.TEXT_ALIGN.LEFT) - self.watchface1_HB_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) - self.watchface1_HB_txt.set_mode(lv.SPAN_MODE.BREAK) - self.watchface1_HB_span = self.watchface1_HB_txt.new_span() - self.watchface1_HB_span.set_text("0") - self.watchface1_HB_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - self.watchface1_HB_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - #self.watchface1_week_HB_span.style.set_text_font(lv.font_harmony_19) - self.watchface1_HB_txt.refr_mode() - # add style for main_style_1_spangroup_week - self.watchface1_HB_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + #天气 + self.watchface1_temp_img = lv.img(self.meta) + self.watchface1_temp_img.set_pos(int(x+56+56+20),int(y+56+20)) + self.watchface1_temp_img.set_size(65,45) + self.watchface1_temp_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_temp_img.set_src("E:/static/watch_plate/style_2/0_main2_weather.png") + self.watchface1_temp_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - #血氧 - self.watchface1_SPO2_img = lv.img(self.meta) - self.watchface1_SPO2_img.set_pos(int(161),int(193)) - self.watchface1_SPO2_img.set_size(23,32) - self.watchface1_SPO2_img.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_SPO2_img.add_flag(lv.obj.FLAG.CLICKABLE) - self.watchface1_SPO2_img.set_src("E:/static/watch_plate/style_1/blood.png") - self.watchface1_SPO2_img.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) - - self.watchface1_SPO2_txt = lv.spangroup(self.meta) - self.watchface1_SPO2_txt.set_pos(int(160),int(235)) - self.watchface1_SPO2_txt.set_size(80,25) - self.watchface1_SPO2_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) - self.watchface1_SPO2_txt.set_align(lv.TEXT_ALIGN.LEFT) - self.watchface1_SPO2_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) - self.watchface1_SPO2_txt.set_mode(lv.SPAN_MODE.BREAK) - self.watchface1_SPO2_span = self.watchface1_SPO2_txt.new_span() - self.watchface1_SPO2_span.set_text("0") - self.watchface1_SPO2_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) - self.watchface1_SPO2_span.style.set_text_decor(lv.TEXT_DECOR.NONE) - #self.watchface1_week_SPO2_span.style.set_text_font(lv.font_harmony_19) - self.watchface1_SPO2_txt.refr_mode() - # add style for main_style_1_spangroup_week - self.watchface1_SPO2_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_temp_degree = lv.img(self.meta) + self.watchface1_temp_degree.set_pos(int(x+56+56+65),int(215)) + self.watchface1_temp_degree.set_size(10,10) + self.watchface1_temp_degree.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_temp_degree.set_src("E:/static/watch_plate/style_2/degree.png") + self.watchface1_temp_degree.add_style(self.style_watchface_img_default, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_temp_txt = lv.label(self.meta) + self.watchface1_temp_txt.set_pos(int(x+56+56+39),int(215)) + self.watchface1_temp_txt.set_size(240-(x+56+56+34),30) + self.watchface1_temp_txt.set_align(lv.TEXT_ALIGN.LEFT) + self.watchface1_temp_txt.set_text("00") + self.watchface1_temp_txt.add_style(style_font_youyuan_20, lv.PART.MAIN|lv.STATE.DEFAULT) + self.watchface1_no_temp_txt = lv.spangroup(self.meta) + self.watchface1_no_temp_txt.set_pos(int(30+56+56+20),int(176)) + self.watchface1_no_temp_txt.set_size(80,30) + self.watchface1_no_temp_txt.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) + self.watchface1_no_temp_txt.set_align(lv.TEXT_ALIGN.LEFT) + self.watchface1_no_temp_txt.set_overflow(lv.SPAN_OVERFLOW.CLIP) + self.watchface1_no_temp_txt.set_mode(lv.SPAN_MODE.BREAK) + self.watchface1_no_temp_span = self.watchface1_no_temp_txt.new_span() + self.watchface1_no_temp_span.set_text("无数据") + self.watchface1_no_temp_span.style.set_text_color(lv.color_make(0xee,0xe7,0xe7)) + self.watchface1_no_temp_span.style.set_text_decor(lv.TEXT_DECOR.NONE) + #self.watchface1_week_step_span.style.set_text_font(lv.font_harmony_19) + self.watchface1_no_temp_txt.refr_mode() + self.watchface1_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) + # add style for main_style_1_spangroup_week + self.watchface1_no_temp_txt.add_style(self.watchface1_style_default, lv.PART.MAIN|lv.STATE.DEFAULT) + def initialization(self): #获取信号 signal = EventMesh.publish("screen_get_sig") @@ -650,18 +616,26 @@ class Watchface1(): #print("publish_time:"+time) if time: self.__time(None, time) - hrValue = EventMesh.publish("get_old_hr_data") - self.__oldHrValue(None, hrValue) - spo2Value = EventMesh.publish("get_old_spo2_data") - self.__oldSpo2Value(None, spo2Value) - - - def get_step(self,event,msg): - # print("main get_step msg:{}".format(msg)) - self.step = msg[0] - self.watchface1_step_span.set_text(str(self.step)) + connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态 + self.weather_data = EventMesh.publish("get_weather_data") + if connect != 0: + no_data = self.weather_data[8] + if no_data != 0: + type = self.weather_data[3] + if type == None: + self.__weather_type(None,None) + else: + self.__weather_type(None,type) + temp = self.weather_data[4] + if temp == None: + self.__weather_value(None,None) + else: + self.__weather_value(None,temp) + else: + self.__weather_type(None,None) + self.__weather_value(None,None) def timerout_update(self): #获取信号 @@ -678,11 +652,25 @@ class Watchface1(): if time: self.__time(None, time) - hrValue = EventMesh.publish("get_old_hr_data") - self.__oldHrValue(None, hrValue) + connect = EventMesh.publish(constants.EVENT.GET_CONNECT) #获取网络状态 + self.weather_data = EventMesh.publish("get_weather_data") + if connect != 0: + no_data = self.weather_data[8] + if no_data != 0: + type = self.weather_data[3] + if type == None: + self.__weather_type(None,None) + else: + self.__weather_type(None,type) - spo2Value = EventMesh.publish("get_old_spo2_data") - self.__oldSpo2Value(None, spo2Value) + temp = self.weather_data[4] + if temp == None: + self.__weather_value(None,None) + else: + self.__weather_value(None,temp) + else: + self.__weather_type(None,None) + self.__weather_value(None,None) def __time(self, event, msg): #时间 @@ -691,12 +679,12 @@ class Watchface1(): min1_chose = (msg[0][1])//10%10 min2_chose = (msg[0][1])%10 # self.watchface1_time1_text.set_text("{}:{}".format("%02d"%(msg[0][0]),"%02d"%(msg[0][1]))) - self.watchface1_time1_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(hour1_chose)) - self.watchface1_time2_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(hour2_chose)) - self.watchface1_time4_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(min1_chose)) - self.watchface1_time5_img.set_src("E:/static/watch_plate/style_1/time/%d.png"%(min2_chose)) + self.watchface1_time1_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(hour1_chose)) + self.watchface1_time2_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(hour2_chose)) + self.watchface1_time4_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(min1_chose)) + self.watchface1_time5_img.set_src("E:/static/watch_plate/style_2/time/%d.png"%(min2_chose)) self.watchface1_date_span.set_text(msg[2])#日期 - self.watchface1_week_span.set_text(msg[3]) #星期 + self.watchface1_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)) @@ -719,11 +707,29 @@ class Watchface1(): self.watchface_res_stat_battery_img.set_src("E:/static/vbat_%d.png"%(msg[1]))#"E:/vbat_60.png" pass - def __oldHrValue(self, event, msg): - self.watchface1_HB_span.set_text(str(msg)) + def __weather_type(self, event, msg): + if msg == None: + self.watchface1_temp_img.add_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN) + else: + type = int(msg) + self.watchface1_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_temp_img.clear_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_temp_img.set_src("E:/static/watch_plate/style_2/%d_main2_weather.png"%(type)) - def __oldSpo2Value(self, event, msg): - self.watchface1_SPO2_span.set_text(str(msg)) + def __weather_value(self, event, msg): + if msg == None: + self.watchface1_temp_degree.add_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_no_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) + else: + self.watchface1_no_temp_txt.add_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_temp_txt.clear_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_temp_degree.clear_flag(lv.obj.FLAG.HIDDEN) + self.watchface1_temp_txt.set_text(str(msg)) + + + class WatchFace(): @@ -733,14 +739,28 @@ class WatchFace(): #表盘 self.watchface_list = [] self.meta = None - self.watchface_style_num = "Watchface2" + self.watchface_style_num = "Watchface1" self.timer_update = osTimer() self.main_menu = main_menu - self.watchface_style = "Watchface2" - EventMesh.subscribe("change_face", self.change_face) + self.watchface_style = "Watchface1" + 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): - print("watchface INIT !!!!!!!!:",self.watchface_style) + print("watchface INIT !!!!!!!!:",self.watchface_style_num) if self.watchface_list == [] : #第一次初始化 self.watchface_list.append( Watchface1(self.main_menu)) self.watchface_list.append( Watchface2(self.main_menu)) @@ -753,10 +773,10 @@ class WatchFace(): self.watchface_style.initialization() self.timer_update.start(10000, 1, self.timerout_update) - def change_face(self, event=None, msg=None): print("change_face :",msg) + self.watchface_style_num = str(msg) for wat in self.watchface_list: if wat.NAME == self.watchface_style_num : diff --git a/3.code/1.watch/2.code/ui_main_menu.py b/3.code/1.watch/2.code/ui_main_menu.py index f19adb97..aa1d2ac8 100644 --- a/3.code/1.watch/2.code/ui_main_menu.py +++ b/3.code/1.watch/2.code/ui_main_menu.py @@ -79,7 +79,7 @@ class MainMenuScreen(Screen): EventMesh.subscribe("change_style", self.change_style) def watch_top_show(self, event, msg): # - self.main_menu_style.MainMenu.set_tile_id(0,0,lv.ANIM.OFF) + self.main_menu_style.MainMenu.set_tile_id(0,1,lv.ANIM.OFF) def change_style(self, event=None, msg=None): #换风格 print("change style :",msg) diff --git a/3.code/1.watch/2.code/ui_setting.py b/3.code/1.watch/2.code/ui_setting.py index 5749302b..a8a17221 100644 --- a/3.code/1.watch/2.code/ui_setting.py +++ b/3.code/1.watch/2.code/ui_setting.py @@ -1001,27 +1001,46 @@ class DialswitchScreen(Screen): def __init__(self): super().__init__() self.meta = dialswitch_screen + self.read_data = {} + self.watchface_style_num = "Watchface1" dialswitch_btn1.add_event_cb(lambda e: self.watchface01(e), lv.EVENT.PRESSED, None) dialswitch_btn2.add_event_cb(lambda e: self.watchface02(e), lv.EVENT.PRESSED, None) + def initialization(self): + 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) + else: + btn1_switch.clear_state(lv.STATE.CHECKED) + btn2_switch.add_state(lv.STATE.CHECKED) + def watchface01(self,e): - #watchface2.add_flag(lv.obj.FLAG.HIDDEN) - #watchface01.clear_flag(lv.obj.FLAG.HIDDEN) btn1_switch.add_state(lv.STATE.CHECKED) btn2_switch.clear_state(lv.STATE.CHECKED) - EventMesh.publish("change_face", "Watchface1") + self.read_data["watchface"] = "Watchface1" + 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("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) def watchface02(self,e): - #watchface01.add_flag(lv.obj.FLAG.HIDDEN) - #watchface2.clear_flag(lv.obj.FLAG.HIDDEN) btn1_switch.clear_state(lv.STATE.CHECKED) btn2_switch.add_state(lv.STATE.CHECKED) - EventMesh.publish("change_face", "Watchface2") + 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"})