with open("/ext/static/storage_file/wechat_record.json","r") as fd:#音频文件编号
self.wechat_recode_list = ujson.load(fd)
if not self.wechat_recode_list:
+ self.wechat_recode_list = {"num":0}
self.wechat_num = 0
else:
b = str("num") in self.wechat_recode_list.keys()
if b == True:
self.wechat_num = self.wechat_recode_list["num"]
+ else :
+ self.wechat_recode_list = {"num":0}
+ with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
+ ujson.dump(self.wechat_recode_list,fd)
# if self.wechat_num != 0:
# with open("/ext/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录
# self.wechat_recode_list = ujson.load(fd)#读取每一个amr音频文件的时长ui_setting.py
self.ble_send = 0
self.wechat_show = 0
self.wechat_show_list = 0
- self.old_num = self.wechat_num
+ #self.old_num = self.wechat_num
+ self.updata_list_show_lock =0
def get_wechat_data(self,event, msg):
- return [self.MXA_MSG,self.wechat_num ,self.wechat_recode_list]
+ return [self.MXA_MSG ,self.wechat_recode_list]
def set_wechat_data(self, event, msg):
self.MXA_MSG = msg[0]
- self.wechat_num = msg[1]
- self.wechat_recode_list = msg[2]
+
+ self.wechat_recode_list = msg[1]
+ self.wechat_num = self.wechat_recode_list["num"]
with open("/ext/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd:
ujson.dump(self.wechat_recode_list,fd)
#写编号
- self.old_num = self.wechat_num
- print("set_wechat_data:{} {}".format(self.wechat_num,self.old_num))
+ #self.old_num = self.wechat_num
+ print("set_wechat_data:{} ".format(self.wechat_num))
# with open("/ext/static/storage_file/wechat_num.txt","w") as fd:
# fd.write("{}".format(self.wechat_num))
-
+ #index=0 不改变列表控件显示到lcd上;index=2只更新列表控件,不显示;index=1更新列表并显示控件
def updata_list_show(self,index):
global wechat_screen_list_screen
if self.press_state != 1:
self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN)
wechat_label.add_flag(lv.obj.FLAG.HIDDEN)
elif index == 2 or index == 1:
+ if self.updata_list_show_lock == 0:
+ self.updata_list_show_lock = 1
+ else :
+ return
#读取json文件中的键作为label文本;
#print("self.wechat_list.self.wechat_num:{}".format(self.wechat_num))
_btn_img.set_src("E:/static/APP/wechat/S_3.png")
_btn_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
bottom_btn1 = self.wechat_list.get_child(-1)
- bottom_btn1.scroll_to_view(lv.ANIM.OFF)
+ bottom_btn1.scroll_to_view(lv.ANIM.OFF)
+ self.updata_list_show_lock = 0
def initialization(self):
self.aud.setVolume(11)#设置最大声录音
self.wechat_num = 0
self.wechat_num += 1
self.wechat_show = self.wechat_num
-
+ self.wechat_recode_list["num"] = self.wechat_num
print("talking self.wechat_num ...:{} self.MXA_MSG:{}".format(self.wechat_num,self.MXA_MSG))
self.record_test.start("/ext/static/storage_file/{}.amr".format(self.wechat_num),16)
self.second_timer.start(1000, 1, self.reduce_second)
self.second_timer.stop() #停止计时器
self.countdown_old = self.countdown
# print("self.countdown :{} self.wechat_num:{} self.wechat_recode_list:{} self.wechat_show:{}".format(self.countdown,self.wechat_num,self.wechat_recode_list,self.wechat_show))
- num_total = 0
- num_total = len(self.wechat_recode_list)
- if num_total == 0:
- num_total+=1
- if num_total >= 10:
- num_total = self.MXA_MSG
self.wechat_recode_list["%02d"%(self.wechat_show)] = "S:{}".format(str(self.countdown))
- self.wechat_recode_list["num"] = num_total
+ self.wechat_recode_list["num"] = self.wechat_show
#读音频amr二进制数据
self.play_img_cnt.set_src("E:/static/APP/wechat/R_3.png")
elif self.play_text == "S:":
self.play_img_cnt.set_src("E:/static/APP/wechat/S_3.png")
+ get_play = EventMesh.publish("get_audio_state")
+ if get_play != None:
+ if get_play == 0:
+ if self.play_text == "R:" and self.play_sec > 0:
+ self.play_timer.stop()
#点击播放
def play_label(self,e):
# print("TK_ProtoCol:recv:datalen{}".format(len(msg)))
arm_data = bytearray(str[1])#获取amr输出
get_wechat_data = EventMesh.publish("get_wechat_data")
- wechat_num = get_wechat_data[1]
+
MXA_MSG = get_wechat_data[0]
- wechat_recode_list = get_wechat_data[2]
+ wechat_recode_list = get_wechat_data[1]
+ wechat_num = wechat_recode_list["num"]
# print("TK_ProtoCol:datalen:{} {} {}".format(wechat_num,MXA_MSG,wechat_recode_list))
if wechat_num >= MXA_MSG:
wechat_num += 1
elif wechat_num > 0:
wechat_num += 1
- #'01':'R:09' 'num':'01'
- #写记录列表
- num_total = 0
- num_total = len(wechat_recode_list)
- if num_total == 0:
- num_total+=1
- if num_total >= 10:
- num_total = 10
-
- print("num_total:datalen:{} {} {}".format(num_total,MXA_MSG,wechat_recode_list))
+
+
+ print("num_total:datalen:{} {}".format(MXA_MSG,wechat_recode_list))
wechat_recode_list["%02d"%(wechat_num)] = "R:{}".format(3)
- wechat_recode_list['num'] = num_total
- EventMesh.publish("set_wechat_data",[MXA_MSG,num_total,wechat_recode_list])
+ wechat_recode_list['num'] = wechat_num
+ EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list])
#写语音文件数据
- get_send_state=EventMesh.publish("get_send_state")
- if get_send_state != 1:
+ screen_NAME=EventMesh.publish("get_screen_NAME")
+ if screen_NAME != "wechat":
EventMesh.publish("load_screen", {"screen": "wechat_popup"})
else:
EventMesh.publish("wechat_updata_list_show")
get_wechat_data = EventMesh.publish("get_wechat_data")
- wechat_num = get_wechat_data[1]
+
MXA_MSG = get_wechat_data[0]
- wechat_recode_list = get_wechat_data[2]
+ wechat_recode_list = get_wechat_data[1]
+ wechat_num = wechat_recode_list["num"]
# print("TK_ProtoCol:datalen:{} {} {}".format(wechat_num,MXA_MSG,wechat_recode_list))
if wechat_num >= MXA_MSG:
wechat_num += 1
msg_txt = {}
# 0 1 2 3
- num_total = 0
- num_total = len(wechat_recode_list)
- if num_total == 0:
- num_total+=1
- if num_total >= 10:
- num_total = 10
print("wechat_num:init {}".format(wechat_num))
msg_txt = UnicodeHexStr_To_Utf8Str(msg_s)
# print("msg_txt:{}".format(msg_txt))
wechat_recode_list["%02d"%(wechat_num)] = "T:{}".format(msg_txt)
- wechat_recode_list['num'] = num_total
- EventMesh.publish("set_wechat_data",[MXA_MSG,num_total,wechat_recode_list])
+ wechat_recode_list['num'] = wechat_num
+ EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list])
# print("wechat_recode_list:len data:{}".format(wechat_recode_list))
EventMesh.publish(constants.PROTOCOL.MESSAGE_SEND)
- get_send_state=EventMesh.publish("get_send_state")
- if get_send_state != 1:
+ screen_NAME=EventMesh.publish("get_screen_NAME")
+ if screen_NAME != "wechat":
EventMesh.publish("load_screen", {"screen": "wechat_popup"})
else:
EventMesh.publish("wechat_updata_list_show")
self.read_call_log = {}
self.check_json = 0
self.call_log_detail_list = None
-
+ self.btn_create_lock = 0
self.timer = osTimer()
EventMesh.subscribe("call_log_update_show_list", self.call_log_update_show_list)
h = 0
if call_log_screen != None:
if self.check_json == True and len(self.read_call_log) != 0:
+ if self.btn_create_lock == 0:
+ self.btn_create_lock = 1
+ else :
+ return
none_call_log_title.set_text(" ")
self.call_log_detail_list.delete()#先删除一次控件
self.call_log_detail_list = lv.obj(call_log_cont_list_screen)
_btn_label5.set_text(num_name)
_btn_label5.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT)
h = h + 1
+ self.btn_create_lock = 0
else:
if call_log_cont_list_screen != None:
none_call_log_title.set_text("暂无记录")
self.msg_detail = {}
self.msg_nums = 0
self.sms_detail_list = None
+ self.btn_create_lock = 0
def post_processor_before_initialization(self):
self.msg_nums = sms.getMsgNums() #获取短信条数
j = 0
print("self.msg_nums:{}".format(self.msg_nums))
if self.msg_nums > 0 :
+ if self.btn_create_lock == 0 :
+ self.btn_create_lock = 1
+ else :
+ return
msg_list_t_done_img.add_flag(lv.obj.FLAG.HIDDEN)
no_msg_text.add_flag(lv.obj.FLAG.HIDDEN)
self.sms_detail_list.delete()#先删除一次控件
if msg == 1:
bottom_btn = self.sms_detail_list.get_child(-1)
bottom_btn.scroll_to_view(lv.ANIM.OFF)
+ self.btn_create_lock = 0
else:
if msg_cont_list_screen != None:
msg_list_t_done_img.clear_flag(lv.obj.FLAG.HIDDEN)
self.check_json = 0
self.timer = osTimer()
self.contact_detail_list = None
+ self.btn_create_list_show_lock = 0
EventMesh.subscribe("contact_updata_list_show", self.btn_create_list)
global contacts_screen,contacts_cont,contacts_top_title,contact_none_label,contacts_screen_list_screen
#读取json文件中的键作为label文本;
if self.check_json == True and len(self.phonebook) != 0:
+ if self.btn_create_list_show_lock == 0:
+ self.btn_create_list_show_lock = 1
+ else :
+ return
contact_none_label.add_flag(lv.obj.FLAG.HIDDEN)#隐藏空文本
j =0
i = 0
i += 1
if state == 1:
bottom_btn = self.contact_detail_list.get_child(-1)
- bottom_btn.scroll_to_view(lv.ANIM.OFF)
+ bottom_btn.scroll_to_view(lv.ANIM.OFF)
+ self.btn_create_list_show_lock = 1
else:
if contacts_screen_list_screen != None:
contact_none_label.clear_flag(lv.obj.FLAG.HIDDEN) #显示空文本
EventMesh.subscribe("set_interrup_incall", self.set_interrup_incall)
EventMesh.subscribe("get_interrup_incall", self.get_interrup_incall)
-
+ EventMesh.subscribe("get_screen_NAME",self.get_screen_NAME)
self.system_sleep_timer.start(1000, 1, self.system_sleep_timer_cb)
def set_interrup_incall(self, event, msg):
self.screen_list.append(screen)
return self
-
+ def get_screen_NAME(self, event, msg):
+ return self.screen.NAME
+
def load_screen(self, topic, msg):
print("msg1={}".format(msg))
if self.UI_high_priority_flag == 1:#电话界面屏蔽其他界面