mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-09 09:31:18 +08:00
新增联系人详细信息显示
This commit is contained in:
parent
3dd8683944
commit
b711a2048b
@ -41,7 +41,7 @@ class tencent_struct:
|
||||
def __readString(self):
|
||||
try:
|
||||
length = self.__readUleb()
|
||||
res = self.__data[self.__off : self.__off + length]
|
||||
res = self.__data[self.__off: self.__off + length]
|
||||
self.__add(length)
|
||||
except:
|
||||
raise
|
||||
@ -78,7 +78,7 @@ class tencent_struct:
|
||||
def __readData(self):
|
||||
try:
|
||||
length = self.__readUleb()
|
||||
data = self.__data[self.__off : self.__off + length]
|
||||
data = self.__data[self.__off: self.__off + length]
|
||||
self.__add(length)
|
||||
return data
|
||||
except:
|
||||
@ -197,50 +197,54 @@ def decodeExtraBuf(extra_buf_content: bytes):
|
||||
"0E719F13": "备注图片",
|
||||
"759378AD": "手机号",
|
||||
}
|
||||
res = {}
|
||||
res = {'手机号': {'18':''}}
|
||||
while off < len(extra_buf_content):
|
||||
length = 4 # 块头
|
||||
trunk_head = extra_buf_content[off : off + length]
|
||||
trunk_head = extra_buf_content[off: off + length]
|
||||
off += length
|
||||
trunk_head = binascii.hexlify(trunk_head).decode().upper()
|
||||
if trunk_head in trunkName:
|
||||
trunk_head = trunkName[trunk_head]
|
||||
res[trunk_head] = {}
|
||||
char = extra_buf_content[off : off + 1]
|
||||
char = extra_buf_content[off: off + 1]
|
||||
off += 1
|
||||
field = binascii.hexlify(char).decode()
|
||||
if char == b"\x04": # 四个字节的int,小端序
|
||||
length = 4
|
||||
intContent = extra_buf_content[off : off + length]
|
||||
intContent = extra_buf_content[off: off + length]
|
||||
off += 4
|
||||
intContent = int.from_bytes(intContent, "little")
|
||||
res[trunk_head][field] = intContent
|
||||
elif char == b"\x18": # utf-16字符串
|
||||
length = 4
|
||||
lengthContent = extra_buf_content[off : off + length]
|
||||
lengthContent = extra_buf_content[off: off + length]
|
||||
off += 4
|
||||
lengthContent = int.from_bytes(lengthContent, "little")
|
||||
strContent = extra_buf_content[off : off + lengthContent]
|
||||
strContent = extra_buf_content[off: off + lengthContent]
|
||||
off += lengthContent
|
||||
res[trunk_head][field] = strContent.decode("utf-16").rstrip("\x00")
|
||||
elif char == b"\x17": # utf-8 protobuf
|
||||
length = 4
|
||||
lengthContent = extra_buf_content[off : off + length]
|
||||
lengthContent = extra_buf_content[off: off + length]
|
||||
off += 4
|
||||
lengthContent = int.from_bytes(lengthContent, "little")
|
||||
strContent = extra_buf_content[off : off + lengthContent]
|
||||
strContent = extra_buf_content[off: off + lengthContent]
|
||||
off += lengthContent
|
||||
res[trunk_head][field] = parseExtraBuf(strContent)
|
||||
elif char == b"\x02": # 一个字节的int
|
||||
content = extra_buf_content[off : off + 1]
|
||||
content = extra_buf_content[off: off + 1]
|
||||
off += 1
|
||||
res[trunk_head][field] = int.from_bytes(content, "little")
|
||||
elif char == b"\x05": # 暂时不知道有啥用,固定8个字节,先当int处理
|
||||
length = 8
|
||||
content = extra_buf_content[off : off + length]
|
||||
content = extra_buf_content[off: off + length]
|
||||
off += length
|
||||
res[trunk_head][field] = int.from_bytes(content, "little")
|
||||
return res
|
||||
return {
|
||||
'region': (res['国家']['18'], res['省份']['18'], res['市']['18']),
|
||||
'signature': res['个性签名']['18'],
|
||||
'telephone': res['手机号']['18'],
|
||||
}
|
||||
|
||||
|
||||
def singleton(cls):
|
||||
|
@ -2,6 +2,8 @@ import os.path
|
||||
import sqlite3
|
||||
import threading
|
||||
|
||||
|
||||
|
||||
lock = threading.Lock()
|
||||
db_path = "./app/Database/Msg/MicroMsg.db"
|
||||
|
||||
@ -43,9 +45,10 @@ class MicroMsg:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl
|
||||
sql = '''SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,COALESCE(ContactLabel.LabelName, 'None') AS labelName
|
||||
FROM Contact
|
||||
INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName
|
||||
LEFT JOIN ContactLabel ON Contact.LabelIDList = ContactLabel.LabelId
|
||||
WHERE (Type!=4)
|
||||
AND NickName != ''
|
||||
ORDER BY
|
||||
@ -67,15 +70,17 @@ class MicroMsg:
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''
|
||||
SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf
|
||||
SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,ContactLabel.LabelName
|
||||
FROM Contact
|
||||
INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName
|
||||
LEFT JOIN ContactLabel ON Contact.LabelIDList = ContactLabel.LabelId
|
||||
WHERE UserName = ?
|
||||
'''
|
||||
self.cursor.execute(sql, [username])
|
||||
result = self.cursor.fetchone()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
return result
|
||||
|
||||
def get_chatroom_info(self, chatroomname):
|
||||
@ -107,4 +112,13 @@ class MicroMsg:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
db_path = "./app/database/Msg/MicroMsg.db"
|
||||
msg = MicroMsg()
|
||||
msg.init_database()
|
||||
contacts = msg.get_contact()
|
||||
from app.DataBase.hard_link import decodeExtraBuf
|
||||
for contact in contacts:
|
||||
print(contact[-2])
|
||||
buf = contact[9]
|
||||
info = decodeExtraBuf(buf)
|
||||
print(info['个性签名'],info['国家'],info['省份'],info['市'])
|
@ -78,6 +78,8 @@ class Contact(Person):
|
||||
self.avatar = QPixmap()
|
||||
self.avatar_path = Icon.Default_avatar_path
|
||||
self.is_chatroom = self.wxid.__contains__('@chatroom')
|
||||
self.detail = contact_info.get('detail')
|
||||
self.label_name = contact_info.get('label_name')
|
||||
|
||||
|
||||
class ContactDefault(Person):
|
||||
|
@ -7,6 +7,7 @@ from app.person import Contact
|
||||
from app.ui.Icon import Icon
|
||||
from .contactInfo import ContactInfo
|
||||
from .contactUi import Ui_Form
|
||||
from ...DataBase.hard_link import decodeExtraBuf
|
||||
from ...util import search
|
||||
|
||||
# 美化样式表
|
||||
@ -144,14 +145,17 @@ class ShowContactThread(QThread):
|
||||
def run(self) -> None:
|
||||
contact_info_lists = micro_msg_db.get_contact()
|
||||
for contact_info_list in contact_info_lists:
|
||||
# UserName, Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl
|
||||
# UserName, Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl,ExtraBuf
|
||||
detail = decodeExtraBuf(contact_info_list[9])
|
||||
contact_info = {
|
||||
'UserName': contact_info_list[0],
|
||||
'Alias': contact_info_list[1],
|
||||
'Type': contact_info_list[2],
|
||||
'Remark': contact_info_list[3],
|
||||
'NickName': contact_info_list[4],
|
||||
'smallHeadImgUrl': contact_info_list[7]
|
||||
'smallHeadImgUrl': contact_info_list[7],
|
||||
'detail': detail,
|
||||
'label_name': contact_info_list[10],
|
||||
}
|
||||
contact = Contact(contact_info)
|
||||
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
||||
|
@ -106,7 +106,7 @@ class ExportDialog(QDialog):
|
||||
|
||||
def set_total_msg_num(self, num):
|
||||
self.total_msg_num = num
|
||||
# b''+num +(1,1)
|
||||
b''+num +(1,1)
|
||||
|
||||
def export_finished(self):
|
||||
self.export_button.setEnabled(True)
|
||||
|
@ -1,5 +1,6 @@
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from app.util.region_conversion import conversion_region_to_chinese
|
||||
from .userinfoUi import Ui_Frame
|
||||
|
||||
|
||||
@ -12,4 +13,11 @@ class UserinfoController(QWidget, Ui_Frame):
|
||||
self.l_nickname.setText(f'昵称:{contact.nickName}')
|
||||
self.l_username.setText(f'微信号:{contact.alias}')
|
||||
self.lineEdit.setText(contact.remark)
|
||||
self.progressBar.setVisible(False)
|
||||
# self.l_region.setVisible(False)
|
||||
self.l_contact_label.setText(contact.label_name)
|
||||
if contact.detail:
|
||||
self.l_signature.setText(contact.detail.get('signature'))
|
||||
self.l_tel.setText(contact.detail.get('telephone'))
|
||||
region = contact.detail.get('region')
|
||||
area = conversion_region_to_chinese(region)
|
||||
self.l_region.setText(f'地区:{area}')
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'userinfoUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
# Created by: PyQt5 UI code generator 5.15.10
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
@ -18,53 +18,56 @@ class Ui_Frame(object):
|
||||
Frame.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
|
||||
Frame.setMouseTracking(True)
|
||||
Frame.setTabletTracking(True)
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(Frame)
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(Frame)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
spacerItem = QtWidgets.QSpacerItem(162, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem1)
|
||||
self.gridLayout = QtWidgets.QGridLayout()
|
||||
self.gridLayout.setHorizontalSpacing(6)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout()
|
||||
self.gridLayout_2.setVerticalSpacing(0)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.l_avatar = QtWidgets.QLabel(Frame)
|
||||
self.l_avatar.setMinimumSize(QtCore.QSize(80, 80))
|
||||
self.l_avatar.setMaximumSize(QtCore.QSize(80, 80))
|
||||
self.l_avatar.setText("")
|
||||
self.l_avatar.setPixmap(QtGui.QPixmap("../../../a_img/be0fa6c0c4707fb5f7b37b660de826d3.jpg"))
|
||||
self.l_avatar.setScaledContents(True)
|
||||
self.l_avatar.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.l_avatar.setObjectName("l_avatar")
|
||||
self.gridLayout.addWidget(self.l_avatar, 0, 0, 3, 1)
|
||||
self.gridLayout_2.addWidget(self.l_avatar, 0, 0, 4, 1)
|
||||
self.l_remark = QtWidgets.QLabel(Frame)
|
||||
self.l_remark.setMinimumSize(QtCore.QSize(0, 30))
|
||||
self.l_remark.setMaximumSize(QtCore.QSize(16777215, 30))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.l_remark.setFont(font)
|
||||
self.l_remark.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_remark.setObjectName("l_remark")
|
||||
self.gridLayout.addWidget(self.l_remark, 0, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.l_remark, 0, 1, 1, 1)
|
||||
self.l_nickname = QtWidgets.QLabel(Frame)
|
||||
self.l_nickname.setMinimumSize(QtCore.QSize(0, 30))
|
||||
self.l_nickname.setMaximumSize(QtCore.QSize(16777215, 30))
|
||||
self.l_nickname.setMinimumSize(QtCore.QSize(0, 20))
|
||||
self.l_nickname.setMaximumSize(QtCore.QSize(16777215, 20))
|
||||
self.l_nickname.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_nickname.setObjectName("l_nickname")
|
||||
self.gridLayout.addWidget(self.l_nickname, 1, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.l_nickname, 1, 1, 1, 1)
|
||||
self.l_username = QtWidgets.QLabel(Frame)
|
||||
self.l_username.setMinimumSize(QtCore.QSize(0, 20))
|
||||
self.l_username.setMaximumSize(QtCore.QSize(16777215, 20))
|
||||
self.l_username.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_username.setObjectName("l_username")
|
||||
self.gridLayout.addWidget(self.l_username, 2, 1, 1, 1)
|
||||
self.gridLayout.setRowStretch(0, 1)
|
||||
self.gridLayout.setRowStretch(1, 1)
|
||||
self.gridLayout.setRowStretch(2, 1)
|
||||
self.verticalLayout.addLayout(self.gridLayout)
|
||||
self.gridLayout_2.addWidget(self.l_username, 2, 1, 1, 1)
|
||||
self.l_region = QtWidgets.QLabel(Frame)
|
||||
self.l_region.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_region.setObjectName("l_region")
|
||||
self.gridLayout_2.addWidget(self.l_region, 3, 1, 1, 1)
|
||||
self.verticalLayout.addLayout(self.gridLayout_2)
|
||||
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem2)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.gridLayout = QtWidgets.QGridLayout()
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.label = QtWidgets.QLabel(Frame)
|
||||
self.label.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.label.setMaximumSize(QtCore.QSize(80, 16777215))
|
||||
@ -72,7 +75,7 @@ class Ui_Frame(object):
|
||||
font.setPointSize(15)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.horizontalLayout.addWidget(self.label)
|
||||
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.lineEdit = QtWidgets.QLineEdit(Frame)
|
||||
self.lineEdit.setMinimumSize(QtCore.QSize(0, 25))
|
||||
self.lineEdit.setMaximumSize(QtCore.QSize(16777215, 25))
|
||||
@ -85,30 +88,52 @@ class Ui_Frame(object):
|
||||
" background:transparent;border-width:0;border-style:outset\n"
|
||||
" ")
|
||||
self.lineEdit.setObjectName("lineEdit")
|
||||
self.horizontalLayout.addWidget(self.lineEdit)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1)
|
||||
self.label_4 = QtWidgets.QLabel(Frame)
|
||||
self.label_4.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.label_4.setMaximumSize(QtCore.QSize(80, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.label_4.setFont(font)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.gridLayout.addWidget(self.label_4, 1, 0, 1, 1)
|
||||
self.l_tel = QtWidgets.QLabel(Frame)
|
||||
self.l_tel.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_tel.setObjectName("l_tel")
|
||||
self.gridLayout.addWidget(self.l_tel, 1, 1, 1, 1)
|
||||
self.label_3 = QtWidgets.QLabel(Frame)
|
||||
self.label_3.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.label_3.setMaximumSize(QtCore.QSize(80, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
|
||||
self.l_contact_label = QtWidgets.QLabel(Frame)
|
||||
self.l_contact_label.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_contact_label.setObjectName("l_contact_label")
|
||||
self.gridLayout.addWidget(self.l_contact_label, 2, 1, 1, 1)
|
||||
self.label_2 = QtWidgets.QLabel(Frame)
|
||||
self.label_2.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.label_2.setMaximumSize(QtCore.QSize(80, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
|
||||
self.l_signature = QtWidgets.QLabel(Frame)
|
||||
self.l_signature.setMinimumSize(QtCore.QSize(300, 0))
|
||||
self.l_signature.setMaximumSize(QtCore.QSize(300, 100))
|
||||
self.l_signature.setWordWrap(True)
|
||||
self.l_signature.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.l_signature.setObjectName("l_signature")
|
||||
self.gridLayout.addWidget(self.l_signature, 3, 1, 1, 1)
|
||||
self.verticalLayout.addLayout(self.gridLayout)
|
||||
spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem3)
|
||||
self.progressBar = QtWidgets.QProgressBar(Frame)
|
||||
self.progressBar.setProperty("value", 24)
|
||||
self.progressBar.setObjectName("progressBar")
|
||||
self.verticalLayout.addWidget(self.progressBar)
|
||||
spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout.addItem(spacerItem4)
|
||||
self.verticalLayout.setStretch(0, 2)
|
||||
self.verticalLayout.setStretch(1, 3)
|
||||
self.verticalLayout.setStretch(2, 4)
|
||||
self.verticalLayout.setStretch(3, 1)
|
||||
self.verticalLayout.setStretch(4, 4)
|
||||
self.verticalLayout.setStretch(5, 1)
|
||||
self.verticalLayout.setStretch(6, 2)
|
||||
self.horizontalLayout_2.addLayout(self.verticalLayout)
|
||||
spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem5)
|
||||
self.horizontalLayout_2.setStretch(0, 1)
|
||||
self.horizontalLayout_2.setStretch(1, 2)
|
||||
self.horizontalLayout_2.setStretch(2, 1)
|
||||
self.horizontalLayout_3.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||
spacerItem4 = QtWidgets.QSpacerItem(162, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem4)
|
||||
|
||||
self.retranslateUi(Frame)
|
||||
QtCore.QMetaObject.connectSlotsByName(Frame)
|
||||
@ -119,5 +144,12 @@ class Ui_Frame(object):
|
||||
self.l_remark.setText(_translate("Frame", "曹雨萱"))
|
||||
self.l_nickname.setText(_translate("Frame", "昵称:997"))
|
||||
self.l_username.setText(_translate("Frame", "账号:TextLabel"))
|
||||
self.l_region.setText(_translate("Frame", "TextLabel"))
|
||||
self.label.setText(_translate("Frame", "备注名"))
|
||||
self.lineEdit.setText(_translate("Frame", "曹雨萱"))
|
||||
self.label_4.setText(_translate("Frame", "电话"))
|
||||
self.l_tel.setText(_translate("Frame", "TextLabel"))
|
||||
self.label_3.setText(_translate("Frame", "标签"))
|
||||
self.l_contact_label.setText(_translate("Frame", "TextLabel"))
|
||||
self.label_2.setText(_translate("Frame", "个性签名"))
|
||||
self.l_signature.setText(_translate("Frame", "TextLabel"))
|
||||
|
350
app/util/region_conversion.py
Normal file
350
app/util/region_conversion.py
Normal file
@ -0,0 +1,350 @@
|
||||
# 中国省份拼音到中文的映射字典
|
||||
province_mapping = {
|
||||
'Anhui': '安徽',
|
||||
'Beijing': '北京',
|
||||
'Chongqing': '重庆',
|
||||
'Fujian': '福建',
|
||||
'Gansu': '甘肃',
|
||||
'Guangdong': '广东',
|
||||
'Guangxi': '广西',
|
||||
'Guizhou': '贵州',
|
||||
'Hainan': '海南',
|
||||
'Hebei': '河北',
|
||||
'Heilongjiang': '黑龙江',
|
||||
'Henan': '河南',
|
||||
'Hong Kong': '香港',
|
||||
'Hubei': '湖北',
|
||||
'Hunan': '湖南',
|
||||
'Inner Mongolia': '内蒙古',
|
||||
'Jiangsu': '江苏',
|
||||
'Jiangxi': '江西',
|
||||
'Jilin': '吉林',
|
||||
'Liaoning': '辽宁',
|
||||
'Macau': '澳门',
|
||||
'Ningxia': '宁夏',
|
||||
'Qinghai': '青海',
|
||||
'Shaanxi': '陕西',
|
||||
'Shandong': '山东',
|
||||
'Shanghai': '上海',
|
||||
'Shanxi': '山西',
|
||||
'Sichuan': '四川',
|
||||
'Taiwan': '台湾',
|
||||
'Tianjin': '天津',
|
||||
'Tibet': '西藏',
|
||||
'Xinjiang': '新疆',
|
||||
'Yunnan': '云南',
|
||||
'Zhejiang': '浙江',
|
||||
'Taipei': '台北',
|
||||
}
|
||||
|
||||
country_mapping = {
|
||||
'CN': '中国大陆',
|
||||
'TW': '中国台湾',
|
||||
}
|
||||
city_mapping = {
|
||||
"Beijing": "北京",
|
||||
"Tianjin": "天津",
|
||||
"Shanghai": "上海",
|
||||
"Chongqing": "重庆",
|
||||
"Yinchuan": "银川",
|
||||
"Shizuishan": "石嘴山",
|
||||
"Wuzhong": "吴忠",
|
||||
"Guyuan": "固原",
|
||||
"Zhongwei": "中卫",
|
||||
"Wulumuqi": "乌鲁木齐",
|
||||
"Kelamayi": "克拉玛依",
|
||||
"Lasa": "拉萨",
|
||||
"Huhehaote": "呼和浩特",
|
||||
"Baotou": "包头",
|
||||
"Wuhai": "乌海",
|
||||
"Chifeng": "赤峰",
|
||||
"Tongliao": "通辽",
|
||||
"Eerduosi": "鄂尔多斯",
|
||||
"Hulunbeier": "呼伦贝尔",
|
||||
"Bayannaoer": "巴彦淖尔",
|
||||
"Wulanchabu": "乌兰察布",
|
||||
"Nanning": "南宁",
|
||||
"Liuzhou": "柳州",
|
||||
"Guilin": "桂林",
|
||||
"Wuzhou": "梧州",
|
||||
"Beihai": "北海",
|
||||
"Chongzuo": "崇左",
|
||||
"Laibin": "来宾",
|
||||
"Hezhou": "贺州",
|
||||
"Yulin": "玉林",
|
||||
"Baise": "百色",
|
||||
"Hechi": "河池",
|
||||
"Qinzhou": "钦州",
|
||||
"Fangchenggang": "防城港",
|
||||
"Guigang": "贵港",
|
||||
"Harbin": "哈尔滨",
|
||||
"Daqing": "大庆",
|
||||
"Qiqihaer": "齐齐哈尔",
|
||||
"Jiamusi": "佳木斯",
|
||||
"Jixi": "鸡西",
|
||||
"Hegang": "鹤岗",
|
||||
"Shuangyashan": "双鸭山",
|
||||
"Mudanjiang": "牡丹江",
|
||||
"Yichun": "伊春",
|
||||
"Qitaihe": "七台河",
|
||||
"Heihe": "黑河",
|
||||
"Suihua": "绥化",
|
||||
"Changchun": "长春",
|
||||
"Jilin": "吉林",
|
||||
"Siping": "四平",
|
||||
"Liaoyuan": "辽源",
|
||||
"Tonghua": "通化",
|
||||
"Baishan": "白山",
|
||||
"Songyuan": "松原",
|
||||
"Baicheng": "白城",
|
||||
"Shenyang": "沈阳",
|
||||
"Dalian": "大连",
|
||||
"Anshan": "鞍山",
|
||||
"Fushun": "抚顺",
|
||||
"Benxi": "本溪",
|
||||
"Dandong": "丹东",
|
||||
"Jinzhou": "锦州",
|
||||
"Yingkou": "营口",
|
||||
"Fuxin": "阜新",
|
||||
"Liaoyang": "辽阳",
|
||||
"Panjin": "盘锦",
|
||||
"Tieling": "铁岭",
|
||||
"Chaoyang": "朝阳",
|
||||
"Huludao": "葫芦岛",
|
||||
"Shijiazhuang": "石家庄",
|
||||
"Tangshan": "唐山",
|
||||
"Handan": "邯郸",
|
||||
"Qinghuangdao": "秦皇岛",
|
||||
"Baoding": "保定",
|
||||
"Zhangjiakou": "张家口",
|
||||
"Chengde": "承德",
|
||||
"Langfang": "廊坊",
|
||||
"Cangzhou": "沧州",
|
||||
"Hengshui": "衡水",
|
||||
"Xingtai": "邢台",
|
||||
"Jinan": "济南",
|
||||
"Qingdao": "青岛",
|
||||
"Zibo": "淄博",
|
||||
"Zaozhuang": "枣庄",
|
||||
"Dongying": "东营",
|
||||
"Yantai": "烟台",
|
||||
"Weifang": "潍坊",
|
||||
"Jining": "济宁",
|
||||
"Taian": "泰安",
|
||||
"Weihai": "威海",
|
||||
"Rizhao": "日照",
|
||||
"Laiwu": "莱芜",
|
||||
"Linyi": "临沂",
|
||||
"Dezhou": "德州",
|
||||
"Liaocheng": "聊城",
|
||||
"Heze": "菏泽",
|
||||
"Binzhou": "滨州",
|
||||
"Nanjing": "南京",
|
||||
"Zhenjiang": "镇江",
|
||||
"Changzhou": "常州",
|
||||
"Wuxi": "无锡",
|
||||
"Suzhou": "苏州",
|
||||
"Xuzhou": "徐州",
|
||||
"Lianyungang": "连云港",
|
||||
"Huaian": "淮安",
|
||||
"Yancheng": "盐城",
|
||||
"Yangzhou": "扬州",
|
||||
"Taizhou": "泰州",
|
||||
"Nantong": "南通",
|
||||
"Suqian": "宿迁",
|
||||
"Hefei": "合肥",
|
||||
"Bengbu": "蚌埠",
|
||||
"Wuhu": "芜湖",
|
||||
"Huainan": "淮南",
|
||||
"Bozhou": "亳州",
|
||||
"Fuyang": "阜阳",
|
||||
"Huaibei": "淮北",
|
||||
"Suzhou": "宿州",
|
||||
"Chuzhou": "滁州",
|
||||
"Anqing": "安庆",
|
||||
"Chaohu": "巢湖",
|
||||
"Maanshan": "马鞍山",
|
||||
"Xuancheng": "宣城",
|
||||
"Huangshan": "黄山",
|
||||
"Chizhou": "池州",
|
||||
"Tongling": "铜陵",
|
||||
"Hangzhou": "杭州",
|
||||
"Jiaxing": "嘉兴",
|
||||
"Huzhou": "湖州",
|
||||
"Ningbo": "宁波",
|
||||
"Jinhua": "金华",
|
||||
"Wenzhou": "温州",
|
||||
"Lishui": "丽水",
|
||||
"Shaoxing": "绍兴",
|
||||
"Quzhou": "衢州",
|
||||
"Zhoushan": "舟山",
|
||||
"Taizhou": "台州",
|
||||
"Fuzhou": "福州",
|
||||
"Xiamen": "厦门",
|
||||
"Quanzhou": "泉州",
|
||||
"Sanming": "三明",
|
||||
"Nanping": "南平",
|
||||
"Zhangzhou": "漳州",
|
||||
"Putian": "莆田",
|
||||
"Ningde": "宁德",
|
||||
"Longyan": "龙岩",
|
||||
"Guangzhou": "广州",
|
||||
"Shenzhen": "深圳",
|
||||
"Shantou": "汕头",
|
||||
"Huizhou": "惠州",
|
||||
"Zhuhai": "珠海",
|
||||
"Jieyang": "揭阳",
|
||||
"Foshan": "佛山",
|
||||
"Heyuan": "河源",
|
||||
"Yangjiang": "阳江",
|
||||
"Maoming": "茂名",
|
||||
"Zhanjiang": "湛江",
|
||||
"Meizhou": "梅州",
|
||||
"Zhaoqing": "肇庆",
|
||||
"Shaoguan": "韶关",
|
||||
"Chaozhou": "潮州",
|
||||
"Dongguan": "东莞",
|
||||
"Zhongshan": "中山",
|
||||
"Qingyuan": "清远",
|
||||
"Jiangmen": "江门",
|
||||
"Shanwei": "汕尾",
|
||||
"Yunfu": "云浮",
|
||||
"Haikou": "海口",
|
||||
"Sanya": "三亚",
|
||||
"Kunming": "昆明",
|
||||
"Qujing": "曲靖",
|
||||
"Yuxi": "玉溪",
|
||||
"Baoshan": "保山",
|
||||
"Zhaotong": "昭通",
|
||||
"Lijiang": "丽江",
|
||||
"Puer": "普洱",
|
||||
"Lincang": "临沧",
|
||||
"Guiyang": "贵阳",
|
||||
"Liupanshui": "六盘水",
|
||||
"Zunyi": "遵义",
|
||||
"Anshun": "安顺",
|
||||
"Chengdu": "成都",
|
||||
"Mianyang": "绵阳",
|
||||
"Deyang": "德阳",
|
||||
"Guangyuan": "广元",
|
||||
"Zigong": "自贡",
|
||||
"Panzhihua": "攀枝花",
|
||||
"Leshan": "乐山",
|
||||
"Nanchong": "南充",
|
||||
"Neijiang": "内江",
|
||||
"Suining": "遂宁",
|
||||
"Guangan": "广安",
|
||||
"Luzhou": "泸州",
|
||||
"Dazhou": "达州",
|
||||
"Meishan": "眉山",
|
||||
"Yibin": "宜宾",
|
||||
"Yaan": "雅安",
|
||||
"Ziyang": "资阳",
|
||||
"Changsha": "长沙",
|
||||
"Zhuzhou": "株洲",
|
||||
"Xiangtan": "湘潭",
|
||||
"Hengyang": "衡阳",
|
||||
"Yueyang": "岳阳",
|
||||
"Chenzhou": "郴州",
|
||||
"Yongzhou": "永州",
|
||||
"Shaoyang": "邵阳",
|
||||
"Huaihua": "怀化",
|
||||
"Changde": "常德",
|
||||
"Yiyang": "益阳",
|
||||
"Zhangjiajie": "张家界",
|
||||
"Loudi": "娄底",
|
||||
"Wuhan": "武汉",
|
||||
"Xiangfan": "襄樊",
|
||||
"Yichang": "宜昌",
|
||||
"Huangshi": "黄石",
|
||||
"Ezhou": "鄂州",
|
||||
"Suizhou": "随州",
|
||||
"Jingzhou": "荆州",
|
||||
"Jingmen": "荆门",
|
||||
"Shiyan": "十堰",
|
||||
"Xiaogan": "孝感",
|
||||
"Huanggang": "黄冈",
|
||||
"Xianning": "咸宁",
|
||||
"Zhengzhou": "郑州",
|
||||
"Luoyang": "洛阳",
|
||||
"Kaifeng": "开封",
|
||||
"Luohe": "漯河",
|
||||
"Anyang": "安阳",
|
||||
"Xinxiang": "新乡",
|
||||
"Zhoukou": "周口",
|
||||
"Sanmenxia": "三门峡",
|
||||
"Jiaozuo": "焦作",
|
||||
"Pingdingshan": "平顶山",
|
||||
"Xinyang": "信阳",
|
||||
"Nanyang": "南阳",
|
||||
"Hebi": "鹤壁",
|
||||
"Puyang": "濮阳",
|
||||
"Xuchang": "许昌",
|
||||
"Shangqiu": "商丘",
|
||||
"Zhumadian": "驻马店",
|
||||
"Taiyuan": "太原",
|
||||
"DaTong": "大同",
|
||||
"Xinzhou": "忻州",
|
||||
"Yangquan": "阳泉",
|
||||
"Changzhi": "长治",
|
||||
"Jincheng": "晋城",
|
||||
"Shuozhou": "朔州",
|
||||
"Jinzhong": "晋中",
|
||||
"Yuncheng": "运城",
|
||||
"Linfen": "临汾",
|
||||
"Lvliang": "吕梁",
|
||||
"Xi'an": "西安",
|
||||
"Xianyang": "咸阳",
|
||||
"Tongchuan": "铜川",
|
||||
"Yanan": "延安",
|
||||
"Baoji": "宝鸡",
|
||||
"Weinan": "渭南",
|
||||
"Hanzhoung": "汉中",
|
||||
"Ankang": "安康",
|
||||
"Shangluo": "商洛",
|
||||
"Yulin": "榆林",
|
||||
"Lanzhou": "兰州",
|
||||
"Tianshui": "天水",
|
||||
"Pingliang": "平凉",
|
||||
"Jiuquan": "酒泉",
|
||||
"Jiayuguan": "嘉峪关",
|
||||
"Jinchang": "金昌",
|
||||
"baiyiin": "白银",
|
||||
"Wuwei": "武威",
|
||||
"Zhangye": "张掖",
|
||||
"Qingyang": "庆阳",
|
||||
"Dingxi": "定西",
|
||||
"Longnan": "陇南",
|
||||
"Xining": "西宁",
|
||||
"Nanchang": "南昌",
|
||||
"Jiujiang": "九江",
|
||||
"Ganzhou": "赣州",
|
||||
"Jian": "吉安",
|
||||
"Yingtan": "鹰潭",
|
||||
"Shangrao": "上饶",
|
||||
"Pingxiang": "萍乡",
|
||||
"Jingdezhen": "景德镇",
|
||||
"Xinyu": "新余",
|
||||
"Yichun": "宜春",
|
||||
"Fuzhou": "抚州"
|
||||
}
|
||||
|
||||
|
||||
def conversion_region_to_chinese(region: tuple):
|
||||
area = ''
|
||||
if region[2]:
|
||||
if region[2] in city_mapping:
|
||||
area = city_mapping[region[2]]
|
||||
else:
|
||||
area = region[2]
|
||||
if region[1]:
|
||||
if region[1] in province_mapping:
|
||||
area = f'{province_mapping[region[1]]} {area}'
|
||||
else:
|
||||
area = f'{region[1]} {area}'
|
||||
if region[0]:
|
||||
if region[0] in country_mapping:
|
||||
area = f'{country_mapping[region[0]]} {area}'
|
||||
else:
|
||||
area = f'{region[0]} {area}'
|
||||
return area
|
9
main.py
9
main.py
@ -17,6 +17,8 @@ ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("WeChatReport")
|
||||
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
|
||||
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
|
||||
widget = None
|
||||
|
||||
|
||||
def excepthook(exc_type, exc_value, traceback_):
|
||||
# 将异常信息转为字符串
|
||||
|
||||
@ -25,13 +27,16 @@ def excepthook(exc_type, exc_value, traceback_):
|
||||
error_message = ''.join(traceback.format_exception(exc_type, exc_value, traceback_))
|
||||
msg = f"Exception Type: {exc_type.__name__}\nException Value: {exc_value}\ndetails: {error_message}"
|
||||
logger.error(f'程序发生了错误:\n\n{msg}')
|
||||
QMessageBox.critical(widget, "Unhandled Exception", msg, QMessageBox.Ok)
|
||||
QMessageBox.critical(None, "Unhandled Exception", msg, QMessageBox.Ok)
|
||||
|
||||
# 调用原始的 excepthook,以便程序正常退出
|
||||
sys.__excepthook__(exc_type, exc_value, traceback_)
|
||||
|
||||
|
||||
# 设置 excepthook
|
||||
sys.excepthook = excepthook
|
||||
|
||||
|
||||
class ViewController(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -80,7 +85,7 @@ if __name__ == '__main__':
|
||||
font = QFont('微软雅黑', 12) # 使用 Times New Roman 字体,字体大小为 14
|
||||
app.setFont(font)
|
||||
view = ViewController()
|
||||
widget = view
|
||||
widget = view.viewMainWindow
|
||||
try:
|
||||
# view.loadPCDecryptView()
|
||||
view.loadMainWinView()
|
||||
|
Loading…
Reference in New Issue
Block a user