#include <string.h>
-#if CONFIG_juphoon
+#if 0
#include "helios_gpio.h"
EventMesh.publish("set_interrup_incall",0)
return
- # EventMesh.publish("set_interrup_incall",0)
- # EventMesh.publish("set_UI_high_priority",0)
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
- # screen_NAME = EventMesh.publish("get_screen_NAME")
- # if screen_NAME != None:
- # if screen_NAME != "dialing_noplay_popup":
- # EventMesh.publish("load_screen", {"screen": "main_menu"})
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
EventMesh.publish("set_sos_info_call")
print('voicecall disconnect end')
self.meta = phone_screen
phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_one.add_event_cb(lambda e: EventMesh.callback_wrapper(self.one(e)),
# lv.EVENT.PRESSING, None)
phone_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.two(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_two.add_event_cb(lambda e: EventMesh.callback_wrapper(self.two(e)),
# lv.EVENT.PRESSING, None)
phone_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.three(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_three.add_event_cb(lambda e: EventMesh.callback_wrapper(self.three(e)),
# lv.EVENT.PRESSING, None)
phone_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.four(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_four.add_event_cb(lambda e: EventMesh.callback_wrapper(self.four(e)),
# lv.EVENT.PRESSING, None)
phone_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.five(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_five.add_event_cb(lambda e: EventMesh.callback_wrapper(self.five(e)),
# lv.EVENT.PRESSING, None)
phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_six.add_event_cb(lambda e: EventMesh.callback_wrapper(self.six(e)),
# lv.EVENT.PRESSING, None)
phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven_longpress(e)),
lv.EVENT.LONG_PRESSED, None)
phone_seven.add_event_cb(lambda e: EventMesh.callback_wrapper(self.seven_release(e)),
# lv.EVENT.PRESSING, None)
phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
# phone_eight.add_event_cb(lambda e: EventMesh.callback_wrapper(self.eight(e)),
# lv.EVENT.PRESSING, None)
phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_longpress(e)),
lv.EVENT.LONG_PRESSED, None)
phone_nine.add_event_cb(lambda e: EventMesh.callback_wrapper(self.nine_release(e)),
# lv.EVENT.PRESSING, None)
phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_longpress(e)),
lv.EVENT.LONG_PRESSED, None)
phone_zero.add_event_cb(lambda e: EventMesh.callback_wrapper(self.zero_release(e)),
# lv.EVENT.PRESSING, None)
phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)),
- lv.EVENT.SHORT_CLICKED, None)
+ lv.EVENT.CLICKED, None)
phone_call_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.call(e)),
lv.EVENT.PRESSING, None)
# # phone_contact_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.contact(e)),
# lv.EVENT.CLICKED, None)
phone_delete_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete(e)),
- lv.EVENT.SHORT_CLICKED, None)
- phone_delete_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.delete(e)),
- lv.EVENT.PRESSING, None)
+ lv.EVENT.CLICKED, None)
# # phone_start.add_event_cb(lambda e: EventMesh.callback_wrapper(self.start(e)),
self.count+=1
def one(self,e):
- code = e.get_code()
- if code == lv.EVENT.SHORT_CLICKED:
- 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)
- self.show_num()
+ self.phone_list.append("1")
+ self.phone_num = ''.join(self.phone_list)
+ self.show_num()
def two(self,e):
if len(self.phone_list) >= PHONE_CALL_MAX_DATA:
#print("PRESSING")
self.is_sliding += 1
- elif code == lv.EVENT.SHORT_CLICKED:
+ elif code == lv.EVENT.CLICKED:
#utime.sleep_ms(10)
print("1self.is_sliding",self.is_sliding)
if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件
else:#未插卡
EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"})
- self.is_sliding = 0
+ self.is_sliding = 0
def show_num(self):
#print("self.phone_num ",self.phone_num,self.phone_list)
EventMesh.publish("load_screen", {"screen": "no_valied_num_screen"})#无效的号码 请重新输入
self.is_sliding = 0
+
+ def done_DOWN(self):#下滑
+ if self.call_log_detail_list != None:
+ scroll_y = self.call_log_detail_list.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ self.call_log_detail_list.scroll_to_y(scroll_y-CALL_LOG_LIST_SIZE,lv.ANIM.ON)
+
+
+ #setting_cont.scroll_to_view(lv.ANIM.ON)
+ pass
+ def done_UP(self):#上滑
+ if self.call_log_detail_list != None:
+ scroll_y = self.call_log_detail_list.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ self.call_log_detail_list.scroll_to_y(scroll_y+CALL_LOG_LIST_SIZE,lv.ANIM.ON)
+ pass
+
def done_return(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
EventMesh.publish("save_msg_content", content)
EventMesh.publish("load_screen", {"screen": "msg_detail"})
self.is_sliding =0
+ def done_DOWN(self):#下滑
+ if self.sms_detail_list != None:
+ scroll_y = self.sms_detail_list.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ self.sms_detail_list.scroll_to_y(scroll_y-SMS_LIST_ONE_ICON,lv.ANIM.ON)
+
+
+ #setting_cont.scroll_to_view(lv.ANIM.ON)
+ pass
+ def done_UP(self):#上滑
+ if self.sms_detail_list != None:
+ scroll_y = self.sms_detail_list.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ self.sms_detail_list.scroll_to_y(scroll_y+SMS_LIST_ONE_ICON,lv.ANIM.ON)
+ pass
def done_left_to_right(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
EventMesh.publish("set_hr_state",0)#0代表关闭测试
print("stop debug10")
EventMesh.publish(constants.EVENT.STOP_HEART)
+ EventMesh.publish("load_screen", {"screen": "health"})
def btn1_release(self):
EventMesh.publish("load_screen", {"screen": "health"})
EventMesh.publish("load_screen", {"screen": "{}".format(msg)})
self.is_sliding =0
+ def done_DOWN(self):#下滑
+ scroll_y = toolbox_cont.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ toolbox_cont.scroll_to_y(scroll_y-TOOL_ICON_OFFSET_SIZE,lv.ANIM.ON)
+
+
+ #setting_cont.scroll_to_view(lv.ANIM.ON)
+ pass
+ def done_UP(self):#上滑
+ scroll_y = toolbox_cont.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ toolbox_cont.scroll_to_y(scroll_y+TOOL_ICON_OFFSET_SIZE,lv.ANIM.ON)
+ pass
def done_left_to_right(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
"dialing_noplay_popup"
EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
+ def done_DOWN(self):#下滑
+ if self.contact_detail_list != None:
+ scroll_y = self.contact_detail_list.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ self.contact_detail_list.scroll_to_y(scroll_y-CONTACTS_LIST_SIZE,lv.ANIM.ON)
+
+
+ #setting_cont.scroll_to_view(lv.ANIM.ON)
+ pass
+ def done_UP(self):#上滑
+ if self.contact_detail_list != None:
+ scroll_y = self.contact_detail_list.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ self.contact_detail_list.scroll_to_y(scroll_y+CONTACTS_LIST_SIZE,lv.ANIM.ON)
+ pass
def done_left_to_right(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})
countdown_stop_img.clear_flag(lv.obj.FLAG.HIDDEN)
countdown_reset_img.clear_flag(lv.obj.FLAG.HIDDEN)
EventMesh.publish("set_countdown_off_state", [0,self.g_state])
- self.is_sliding =0
+ self.is_sliding =0
def stop(self):
global countdown_screen ,countdown_title,countdown_hour ,countdown_mao ,countdown_mao ,countdown_mao1 ,\
countdown_sec ,countdown_hour_up ,countdown_hour_up_btn ,countdown_hour_down ,countdown_hour_down_btn ,\
watchface1_res_stat_battery_line = lv.line(Watchface1)
watchface1_res_stat_battery_line.set_points(power_line_points,2)
-watchface1_res_stat_battery_line.set_pos(int(191),int(13))
+watchface1_res_stat_battery_line.set_pos(int(192),int(20))
watchface1_res_stat_battery_line.set_size(0,16)#高度12
watchface1_res_stat_battery_line.add_style(power_line_red,0)
line_len = 30
if line_len <= 6:
line_len = 6
- set_x = int(199+line_len//2)
- watchface1_res_stat_battery_line.set_pos(int(set_x),int(8))
+ set_x = int(188+line_len//2)
+ watchface1_res_stat_battery_line.set_pos(int(set_x),int(18))
watchface1_res_stat_battery_line.set_size(line_len,15)
watchface1_res_stat_battery_line.set_style_line_width(line_len,lv.PART.MAIN)
if line_len <= 6:
watchface2_res_stat_battery_line = lv.line(Watchface2)
watchface2_res_stat_battery_line.set_points(power_line_points,2)
-watchface2_res_stat_battery_line.set_pos(int(191),int(13))
+watchface2_res_stat_battery_line.set_pos(int(192),int(20))
watchface2_res_stat_battery_line.set_size(0,16)#高度12
watchface2_res_stat_battery_line.add_style(power_line_red,0)
#print(msg)
if msg[0] == '1':
- watchface2_res_stat_battery_line.set_pos(int(0),int(0))
+ watchface2_res_stat_battery_line.set_pos(int(0),int(15))
watchface2_res_stat_battery_line.set_size(0,0)
watchface2_res_stat_battery_line.set_style_line_width(0,lv.PART.MAIN)
watchface2_res_stat_battery_img.set_src("E:/static/charge_ing.png")
line_len = 30
if line_len <= 6:
line_len = 6
- set_x = int(199+line_len//2)
- watchface2_res_stat_battery_line.set_pos(int(set_x),int(8))
- watchface2_res_stat_battery_line.set_size(line_len,16)
+ set_x = int(188+line_len//2)
+ watchface2_res_stat_battery_line.set_pos(int(set_x),int(20))
+ watchface2_res_stat_battery_line.set_size(line_len,5)
watchface2_res_stat_battery_line.set_style_line_width(line_len,lv.PART.MAIN)
if line_len <= 6:
watchface2_res_stat_battery_line.set_style_line_color(lv.color_make(0xff,0x00,0x00),0)
EventMesh.publish("load_screen", {"screen": "main_menu"})
def done_DOWN(self):#下滑
- setting_cont.scroll_to_view(lv.ANIM.ON)
+ scroll_y = setting_cont.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ setting_cont.scroll_to_y(scroll_y-SETTING_ICON_OFFSET_SIZE,lv.ANIM.ON)
+
+
+ #setting_cont.scroll_to_view(lv.ANIM.ON)
pass
def done_UP(self):#上滑
- setting_cont.scroll_to_view(lv.ANIM.ON)
+ scroll_y = setting_cont.get_scroll_y()
+ print("scroll_y:{}".format(scroll_y))
+ setting_cont.scroll_to_y(scroll_y+SETTING_ICON_OFFSET_SIZE,lv.ANIM.ON)
pass
##################################################################
# -------------------------------------------language screen----------------------------------------------------------
else:
self.no_smi_count = 0
+ msg_nums = sms.getMsgNums() #获取短信条数
+ print("msg_nums",msg_nums)
+ if(msg_nums != -1):
+ sms_data = sms.getSaveLoc()
+ sms_max = sms_data[0][2]
+ if msg_nums >= sms_max-1:
+ self.sms_full_flag+=10
+ if self.sms_full_flag >= 60:
+ self.sms_full_flag=0
+ EventMesh.publish("remove_all_sms_cb")#
+ else:
+ self.sms_full_flag = 0
+
"""定时测量心率,血氧,体温"""
WEAR = EventMesh.publish(constants.EVENT.GET_WEAR)#佩戴数据
self.get_hr_state = EventMesh.publish("get_hr_state")
def post_processor_after_instantiation(self):
EventMesh.subscribe("delete_sms_event", self.delete_sms_event)#删除短信
- EventMesh.subscribe("delete_sms_thread", self.delete_sms_thread)#
+ EventMesh.subscribe("remove_all_sms_cb", self.remove_all_sms_cb)#
def delete_sms_event(self, event, msg):
EventMesh.publish_async("remove_all_sms_cb","",1*1024)
- def delete_sms_thread(self, event, msg):
+ def remove_all_sms_cb(self, event, msg):
sms.deleteMsg(1,4)
#闹钟信息
$(BUILD)/calculator.mpy \
$(BUILD)/versions.mpy \
$(BUILD)/websocket_test.mpy \
+ $(BUILD)/pp_main.mpy \
endif
#闹钟信息
alarm_list = [{'hour': 16, 'repeart': 10, 'idx': 0, 'enabled': 0, 'days': [0,1,2,3,4,5,6], 'minute': 39},
- {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [0,1,2,3,4,5,6], 'minute': 39},
- {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [0,1,2,3,4,5,6], 'minute': 39},
- {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39},
- {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [], 'minute': 39},]
+ {'hour': 16, 'repeart': 10, 'idx': 1, 'enabled': 0, 'days': [0,1,2,3,4,5,6], 'minute': 39}]
#用于显示闹钟列表不包含开关机信息
class ClockManager(Abstract):
self.wechat_show = self.wechat_num
self.wechat_recode_list["num"] = self.wechat_num
print("talking1.0")
- self.record_test.start("/usr/static/storage_file/{}.wav".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
SILENCETIMEFS_SEND ="SILENCETIMEFS_SEND"
SILENCETIMEFS_RECV = "SILENCETIMEFS_RECV"
+ PP_SEND = "PP_SEND"
+ PP_RECV = "PP_RECV"
+
+ PP_INFOR_SEND = "pp_SEND"
+ PP_INFOR_RECV = "pp_RECV"
+
class EVENT:
CHANNEL_SOCKET_SEND = "CHANNEL_SOCKET_SEND"
from mgr import cameraAlbumManager,setclassTimeManager,setkeyboardManager,testSmsSetIPManager,ConfigStoreManager,sosInfoCallManager,getBootOffManager,getSosFlagManager,CountdownManager, LocationManager, getVolumSizeManager,gethistoryDataManager,getUpLoadDataManager, getplayAudiodStateManager,\
AddrBookManager,MsgdetailManager,PhoneCallingManager,getOldTimeManager,getStorageDataManager,getBrightnessManager,getHrTimeManager,getTempTimeManager,getLowBatManager
+ from pp_main import ppMainScreen,ppMainPopupScreen
# import ui as _ui
print("init4:{}".format(utime.localtime()))
ui.add_screen(FactoryModeScreen())
ui.add_screen(FactoryModeBatTestScreen())
ui.add_screen(PopupAlarmScreen())
+ ui.add_screen(ppMainScreen())
+ ui.add_screen(ppMainPopupScreen())
ui.add_screen(_ui.LowPowerScreen())
ui.add_screen(_ui.NewMessageScreen())
ui.add_screen(_ui.sosScreen())
ui.add_screen(_ui.restore_confirmScreen())
ui.add_screen(_ui.down_Screen())
ui.add_screen(_ui.up_Screen())
+
ui.add_screen(NewWechatPopupScreen())
ui.add_screen(HealthScreen())
# ui.add_screen(_ui.Setting3Screen())
from protocol import SILENCETIMEFS_ProtoCol,WLKEY_ProtoCol,SILENCETIME2_ProtoCol,KEYBRD_ProtoCol,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
+ pp_ProtoCol,ppinfo_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()))
pcr.add_support(SILENCETIME2_ProtoCol())
pcr.add_support(WLKEY_ProtoCol())
pcr.add_support(SILENCETIMEFS_ProtoCol())
+ pcr.add_support(pp_ProtoCol())
+ pcr.add_support(ppinfo_ProtoCol())
EventMesh.publish("load_screen", {"screen": "poweron"})
sm = SockManager()
sm.add_support_resolver(pcr)
EventMesh.publish("set_interrup_incall",0)
return
- # EventMesh.publish("set_interrup_incall",0)
- # EventMesh.publish("set_UI_high_priority",0)
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
- # screen_NAME = EventMesh.publish("get_screen_NAME")
- # if screen_NAME != None:
- # if screen_NAME != "dialing_noplay_popup":
- # EventMesh.publish("load_screen", {"screen": "main_menu"})
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
EventMesh.publish("set_sos_info_call")
print('voicecall disconnect end')
while True:
if self.location_queue.empty() == False:
TYPE = self.location_queue.get()
- #print("Location_send3:{}".format(TYPE))
+ print("Location_send3:{}-{}".format(TYPE,send_data))
EventMesh.publish(TYPE,send_data)
else :
break
rmc_data = quecgnss.get_rmc()
gga_data = quecgnss.get_gga()
vtg_data = quecgnss.get_vtg()
- print("gsv:{}".format(quecgnss.get_gsv()))
- print("gga:{}".format(quecgnss.get_gga()))
- print("rmc:{}".format(quecgnss.get_rmc()))
- print("vtg:{}".format(quecgnss.get_vtg()))
+ # print("gsv:{}".format(quecgnss.get_gsv()))
+ # print("gga:{}".format(quecgnss.get_gga()))
+ # print("rmc:{}".format(quecgnss.get_rmc()))
+ # print("vtg:{}".format(quecgnss.get_vtg()))
for i in range(len(gsv_data)) :
if i % 2 == 0:
--- /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
+import ujson
+import audio
+import ql_fs
+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
+from queue import Queue
+import camera
+from ui import style_screen,Screen,style_font_youyuan_20,style_img
+LCD_X = 128
+LCD_Y = 128
+ppmain_screen = None
+ppmain_img = None
+ppmain_name = None
+ppmain_call_label = None
+ppmain_imgbtn = None
+class ppMainScreen(Screen):
+ NAME = "pp_main"
+
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ def initialization(self):
+
+ global ppmain_screen,ppmain_img,ppmain_name ,ppmain_imgbtn
+ if ppmain_screen == None:
+ ppmain_screen = lv.obj()
+ print("ppMainScreen")
+ ppmain_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ # dialing_img = lv.img(ppmain_screen)
+ # dialing_img.set_pos(80, 20)
+ # dialing_img.set_size(64, 64)
+ # dialing_img.set_src("U:/static/IMAGE_NOTICE_CALL.png")
+ # dialing_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+
+ ppmain_call_label = lv.label(ppmain_screen)
+ ppmain_call_label.set_pos(35, 24)
+ ppmain_call_label.set_size(LCD_X-35, 40)
+ ppmain_call_label.set_text("碰碰好友")
+ ppmain_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ ppmain_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ ppmain_imgbtn = lv.img(ppmain_screen) #64
+ ppmain_imgbtn.set_size(20, 20)
+ ppmain_imgbtn.set_src("U:/static/pp_friend01.png")
+ ppmain_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+ ppmain_imgbtn.set_pos(10, 20)
+
+
+ ppmain_name = lv.label(ppmain_screen)
+ ppmain_name.set_pos(0, 0)
+ ppmain_name.set_size(LCD_X, 60)
+ ppmain_name.set_text(" ")
+ ppmain_name.add_flag(lv.obj.FLAG.CLICKABLE)
+ ppmain_name.set_long_mode(lv.label.LONG.DOT)
+ ppmain_name.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ ppmain_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ ppmain_name.add_event_cb(lambda e: EventMesh.callback_wrapper(self.hangup(e)),
+ lv.EVENT.CLICKED, None)
+
+ self.meta = ppmain_screen
+ def hangup(self,*argc):
+ EventMesh.publish("load_screen", {"screen": "pp_popup"})
+ EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.PP_SEND) #开始WT定位
+
+ 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("load_screen", {"screen": "main_menu"})
+
+
+
+ppPopup_screen = None
+ppPopup_call_label = None
+ppPopup_imgbtn = None
+class ppMainPopupScreen(Screen):#弹窗提示
+ NAME = "pp_popup"
+
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.timer=osTimer()
+ self.timer_out=osTimer()
+ self.meta_type = "popup"
+ self.count = 0
+
+ def initialization(self):
+ self.count = 0
+ global ppPopup_screen,ppmain_img,ppmain_name ,ppPopup_imgbtn
+ if ppPopup_screen == None:
+ ppPopup_screen = lv.obj()
+ print("ppPopup_screen")
+ ppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ ppPopup_call_label = lv.label(ppPopup_screen)
+ ppPopup_call_label.set_pos(0, 89)
+ ppPopup_call_label.set_size(LCD_X-0, 39)
+ ppPopup_call_label.set_text("搜索好友中,请稍候...")
+ ppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ ppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ ppPopup_imgbtn = lv.img(ppPopup_screen) #64
+ ppPopup_imgbtn.set_size(109, 79)
+ ppPopup_imgbtn.set_src("U:/static/pp_friend02.png")
+ ppPopup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+ ppPopup_imgbtn.set_pos(14, 5)
+
+ self.meta = ppPopup_screen
+ self.timer.start(1*1000,1,self.fun)
+ self.timer_out.start(40*1000,0,self.timeout_fun)
+ def fun(self,*argc):
+ EventMesh.publish("system_sleep_rest")#防止黑屏
+
+ def timeout_fun(self,*argc):
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME == "pp_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+ def Close(self):
+ self.timer.stop()
+
+ 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"})
+
+
+addppPopup_screen = None
+addppPopup_call_label = None
+addppPopup_imgbtn = None
+class addppPopupScreen(Screen):#弹窗提示
+ NAME = "addpp_popup"
+
+ def __init__(self):
+ super().__init__()
+ self.timer=osTimer()
+ self.meta = None
+ self.meta_type = "popup"
+ self.count = 0
+ def initialization(self):
+ self.count = 0
+ global addppPopup_screen,addppPopup_imgbtn
+ if addppPopup_screen == None:
+ addppPopup_screen = lv.obj()
+ print("addpp_popup")
+ addppPopup_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ addppPopup_call_label = lv.label(addppPopup_screen)
+ addppPopup_call_label.set_pos(0, 94)
+ addppPopup_call_label.set_size(LCD_X-0, 34)
+ addppPopup_call_label.set_text(" ")
+ addppPopup_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ addppPopup_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ addppPopup_imgbtn = lv.img(addppPopup_screen) #64
+ addppPopup_imgbtn.set_size(73, 78)
+ addppPopup_imgbtn.set_src("U:/static/pp_friend03.png")
+ addppPopup_imgbtn.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+ addppPopup_imgbtn.set_pos(27, 10)
+
+ self.meta = addppPopup_screen
+ self.timer.start(1*1000,1,self.fun)
+ addppPopup_call_label.set_text(str(self.meta_info))
+
+ def fun(self,*argc):
+ self.count+=1
+ if self.count > 5:
+ self.count = 0
+ self.timer.stop()
+ EventMesh.publish("return_prev_screen")
+
+ def Close(self):
+ self.count = 0
+ self.timer.stop()
+
+ 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"})
+
+
import machine
import _thread
-import usys
+import usys
def server_init(server_type = None):
#服务器选择1,防走丢,2大锤,3三基同创,4童信 5云米
if server_type == None:
- server_type = 1
+ server_type = 5
#print("server_init:server_type:{}".format(server_type))
d_server_addr = "api.xcloudtech.com"
d_server_port = 9000
if self.UD_count>=6:
self.UD_count = 0
EventMesh.publish(constants.PROTOCOL.WT_SEND,msg)
-
+ # EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始ud定位
send_data ="UD,"+msg
send_len = len(send_data)
#wt_data = "%s"%(send_data)
#键盘开关
class KEYBRD_ProtoCol(ProtoCol):
- """免打扰"""
+ """键盘开关"""
TYPE = "KEYBRD"
def send(self, event, msg):
# [XT*334588000000156*0006*SILENCETIME2]
"""
# b'[SZKW*867387060319166*000A*KEYBRD]'
# print("KEYBRD!!!!!!!!!!!!!",msg)
+ msg = msg[1:-1]
+ msg_tmp = msg.decode('ascii')
+ msg_tmp_d = int(str(msg_tmp.split('KEYBRD,')[1]))
+
+ EventMesh.publish("set_key_board",["key_board",msg_tmp_d])
+
EventMesh.publish(constants.PROTOCOL.KEYBRD_SEND)
+#碰碰交友
+class pp_ProtoCol(ProtoCol):
+ """碰碰交友"""
+ TYPE = "PP"
+ def send(self, event, msg):
+ print("PP_ProtoCol:send:")
+ # [SZKW*867387060319491*0008*PP]
+ if(msg != ""):
+ time = msg.split(",")[1]
+ data = machine.RTC().datetime()
+ hour = "%02d"%(data[4])+"%02d"%(data[5])
+ print("PP_ProtoCol:send:{}-{}-{}".format(msg,type(msg),time))
+ msg_tmp = "PP," +"%s,"%(time)+ msg
+
+ data_len = len(msg_tmp)
+ MD5_head_data = self.PID+"*%s*%04X*PP"%(self.imei,data_len)
+ MD5_SIGN = self.pack_MD5_head(MD5_head_data)
+ send_data = self.PID+"*%s*%04X*%s"%(self.imei,data_len,msg_tmp)
+ data = "[%s%s]"%(str(MD5_SIGN),send_data)
+
+ print("PP_ProtoCol:msg_tmp:%s"%(data))
+ # 通过socket发送到服务器端
+ EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND, data)
+
+ def recv(self, event, msg):
+ """
+ @param event:
+ @param msg: 接收到的下行数据
+ """
+ # b'[SZKW*867387060319166*000A*KEYBRD]'
+ print("PP!!!!!!!!!!!!!",msg)
+
+ msg = msg[1:-1]
+ msg_tmp = msg.decode('ascii')
+ msg_tmp_d = str(msg_tmp.split('pp,')[1])
+
+ len_data = len(str(msg_tmp_d))
+ if len_data > 1:
+ EventMesh.publish("load_screen", {"screen": "addpp_popup","meta":msg_tmp_d})
+ pass
+ elif msg_tmp_d == "1":#对方已加过好友
+ pass
+ elif msg_tmp_d == "2":#自己已加过好友
+ pass
+ # EventMesh.publish(constants.PROTOCOL.PP_SEND)
+#碰碰交友
+class ppinfo_ProtoCol(ProtoCol):
+ """碰碰交友"""
+ TYPE = "pp"
+ def send(self, event, msg):
+ # [XT*334588000000156*0006*SILENCETIME2]
+ send_data = self.PID+"*%s*0002*pp"%(self.imei)
+ MD5_SIGN = self.pack_MD5_head(send_data)
+ data = "[%s%s]"%(str(MD5_SIGN),send_data)
+ # print("KEYBRD:data:%s"%(data))
+ # print("KEYBRD!!!!!!!!!!!!!",msg)
+ # 通过socket发送到服务器端
+ EventMesh.publish(constants.EVENT.CHANNEL_SOCKET_SEND,data)
+
+ def recv(self, event, msg):
+ """
+ @param event:
+ @param msg: 接收到的下行数据
+ """
+ # b'[SZKW*867387060319166*000A*KEYBRD]'
+ print("PP recv!!!!!!!!!!!!!",msg)
+
+ msg = msg[1:-1]
+ msg_tmp = msg.decode('ascii')
+ msg_tmp_d = str(msg_tmp.split('pp,')[1])
+
+ len_data = len(str(msg_tmp_d))
+ if len_data > 1:
+ EventMesh.publish("load_screen", {"screen": "addpp_popup","meta":msg_tmp_d})
+ pass
+ elif msg_tmp_d == "1":#对方已加过好友
+ pass
+ elif msg_tmp_d == "2":#自己已加过好友
+ pass
+ # EventMesh.publish(constants.PROTOCOL.PP_SEND)
+
class ProtoColResolver(object):
def __init__(self):
self.protocol_list = []
def handler(self, data):
# 这里接收数据
- # print("handler -> {}".format(data))
+ print("handler -> {}".format(data))
# if data.startswith('Init;'):
# data = data[5:]
# EventMesh.publish(constants.EVENT.SET_KEY, {"value": ujson.loads(data)['KEY']})
down_show_setting_img = lv.img(down_show_screen)#设置
down_show_setting_img.set_size(25, 25)
down_show_setting_img.set_pos(13+25+13+25+13, 90)
-down_show_setting_img.set_src("U:/static/menu_version.png")
+down_show_setting_img.set_src("U:/static/ui_setting.png")
down_show_setting_img.add_flag(lv.obj.FLAG.CLICKABLE)
down_show_setting_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
MainMenu2_img_add_friends = lv.img(MainMenu2_toolbox)
MainMenu2_img_add_friends.set_size(80,80)
MainMenu2_img_add_friends.set_pos(24,10)
-MainMenu2_img_add_friends.set_src("U:/static/IMAGE_ONE_PAGE_TOOLS.png")
+MainMenu2_img_add_friends.set_src("U:/static/IMAGE_ONE_PAGE_FRIEND.png")
MainMenu2_img_add_friends.add_flag(lv.obj.FLAG.CLICKABLE)
MainMenu2_img_add_friends.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT)
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_add_friends.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.CLICKED, None)
+ MainMenu2_img_add_friends.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "pp_main")), lv.EVENT.CLICKED, None)
# MainMenu2_img_camera_video.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_video")), lv.EVENT.CLICKED, None)
# MainMenu2_img_camera.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera")), lv.EVENT.CLICKED, None)
# MainMenu2_img_camera_album.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_album")), lv.EVENT.CLICKED, None)
setting_cont_y+=setting_cont_offset
-setting_update_img_btn_1 = lv.btn(setting_cont)
-setting_update_img_btn_1.set_pos(int(0),int(setting_cont_y-5))
-setting_update_img_btn_1.set_size(120,35)
-setting_update_img_btn_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
-setting_update_img_btn_1.add_style(style_screen_btn_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
-setting_update_img_btn_1.add_flag(lv.obj.FLAG.CLICKABLE)
-
-setting_update_label = lv.label(setting_cont)
-setting_update_label.set_text("系统升级")
-# setting_update_label.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_update_label.set_size(128-34, 35)
-setting_update_label.set_pos(34, setting_cont_y+5)
-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_label_btn = lv.label(setting_cont)
-setting_update_label_btn.set_text(" ")
-# setting_update_label_btn.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_update_label_btn.set_size(128, 45)
-setting_update_label_btn.set_pos(0, setting_cont_y)
-setting_update_label_btn.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
-setting_update_label_btn.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
-
-setting_update_img = lv.img(setting_cont)
-setting_update_img.set_pos(4, setting_cont_y)
-setting_update_img.set_size(set_icon_x, set_icon_y)
-# setting_update_img.add_flag(lv.obj.FLAG.CLICKABLE)
-setting_update_img.set_src("U:/static/menu_upgrade.png")
-setting_update_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+# setting_update_img_btn_1 = lv.btn(setting_cont)
+# setting_update_img_btn_1.set_pos(int(0),int(setting_cont_y-5))
+# setting_update_img_btn_1.set_size(120,35)
+# setting_update_img_btn_1.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
+# setting_update_img_btn_1.add_style(style_screen_btn_1_main_main_default, lv.PART.MAIN|lv.STATE.DEFAULT)
+# setting_update_img_btn_1.add_flag(lv.obj.FLAG.CLICKABLE)
+
+# setting_update_label = lv.label(setting_cont)
+# setting_update_label.set_text("系统升级")
+# # setting_update_label.add_flag(lv.obj.FLAG.CLICKABLE)
+# setting_update_label.set_size(128-34, 35)
+# setting_update_label.set_pos(34, setting_cont_y+5)
+# 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_label_btn = lv.label(setting_cont)
+# setting_update_label_btn.set_text(" ")
+# # setting_update_label_btn.add_flag(lv.obj.FLAG.CLICKABLE)
+# setting_update_label_btn.set_size(128, 45)
+# setting_update_label_btn.set_pos(0, setting_cont_y)
+# setting_update_label_btn.set_style_text_color(lv.color_make(0xff, 0xff, 0xff), lv.STATE.DEFAULT)
+# setting_update_label_btn.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+# setting_update_img = lv.img(setting_cont)
+# setting_update_img.set_pos(4, setting_cont_y)
+# setting_update_img.set_size(set_icon_x, set_icon_y)
+# # setting_update_img.add_flag(lv.obj.FLAG.CLICKABLE)
+# setting_update_img.set_src("U:/static/menu_upgrade.png")
+# setting_update_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
setting_restore_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "restore")), (lv.EVENT.CLICKED ), None)
setting_poweroff_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "poweroff")), (lv.EVENT.CLICKED ), None)
setting_restart_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "restart")), lv.EVENT.CLICKED, None)
- setting_update_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "update")), (lv.EVENT.CLICKED ), None)
+ # setting_update_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "update")), (lv.EVENT.CLICKED ), None)
setting_version_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "version")), (lv.EVENT.CLICKED ), None)
setting_dialswitch_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "dialswitch")), lv.EVENT.CLICKED, None)
setting_restore_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "restore")), lv.EVENT.PRESSING, None)
setting_poweroff_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "poweroff")), lv.EVENT.PRESSING, None)
setting_restart_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "restart")), lv.EVENT.PRESSING, None)
- setting_update_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "update")), lv.EVENT.PRESSING, None)
+ # setting_update_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "update")), lv.EVENT.PRESSING, None)
setting_version_img_btn_1.add_event_cb(lambda e: EventMesh.callback_wrapper(self.ui_setting_cb(e, "version")), lv.EVENT.PRESSING, None)
def initialization(self):
self.is_sliding =0
def done_return(self):
- EventMesh.publish("load_screen", {"screen": "main_menu"})
+ EventMesh.publish("return_prev_screen")
def btn1_release(self):
EventMesh.publish("return_setiing")
EventMesh.publish("set_UI_high_priority", 0)
EventMesh.publish("set_hangup_mode", 1)
voiceCall.callEnd()
- self.timer.start(5000,0,self.call_end)
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
+
+
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
def Close(self):
self.timer.stop()
EventMesh.publish("set_sos_flag",0)
EventMesh.publish("set_sos_num",0)
EventMesh.publish("set_hangup_mode",0)
- EventMesh.publish("return_prev_screen") #返回上一级
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
+
+
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
def Close(self):
self.timer1.stop()
self.aud.stop()
self.call_timer.stop()
voiceCall.callEnd()
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
+
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
def btn1_release(self):
pass
EventMesh.publish("set_UI_high_priority", 0)
self.timer.stop()
voiceCall.callEnd()
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
+
+
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
def Close(self):
self.timer.stop()
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)
+# 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"
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_dialswitch.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(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)
+ setting_imei.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "imei"})), lv.EVENT.CLICKED, None)
+ setting_app.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "app"})), lv.EVENT.CLICKED, None)
+ setting_bright.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "brightness"})), lv.EVENT.CLICKED, None)
+ setting_volume.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "totalvolume"})), lv.EVENT.CLICKED, None)
+ setting_restore.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "restore"})), lv.EVENT.CLICKED, None)
+ setting_poweroff.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(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.setting_cb(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_dialswitch_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(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)
-
-
+ setting_imei_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "imei"})), lv.EVENT.CLICKED, None)
+ setting_app_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "app"})), lv.EVENT.CLICKED, None)
+ setting_bright_img.add_event_cb(lambda e:EventMesh.callback_wrapper( self.setting_cb(e, {"screen": "brightness"})), lv.EVENT.CLICKED, None)
+ setting_volume_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "totalvolume"})), lv.EVENT.CLICKED, None)
+ setting_restore_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(e, {"screen": "restore"})), lv.EVENT.CLICKED, None)
+ setting_poweroff_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.setting_cb(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.setting_cb(e, {"screen": "version"})), lv.EVENT.CLICKED, None)
+
+ def setting_cb(self,e,msg):
+ code = e.get_code()
+ if code == lv.EVENT.PRESSING:
+ #print("PRESSING")
+ self.is_sliding += 1
+
+ elif code == lv.EVENT.CLICKED:
+ #utime.sleep_ms(10)
+ print("1self.is_sliding",self.is_sliding)
+ if self.is_sliding <= 5 and self.is_sliding != 0:#如果是在滑动中则不需要点击事件
+ self.is_sliding = 0
+ EventMesh.publish("load_screen", {"screen":"{}".format(msg)})
+
+ self.is_sliding =0
def done_return(self):
EventMesh.publish("load_screen", {"screen": "main_menu"})