mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-21 01:52:35 +08:00
修改变量名
This commit is contained in:
parent
3b75ba2455
commit
c4ba4cc46c
@ -18,7 +18,7 @@ from docx.oxml.ns import qn
|
|||||||
from .package_msg import PackageMsg
|
from .package_msg import PackageMsg
|
||||||
from ..DataBase import media_msg_db, hard_link_db, micro_msg_db, msg_db
|
from ..DataBase import media_msg_db, hard_link_db, micro_msg_db, msg_db
|
||||||
from ..log import logger
|
from ..log import logger
|
||||||
from ..person import MePC
|
from ..person import Me
|
||||||
from ..util import path
|
from ..util import path
|
||||||
from ..util.compress_content import parser_reply
|
from ..util.compress_content import parser_reply
|
||||||
from ..util.emoji import get_emoji_url
|
from ..util.emoji import get_emoji_url
|
||||||
@ -270,22 +270,22 @@ class ChildThread(QThread):
|
|||||||
if self.contact.is_chatroom:
|
if self.contact.is_chatroom:
|
||||||
avatar = message[12].smallHeadImgUrl
|
avatar = message[12].smallHeadImgUrl
|
||||||
else:
|
else:
|
||||||
avatar = MePC().smallHeadImgUrl if is_send else self.contact.smallHeadImgUrl
|
avatar = Me().smallHeadImgUrl if is_send else self.contact.smallHeadImgUrl
|
||||||
if is_absolute_path:
|
if is_absolute_path:
|
||||||
if self.contact.is_chatroom:
|
if self.contact.is_chatroom:
|
||||||
avatar = message[12].avatar_path
|
avatar = message[12].avatar_path
|
||||||
else:
|
else:
|
||||||
avatar = MePC().avatar_path if is_send else self.contact.avatar_path
|
avatar = Me().avatar_path if is_send else self.contact.avatar_path
|
||||||
return avatar
|
return avatar
|
||||||
|
|
||||||
def get_display_name(self, is_send, message) -> str:
|
def get_display_name(self, is_send, message) -> str:
|
||||||
if self.contact.is_chatroom:
|
if self.contact.is_chatroom:
|
||||||
if is_send:
|
if is_send:
|
||||||
display_name = MePC().name
|
display_name = Me().name
|
||||||
else:
|
else:
|
||||||
display_name = message[12].remark
|
display_name = message[12].remark
|
||||||
else:
|
else:
|
||||||
display_name = MePC().name if is_send else self.contact.remark
|
display_name = Me().name if is_send else self.contact.remark
|
||||||
return escape_js_and_html(display_name)
|
return escape_js_and_html(display_name)
|
||||||
|
|
||||||
def text(self, doc, message):
|
def text(self, doc, message):
|
||||||
@ -332,9 +332,9 @@ class ChildThread(QThread):
|
|||||||
if self.output_type == Output.HTML:
|
if self.output_type == Output.HTML:
|
||||||
str_content = escape_js_and_html(str_content)
|
str_content = escape_js_and_html(str_content)
|
||||||
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_path)):
|
||||||
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_thumb_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)):
|
||||||
return
|
return
|
||||||
image_path = image_thumb_path
|
image_path = image_thumb_path
|
||||||
image_path = get_image_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
image_path = get_image_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
||||||
@ -351,9 +351,9 @@ class ChildThread(QThread):
|
|||||||
run = content.paragraphs[0].add_run()
|
run = content.paragraphs[0].add_run()
|
||||||
str_content = escape_js_and_html(str_content)
|
str_content = escape_js_and_html(str_content)
|
||||||
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_path)):
|
||||||
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_thumb_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)):
|
||||||
return
|
return
|
||||||
image_path = image_thumb_path
|
image_path = image_thumb_path
|
||||||
image_path = get_image_abs_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
image_path = get_image_abs_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
||||||
@ -566,7 +566,7 @@ class ChildThread(QThread):
|
|||||||
return
|
return
|
||||||
if video_path is None and image_path is None:
|
if video_path is None and image_path is None:
|
||||||
return
|
return
|
||||||
video_path = f'{MePC().wx_dir}/{video_path}'
|
video_path = f'{Me().wx_dir}/{video_path}'
|
||||||
if os.path.exists(video_path):
|
if os.path.exists(video_path):
|
||||||
new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
|
new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
|
||||||
if not os.path.exists(new_path):
|
if not os.path.exists(new_path):
|
||||||
@ -741,9 +741,7 @@ class ChildThread(QThread):
|
|||||||
messages = packagemsg.get_package_message_by_wxid(self.contact.wxid)
|
messages = packagemsg.get_package_message_by_wxid(self.contact.wxid)
|
||||||
else:
|
else:
|
||||||
messages = msg_db.get_messages(self.contact.wxid)
|
messages = msg_db.get_messages(self.contact.wxid)
|
||||||
|
Me().save_avatar(os.path.join(f"{origin_docx_path}/avatar/{Me().wxid}.png"))
|
||||||
MePC().avatar.save(os.path.join(f"{origin_docx_path}/avatar/{MePC().wxid}.png"))
|
|
||||||
MePC().save_avatar(os.path.join(f"{origin_docx_path}/avatar/{MePC().wxid}.png"))
|
|
||||||
if self.contact.is_chatroom:
|
if self.contact.is_chatroom:
|
||||||
for message in messages:
|
for message in messages:
|
||||||
if message[4]: # is_send
|
if message[4]: # is_send
|
||||||
@ -884,9 +882,9 @@ class OutputImage(QThread):
|
|||||||
timestamp = message[5]
|
timestamp = message[5]
|
||||||
try:
|
try:
|
||||||
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_path)):
|
||||||
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_thumb_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)):
|
||||||
continue
|
continue
|
||||||
image_path = image_thumb_path
|
image_path = image_thumb_path
|
||||||
image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
||||||
@ -928,9 +926,9 @@ class OutputImageChild(QThread):
|
|||||||
timestamp = message[5]
|
timestamp = message[5]
|
||||||
try:
|
try:
|
||||||
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_path)):
|
||||||
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True)
|
||||||
if not os.path.exists(os.path.join(MePC().wx_dir, image_thumb_path)):
|
if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)):
|
||||||
continue
|
continue
|
||||||
image_path = image_thumb_path
|
image_path = image_thumb_path
|
||||||
image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image')
|
||||||
|
@ -3,7 +3,7 @@ import threading
|
|||||||
from app.DataBase import msg_db, micro_msg_db, misc_db
|
from app.DataBase import msg_db, micro_msg_db, misc_db
|
||||||
from app.util.protocbuf.msg_pb2 import MessageBytesExtra
|
from app.util.protocbuf.msg_pb2 import MessageBytesExtra
|
||||||
from app.util.protocbuf.roomdata_pb2 import ChatRoomData
|
from app.util.protocbuf.roomdata_pb2 import ChatRoomData
|
||||||
from app.person import ContactPC, MePC, ContactDefault
|
from app.person import Contact, Me, ContactDefault
|
||||||
|
|
||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class PackageMsg:
|
|||||||
for row in messages:
|
for row in messages:
|
||||||
message = list(row)
|
message = list(row)
|
||||||
if message[4] == 1: # 自己发送的就没必要解析了
|
if message[4] == 1: # 自己发送的就没必要解析了
|
||||||
message.append(MePC())
|
message.append(Me())
|
||||||
updated_messages.append(message)
|
updated_messages.append(message)
|
||||||
continue
|
continue
|
||||||
if message[10] is None: # BytesExtra是空的跳过
|
if message[10] is None: # BytesExtra是空的跳过
|
||||||
@ -146,7 +146,7 @@ class PackageMsg:
|
|||||||
'NickName': contact_info_list[4],
|
'NickName': contact_info_list[4],
|
||||||
'smallHeadImgUrl': contact_info_list[7]
|
'smallHeadImgUrl': contact_info_list[7]
|
||||||
}
|
}
|
||||||
contact = ContactPC(contact_info)
|
contact = Contact(contact_info)
|
||||||
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
||||||
contact.set_avatar(contact.smallHeadImgBLOG)
|
contact.set_avatar(contact.smallHeadImgBLOG)
|
||||||
message.append(contact)
|
message.append(contact)
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
"""
|
||||||
|
定义各种联系人
|
||||||
|
"""
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
|
||||||
from PyQt5.QtGui import QPixmap
|
from PyQt5.QtGui import QPixmap
|
||||||
|
|
||||||
from app.ui.Icon import Icon
|
from app.ui.Icon import Icon
|
||||||
|
|
||||||
|
|
||||||
@ -20,6 +21,11 @@ def singleton(cls):
|
|||||||
|
|
||||||
|
|
||||||
class Person:
|
class Person:
|
||||||
|
def __init__(self):
|
||||||
|
self.avatar_path = None
|
||||||
|
self.avatar = None
|
||||||
|
self.avatar_path_qt = Icon.Default_avatar_path
|
||||||
|
|
||||||
def set_avatar(self, img_bytes):
|
def set_avatar(self, img_bytes):
|
||||||
if not img_bytes:
|
if not img_bytes:
|
||||||
self.avatar.load(Icon.Default_avatar_path)
|
self.avatar.load(Icon.Default_avatar_path)
|
||||||
@ -46,7 +52,7 @@ class Person:
|
|||||||
|
|
||||||
|
|
||||||
@singleton
|
@singleton
|
||||||
class MePC(Person):
|
class Me(Person):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.avatar = QPixmap(Icon.Default_avatar_path)
|
self.avatar = QPixmap(Icon.Default_avatar_path)
|
||||||
self.avatar_path = ':/icons/icons/default_avatar.svg'
|
self.avatar_path = ':/icons/icons/default_avatar.svg'
|
||||||
@ -57,7 +63,7 @@ class MePC(Person):
|
|||||||
self.smallHeadImgUrl = ''
|
self.smallHeadImgUrl = ''
|
||||||
|
|
||||||
|
|
||||||
class ContactPC(Person):
|
class Contact(Person):
|
||||||
def __init__(self, contact_info: Dict):
|
def __init__(self, contact_info: Dict):
|
||||||
self.wxid = contact_info.get('UserName')
|
self.wxid = contact_info.get('UserName')
|
||||||
self.remark = contact_info.get('Remark')
|
self.remark = contact_info.get('Remark')
|
||||||
@ -87,7 +93,29 @@ class ContactDefault(Person):
|
|||||||
self.is_chatroom = False
|
self.is_chatroom = False
|
||||||
|
|
||||||
|
|
||||||
|
class Contacts:
|
||||||
|
def __init__(self):
|
||||||
|
self.contacts: Dict[str:Contact] = {}
|
||||||
|
|
||||||
|
def add(self, wxid, contact: Contact):
|
||||||
|
if wxid not in contact:
|
||||||
|
self.contacts[wxid] = contact
|
||||||
|
|
||||||
|
def get(self, wxid: str) -> Contact:
|
||||||
|
return self.contacts.get(wxid)
|
||||||
|
|
||||||
|
def remove(self, wxid: str):
|
||||||
|
return self.contacts.pop(wxid)
|
||||||
|
|
||||||
|
def save_avatar(self, avatar_dir: str = './data/avatar/'):
|
||||||
|
for wxid, contact in self.contacts.items():
|
||||||
|
avatar_path = os.path.join(avatar_dir, wxid + '.png')
|
||||||
|
if os.path.exists(avatar_path):
|
||||||
|
continue
|
||||||
|
contact.save_avatar(avatar_path)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
p1 = MePC()
|
p1 = Me()
|
||||||
p2 = MePC()
|
p2 = Me()
|
||||||
print(p1 == p2)
|
print(p1 == p2)
|
||||||
|
@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QHBoxLayout
|
|||||||
|
|
||||||
from app.DataBase import msg_db, hard_link_db
|
from app.DataBase import msg_db, hard_link_db
|
||||||
from app.components.bubble_message import BubbleMessage, ChatWidget, Notice
|
from app.components.bubble_message import BubbleMessage, ChatWidget, Notice
|
||||||
from app.person import MePC
|
from app.person import Me
|
||||||
from app.util import get_abs_path
|
from app.util import get_abs_path
|
||||||
from app.util.emoji import get_emoji
|
from app.util.emoji import get_emoji
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class ChatInfo(QWidget):
|
|||||||
str_time = message[8]
|
str_time = message[8]
|
||||||
# print(type_, type(type_))
|
# print(type_, type(type_))
|
||||||
is_send = message[4]
|
is_send = message[4]
|
||||||
avatar = MePC().avatar if is_send else self.contact.avatar
|
avatar = Me().avatar if is_send else self.contact.avatar
|
||||||
timestamp = message[5]
|
timestamp = message[5]
|
||||||
BytesExtra = message[10]
|
BytesExtra = message[10]
|
||||||
if type_ == 1:
|
if type_ == 1:
|
||||||
|
@ -3,7 +3,7 @@ from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit
|
|||||||
|
|
||||||
from app.DataBase import micro_msg_db, misc_db, msg_db
|
from app.DataBase import micro_msg_db, misc_db, msg_db
|
||||||
from app.components import ContactQListWidgetItem, ScrollBar
|
from app.components import ContactQListWidgetItem, ScrollBar
|
||||||
from app.person import ContactPC
|
from app.person import Contact
|
||||||
from app.ui.Icon import Icon
|
from app.ui.Icon import Icon
|
||||||
from app.util import search
|
from app.util import search
|
||||||
from .chatUi import Ui_Form
|
from .chatUi import Ui_Form
|
||||||
@ -126,7 +126,7 @@ class ChatWindow(QWidget, Ui_Form):
|
|||||||
|
|
||||||
|
|
||||||
class ShowContactThread(QThread):
|
class ShowContactThread(QThread):
|
||||||
showSingal = pyqtSignal(ContactPC)
|
showSingal = pyqtSignal(Contact)
|
||||||
load_finish_signal = pyqtSignal(bool)
|
load_finish_signal = pyqtSignal(bool)
|
||||||
|
|
||||||
# heightSingal = pyqtSignal(int)
|
# heightSingal = pyqtSignal(int)
|
||||||
@ -145,7 +145,7 @@ class ShowContactThread(QThread):
|
|||||||
'NickName': contact_info_list[4],
|
'NickName': contact_info_list[4],
|
||||||
'smallHeadImgUrl': contact_info_list[7]
|
'smallHeadImgUrl': contact_info_list[7]
|
||||||
}
|
}
|
||||||
contact = ContactPC(contact_info)
|
contact = Contact(contact_info)
|
||||||
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
||||||
contact.set_avatar(contact.smallHeadImgBLOG)
|
contact.set_avatar(contact.smallHeadImgBLOG)
|
||||||
self.showSingal.emit(contact)
|
self.showSingal.emit(contact)
|
||||||
@ -154,7 +154,7 @@ class ShowContactThread(QThread):
|
|||||||
|
|
||||||
|
|
||||||
class ShowThread(QThread):
|
class ShowThread(QThread):
|
||||||
showSingal = pyqtSignal(ContactPC)
|
showSingal = pyqtSignal(Contact)
|
||||||
load_finish_signal = pyqtSignal(bool)
|
load_finish_signal = pyqtSignal(bool)
|
||||||
|
|
||||||
# heightSingal = pyqtSignal(int)
|
# heightSingal = pyqtSignal(int)
|
||||||
|
@ -6,11 +6,14 @@ from app.DataBase.output_pc import Output
|
|||||||
from app.ui.Icon import Icon
|
from app.ui.Icon import Icon
|
||||||
from .contactInfoUi import Ui_Form
|
from .contactInfoUi import Ui_Form
|
||||||
from .userinfo import userinfo
|
from .userinfo import userinfo
|
||||||
from ...person import ContactPC, MePC
|
from ...person import Contact, Me
|
||||||
from .export_dialog import ExportDialog
|
from .export_dialog import ExportDialog
|
||||||
|
|
||||||
|
|
||||||
class ContactInfo(QWidget, Ui_Form):
|
class ContactInfo(QWidget, Ui_Form):
|
||||||
|
"""
|
||||||
|
显示联系人信息
|
||||||
|
"""
|
||||||
exitSignal = pyqtSignal()
|
exitSignal = pyqtSignal()
|
||||||
urlSignal = pyqtSignal(QUrl)
|
urlSignal = pyqtSignal(QUrl)
|
||||||
|
|
||||||
@ -18,7 +21,7 @@ class ContactInfo(QWidget, Ui_Form):
|
|||||||
def __init__(self, contact, parent=None):
|
def __init__(self, contact, parent=None):
|
||||||
super(ContactInfo, self).__init__(parent)
|
super(ContactInfo, self).__init__(parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.contact: ContactPC = contact
|
self.contact: Contact = contact
|
||||||
self.view_userinfo = userinfo.UserinfoController(self.contact)
|
self.view_userinfo = userinfo.UserinfoController(self.contact)
|
||||||
self.btn_back.clicked.connect(self.back)
|
self.btn_back.clicked.connect(self.back)
|
||||||
self.init_ui()
|
self.init_ui()
|
||||||
@ -61,14 +64,6 @@ class ContactInfo(QWidget, Ui_Form):
|
|||||||
"马上就实现该功能"
|
"马上就实现该功能"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
self.stackedWidget.setCurrentWidget(self.view_analysis)
|
|
||||||
if 'room' in self.contact.wxid:
|
|
||||||
QMessageBox.warning(
|
|
||||||
self, '警告',
|
|
||||||
'暂不支持群组'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
self.view_analysis.start()
|
|
||||||
|
|
||||||
def annual_report(self):
|
def annual_report(self):
|
||||||
if 'room' in self.contact.wxid:
|
if 'room' in self.contact.wxid:
|
||||||
@ -78,7 +73,7 @@ class ContactInfo(QWidget, Ui_Form):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
self.contact.save_avatar()
|
self.contact.save_avatar()
|
||||||
MePC().save_avatar()
|
Me().save_avatar()
|
||||||
self.report_thread = ReportThread(self.contact)
|
self.report_thread = ReportThread(self.contact)
|
||||||
self.report_thread.okSignal.connect(lambda x: QDesktopServices.openUrl(QUrl("http://127.0.0.1:21314")))
|
self.report_thread.okSignal.connect(lambda x: QDesktopServices.openUrl(QUrl("http://127.0.0.1:21314")))
|
||||||
self.report_thread.start()
|
self.report_thread.start()
|
||||||
@ -96,15 +91,12 @@ class ContactInfo(QWidget, Ui_Form):
|
|||||||
"马上就实现该功能"
|
"马上就实现该功能"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
self.stackedWidget.setCurrentWidget(self.view_emotion)
|
|
||||||
|
|
||||||
self.view_emotion.start()
|
|
||||||
|
|
||||||
def back(self):
|
def back(self):
|
||||||
"""
|
"""
|
||||||
将userinfo界面设置为可见,其他界面设置为不可见
|
将userinfo界面设置为可见,其他界面设置为不可见
|
||||||
"""
|
"""
|
||||||
self.stackedWidget.setCurrentWidget(self.view_userinfo)
|
return
|
||||||
|
|
||||||
def output(self):
|
def output(self):
|
||||||
"""
|
"""
|
||||||
@ -126,24 +118,6 @@ class ContactInfo(QWidget, Ui_Form):
|
|||||||
dialog = ExportDialog(self.contact, title='选择导出的消息类型', file_type='txt', parent=self)
|
dialog = ExportDialog(self.contact, title='选择导出的消息类型', file_type='txt', parent=self)
|
||||||
result = dialog.exec_() # 使用exec_()获取用户的操作结果
|
result = dialog.exec_() # 使用exec_()获取用户的操作结果
|
||||||
|
|
||||||
def hide_progress_bar(self, int):
|
|
||||||
reply = QMessageBox(self)
|
|
||||||
reply.setIcon(QMessageBox.Information)
|
|
||||||
reply.setWindowTitle('OK')
|
|
||||||
reply.setText(f"导出聊天记录成功\n在./data/目录下(跟exe文件在一起)")
|
|
||||||
reply.addButton("确认", QMessageBox.AcceptRole)
|
|
||||||
reply.addButton("取消", QMessageBox.RejectRole)
|
|
||||||
api = reply.exec_()
|
|
||||||
self.view_userinfo.progressBar.setVisible(False)
|
|
||||||
|
|
||||||
def output_progress(self, value):
|
|
||||||
self.view_userinfo.progressBar.setProperty('value', value)
|
|
||||||
|
|
||||||
def set_progressBar_range(self, value):
|
|
||||||
self.view_userinfo.progressBar.setVisible(True)
|
|
||||||
self.view_userinfo.progressBar.setRange(0, value)
|
|
||||||
|
|
||||||
|
|
||||||
class ReportThread(QThread):
|
class ReportThread(QThread):
|
||||||
okSignal = pyqtSignal(bool)
|
okSignal = pyqtSignal(bool)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QLineEdit
|
|||||||
|
|
||||||
from app.DataBase import micro_msg_db, misc_db
|
from app.DataBase import micro_msg_db, misc_db
|
||||||
from app.components import ContactQListWidgetItem, ScrollBar
|
from app.components import ContactQListWidgetItem, ScrollBar
|
||||||
from app.person import ContactPC
|
from app.person import Contact
|
||||||
from app.ui.Icon import Icon
|
from app.ui.Icon import Icon
|
||||||
from .contactInfo import ContactInfo
|
from .contactInfo import ContactInfo
|
||||||
from .contactUi import Ui_Form
|
from .contactUi import Ui_Form
|
||||||
@ -75,6 +75,10 @@ class ContactWindow(QWidget, Ui_Form):
|
|||||||
self.stackedWidget.setCurrentIndex(0)
|
self.stackedWidget.setCurrentIndex(0)
|
||||||
|
|
||||||
def show_contacts(self):
|
def show_contacts(self):
|
||||||
|
"""
|
||||||
|
创建一个子线程来获取联系人并通过信号传递联系人信息
|
||||||
|
@return:
|
||||||
|
"""
|
||||||
# return
|
# return
|
||||||
if self.ok_flag:
|
if self.ok_flag:
|
||||||
return
|
return
|
||||||
@ -94,13 +98,22 @@ class ContactWindow(QWidget, Ui_Form):
|
|||||||
self.ok_flag = True
|
self.ok_flag = True
|
||||||
|
|
||||||
def search_contact(self):
|
def search_contact(self):
|
||||||
|
"""
|
||||||
|
搜索联系人
|
||||||
|
@return:
|
||||||
|
"""
|
||||||
keyword = self.lineEdit.text()
|
keyword = self.lineEdit.text()
|
||||||
if keyword:
|
if keyword:
|
||||||
index = search.search_by_content(keyword, self.contacts)
|
index = search.search_by_content(keyword, self.contacts)
|
||||||
self.listWidget.setCurrentRow(index)
|
self.listWidget.setCurrentRow(index)
|
||||||
self.stackedWidget.setCurrentIndex(index)
|
self.stackedWidget.setCurrentIndex(index)
|
||||||
|
|
||||||
def show_contact(self, contact: ContactPC):
|
def show_contact(self, contact: Contact):
|
||||||
|
"""
|
||||||
|
显示联系人
|
||||||
|
@param contact:联系人对象
|
||||||
|
@return:
|
||||||
|
"""
|
||||||
self.contacts[0].append(contact.remark)
|
self.contacts[0].append(contact.remark)
|
||||||
self.contacts[1].append(contact.nickName)
|
self.contacts[1].append(contact.nickName)
|
||||||
contact_item = ContactQListWidgetItem(contact.remark, contact.smallHeadImgUrl, contact.smallHeadImgBLOG)
|
contact_item = ContactQListWidgetItem(contact.remark, contact.smallHeadImgUrl, contact.smallHeadImgBLOG)
|
||||||
@ -121,7 +134,7 @@ class ContactWindow(QWidget, Ui_Form):
|
|||||||
|
|
||||||
|
|
||||||
class ShowContactThread(QThread):
|
class ShowContactThread(QThread):
|
||||||
showSingal = pyqtSignal(ContactPC)
|
showSingal = pyqtSignal(Contact)
|
||||||
load_finish_signal = pyqtSignal(bool)
|
load_finish_signal = pyqtSignal(bool)
|
||||||
|
|
||||||
# heightSingal = pyqtSignal(int)
|
# heightSingal = pyqtSignal(int)
|
||||||
@ -140,7 +153,7 @@ class ShowContactThread(QThread):
|
|||||||
'NickName': contact_info_list[4],
|
'NickName': contact_info_list[4],
|
||||||
'smallHeadImgUrl': contact_info_list[7]
|
'smallHeadImgUrl': contact_info_list[7]
|
||||||
}
|
}
|
||||||
contact = ContactPC(contact_info)
|
contact = Contact(contact_info)
|
||||||
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
contact.smallHeadImgBLOG = misc_db.get_avatar_buffer(contact.wxid)
|
||||||
contact.set_avatar(contact.smallHeadImgBLOG)
|
contact.set_avatar(contact.smallHeadImgBLOG)
|
||||||
self.showSingal.emit(contact)
|
self.showSingal.emit(contact)
|
||||||
@ -149,7 +162,7 @@ class ShowContactThread(QThread):
|
|||||||
|
|
||||||
|
|
||||||
class ShowThread(QThread):
|
class ShowThread(QThread):
|
||||||
showSingal = pyqtSignal(ContactPC)
|
showSingal = pyqtSignal(Contact)
|
||||||
load_finish_signal = pyqtSignal(bool)
|
load_finish_signal = pyqtSignal(bool)
|
||||||
|
|
||||||
# heightSingal = pyqtSignal(int)
|
# heightSingal = pyqtSignal(int)
|
||||||
|
@ -24,7 +24,7 @@ from .contact import ContactWindow
|
|||||||
from .tool.tool_window import ToolWindow
|
from .tool.tool_window import ToolWindow
|
||||||
from ..DataBase.output_pc import Output
|
from ..DataBase.output_pc import Output
|
||||||
from ..components.QCursorGif import QCursorGif
|
from ..components.QCursorGif import QCursorGif
|
||||||
from ..person import MePC
|
from ..person import Me
|
||||||
|
|
||||||
# 美化样式表
|
# 美化样式表
|
||||||
Stylesheet = """
|
Stylesheet = """
|
||||||
@ -106,7 +106,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow,QCursorGif):
|
|||||||
dic = json.loads(f.read())
|
dic = json.loads(f.read())
|
||||||
wxid = dic.get('wxid')
|
wxid = dic.get('wxid')
|
||||||
if wxid:
|
if wxid:
|
||||||
me = MePC()
|
me = Me()
|
||||||
me.wxid = dic.get('wxid')
|
me.wxid = dic.get('wxid')
|
||||||
me.name = dic.get('name')
|
me.name = dic.get('name')
|
||||||
me.mobile = dic.get('mobile')
|
me.mobile = dic.get('mobile')
|
||||||
@ -191,7 +191,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow,QCursorGif):
|
|||||||
self.avatar.loadFromData(img_bytes, format='jfif')
|
self.avatar.loadFromData(img_bytes, format='jfif')
|
||||||
self.avatar.scaled(60, 60)
|
self.avatar.scaled(60, 60)
|
||||||
contact_info_list = micro_msg_db.get_contact_by_username(wxid)
|
contact_info_list = micro_msg_db.get_contact_by_username(wxid)
|
||||||
me = MePC()
|
me = Me()
|
||||||
me.set_avatar(img_bytes)
|
me.set_avatar(img_bytes)
|
||||||
me.smallHeadImgUrl = contact_info_list[7]
|
me.smallHeadImgUrl = contact_info_list[7]
|
||||||
self.myavatar.setScaledContents(True)
|
self.myavatar.setScaledContents(True)
|
||||||
|
@ -6,7 +6,7 @@ import requests
|
|||||||
|
|
||||||
from app.log import log, logger
|
from app.log import log, logger
|
||||||
from app.util.protocbuf.msg_pb2 import MessageBytesExtra
|
from app.util.protocbuf.msg_pb2 import MessageBytesExtra
|
||||||
from ..person import MePC
|
from ..person import Me
|
||||||
|
|
||||||
root_path = './data/files/'
|
root_path = './data/files/'
|
||||||
if not os.path.exists('./data'):
|
if not os.path.exists('./data'):
|
||||||
@ -33,7 +33,7 @@ def get_file(bytes_extra, thumb=False, output_path=root_path) -> str:
|
|||||||
if file_field.find('sec_msg_node') == -1:
|
if file_field.find('sec_msg_node') == -1:
|
||||||
file_original_path = file_field
|
file_original_path = file_field
|
||||||
file_name = os.path.basename(file_original_path)
|
file_name = os.path.basename(file_original_path)
|
||||||
if file_name != '' and file_name != MePC().wxid:
|
if file_name != '' and file_name != Me().wxid:
|
||||||
file_path = os.path.join(output_path, file_name)
|
file_path = os.path.join(output_path, file_name)
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
print('文件' + file_path + '已存在')
|
print('文件' + file_path + '已存在')
|
||||||
@ -43,13 +43,13 @@ def get_file(bytes_extra, thumb=False, output_path=root_path) -> str:
|
|||||||
real_path = file_original_path
|
real_path = file_original_path
|
||||||
else: # 如果没找到再判断一次是否是迁移了目录
|
else: # 如果没找到再判断一次是否是迁移了目录
|
||||||
if file_original_path.find(r"FileStorage") != -1:
|
if file_original_path.find(r"FileStorage") != -1:
|
||||||
real_path = MePC().wx_dir + file_original_path[
|
real_path = Me().wx_dir + file_original_path[
|
||||||
file_original_path.find("FileStorage") - 1:]
|
file_original_path.find("FileStorage") - 1:]
|
||||||
else:
|
else:
|
||||||
if file_original_path.find(MePC().wxid) != -1:
|
if file_original_path.find(Me().wxid) != -1:
|
||||||
real_path = MePC().wx_dir + file_original_path.replace(MePC().wxid, '')
|
real_path = Me().wx_dir + file_original_path.replace(Me().wxid, '')
|
||||||
else:
|
else:
|
||||||
real_path = MePC().wx_dir + file_original_path
|
real_path = Me().wx_dir + file_original_path
|
||||||
if real_path != "":
|
if real_path != "":
|
||||||
if os.path.exists(real_path):
|
if os.path.exists(real_path):
|
||||||
print('开始获取文件' + real_path)
|
print('开始获取文件' + real_path)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from app.person import MePC
|
from app.person import Me
|
||||||
|
|
||||||
# 图片字节头信息,
|
# 图片字节头信息,
|
||||||
# [0][1]为jpg头信息,
|
# [0][1]为jpg头信息,
|
||||||
@ -110,7 +110,7 @@ def find_datfile(dir_path, out_path):
|
|||||||
def get_image(path, base_path) -> str:
|
def get_image(path, base_path) -> str:
|
||||||
if path:
|
if path:
|
||||||
base_path = os.getcwd() + base_path
|
base_path = os.getcwd() + base_path
|
||||||
output_path = decode_dat(os.path.join(MePC().wx_dir, path), base_path)
|
output_path = decode_dat(os.path.join(Me().wx_dir, path), base_path)
|
||||||
relative_path = './image/' + os.path.basename(
|
relative_path = './image/' + os.path.basename(
|
||||||
output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
|
output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
|
||||||
return relative_path
|
return relative_path
|
||||||
@ -121,7 +121,7 @@ def get_image(path, base_path) -> str:
|
|||||||
def get_image_abs_path(path, base_path) -> str:
|
def get_image_abs_path(path, base_path) -> str:
|
||||||
if path:
|
if path:
|
||||||
base_path = os.getcwd() + base_path
|
base_path = os.getcwd() + base_path
|
||||||
output_path = decode_dat(os.path.join(MePC().wx_dir, path), base_path)
|
output_path = decode_dat(os.path.join(Me().wx_dir, path), base_path)
|
||||||
return output_path
|
return output_path
|
||||||
else:
|
else:
|
||||||
return ':/icons/icons/404.png'
|
return ':/icons/icons/404.png'
|
||||||
@ -130,7 +130,7 @@ def get_image_abs_path(path, base_path) -> str:
|
|||||||
def get_image_path(path, base_path) -> str:
|
def get_image_path(path, base_path) -> str:
|
||||||
if path:
|
if path:
|
||||||
base_path = os.getcwd() + base_path
|
base_path = os.getcwd() + base_path
|
||||||
output_path = decode_dat_path(os.path.join(MePC().wx_dir, path), base_path)
|
output_path = decode_dat_path(os.path.join(Me().wx_dir, path), base_path)
|
||||||
relative_path = './image/' + os.path.basename(
|
relative_path = './image/' + os.path.basename(
|
||||||
output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
|
output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
|
||||||
return relative_path
|
return relative_path
|
||||||
@ -139,8 +139,4 @@ def get_image_path(path, base_path) -> str:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
path = "E:\86390\Documents\WeChat Files\wxid_27hqbq7vx5hf22\FileStorage\CustomEmotion\\71\\"
|
pass
|
||||||
outpath = "D:\\test"
|
|
||||||
if not os.path.exists(outpath):
|
|
||||||
os.mkdir(outpath)
|
|
||||||
find_datfile(path, outpath)
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import winreg
|
import winreg
|
||||||
|
|
||||||
from app.person import MePC
|
from app.person import Me
|
||||||
from app.util import image
|
from app.util import image
|
||||||
|
|
||||||
os.makedirs('./data/image', exist_ok=True)
|
os.makedirs('./data/image', exist_ok=True)
|
||||||
@ -11,7 +11,7 @@ def get_abs_path(path, base_path="/data/image"):
|
|||||||
# return os.path.join(os.getcwd(), 'app/data/icons/404.png')
|
# return os.path.join(os.getcwd(), 'app/data/icons/404.png')
|
||||||
if path:
|
if path:
|
||||||
base_path = os.getcwd() + base_path
|
base_path = os.getcwd() + base_path
|
||||||
output_path = image.decode_dat(os.path.join(MePC().wx_dir, path), base_path)
|
output_path = image.decode_dat(os.path.join(Me().wx_dir, path), base_path)
|
||||||
return output_path if output_path else ':/icons/icons/404.png'
|
return output_path if output_path else ':/icons/icons/404.png'
|
||||||
else:
|
else:
|
||||||
return ':/icons/icons/404.png'
|
return ':/icons/icons/404.png'
|
||||||
@ -20,7 +20,7 @@ def get_abs_path(path, base_path="/data/image"):
|
|||||||
def get_relative_path(path, base_path, type_='image'):
|
def get_relative_path(path, base_path, type_='image'):
|
||||||
if path:
|
if path:
|
||||||
base_path = os.getcwd() + base_path
|
base_path = os.getcwd() + base_path
|
||||||
output_path = image.decode_dat(os.path.join(MePC().wx_dir, path), base_path)
|
output_path = image.decode_dat(os.path.join(Me().wx_dir, path), base_path)
|
||||||
relative_path = './image/' + os.path.basename(
|
relative_path = './image/' + os.path.basename(
|
||||||
output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
|
output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
|
||||||
return relative_path
|
return relative_path
|
||||||
|
@ -5,13 +5,13 @@ from flask import Flask, render_template, send_file
|
|||||||
|
|
||||||
from app.DataBase import msg_db
|
from app.DataBase import msg_db
|
||||||
from app.analysis import analysis
|
from app.analysis import analysis
|
||||||
from app.person import ContactPC, MePC
|
from app.person import Contact, Me
|
||||||
from app.util.emoji import get_most_emoji
|
from app.util.emoji import get_most_emoji
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
wxid = ''
|
wxid = ''
|
||||||
contact: ContactPC = None
|
contact: Contact = None
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
@ -29,9 +29,9 @@ def christmas():
|
|||||||
first_time = '2023-01-01 00:00:00'
|
first_time = '2023-01-01 00:00:00'
|
||||||
data = {
|
data = {
|
||||||
'ta_avatar_path': contact.avatar_path,
|
'ta_avatar_path': contact.avatar_path,
|
||||||
'my_avatar_path': MePC().avatar_path,
|
'my_avatar_path': Me().avatar_path,
|
||||||
'ta_nickname': contact.remark,
|
'ta_nickname': contact.remark,
|
||||||
'my_nickname': MePC().name,
|
'my_nickname': Me().name,
|
||||||
'first_time': first_time,
|
'first_time': first_time,
|
||||||
}
|
}
|
||||||
wordcloud_cloud_data = analysis.wordcloud_christmas(contact.wxid)
|
wordcloud_cloud_data = analysis.wordcloud_christmas(contact.wxid)
|
||||||
|
BIN
doc/images/qq.jpg
Normal file
BIN
doc/images/qq.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 503 KiB |
Loading…
Reference in New Issue
Block a user