MCPcopy
hub / github.com/cluic/wxauto / GetAllFriends

Method GetAllFriends

wxauto/elements.py:613–635  ·  view source on GitHub ↗

获取好友列表

(self)

Source from the content-addressed store, hash-verified

611 self.ContactBox.SendKeys(keyword)
612
613 def GetAllFriends(self):
614 """获取好友列表"""
615 wxlog.debug("获取好友列表")
616 self._show()
617 contacts_list = []
618 while True:
619 contact_ele_list = self.ContactBox.ListControl().GetChildren()
620 for ele in contact_ele_list:
621 contacts_info = {
622 'nickname': ele.TextControl().Name,
623 'remark': ele.ButtonControl(foundIndex=2).Name,
624 'tags': ele.ButtonControl(foundIndex=3).Name.split(','),
625 }
626 if contacts_info.get('remark') in ('添加备注', ''):
627 contacts_info['remark'] = None
628 if contacts_info.get('tags') in (['添加标签'], ['']):
629 contacts_info['tags'] = None
630 if contacts_info not in contacts_list:
631 contacts_list.append(contacts_info)
632 bottom = self.ContactBox.ListControl().GetChildren()[-1].BoundingRectangle.top
633 self.ContactBox.WheelDown(wheelTimes=5, waitTime=0.1)
634 if bottom == self.ContactBox.ListControl().GetChildren()[-1].BoundingRectangle.top:
635 return contacts_list
636
637 def Close(self):
638 """关闭联系人窗口"""

Callers 1

GetAllFriendsMethod · 0.95

Calls 6

_showMethod · 0.95
ListControlMethod · 0.80
TextControlMethod · 0.80
ButtonControlMethod · 0.80
WheelDownMethod · 0.80
GetChildrenMethod · 0.45

Tested by

no test coverage detected