From 9a15cd9a4a31a7aaf359aeba253b0b0c72a45946 Mon Sep 17 00:00:00 2001 From: cary-rowen Date: Sun, 7 Jan 2024 20:50:51 +0800 Subject: [PATCH] Fixed regression where some list item is not reporting name. --- addon/appModules/wechat.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/addon/appModules/wechat.py b/addon/appModules/wechat.py index 5aa2b4b..412eca8 100644 --- a/addon/appModules/wechat.py +++ b/addon/appModules/wechat.py @@ -52,22 +52,22 @@ def event_nameChange(self, obj, nextHandler): nextHandler() def event_gainFocus(self, obj, nextHandler, isFocus=False): - # 读出被转发的消息 - if obj.windowClassName == "ChatRecordWnd": - if obj.role == role.LISTITEM: - date = "" - msg = [] - children = obj.recursiveDescendants - for child in children: - if not speech.isBlank(child.name): - from datetime import datetime - try: - datetime.strptime(child.name, "%m-%d %H:%M:%S") - date = child.name - except ValueError: - msg.append(child.name) - msg.append(date) - obj.name = ','.join(msg) + if obj.role == role.LISTITEM and obj.windowClassName == 'ChatRecordWnd'\ + or obj.role == role.LISTITEM and obj.name is None: + date = "" + msg = [] + children = obj.recursiveDescendants + for child in children: + if not speech.isBlank(child.name): + from datetime import datetime + try: + datetime.strptime(child.name, "%m-%d %H:%M:%S") + date = child.name + except ValueError: + msg.append(child.name) + msg.append(date) + obj.name = ','.join(msg) + # 消息列表中特殊消息音效提醒 try: if obj.role == role.LISTITEM and obj.parent.name == "消息":