mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 10:52:18 +08:00
更改头像显示
This commit is contained in:
parent
a24ce6a14d
commit
19e485cae0
@ -4,13 +4,13 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="数据库加锁避免多线程访问报错">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修复聊天气泡不能更改大小的bug">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/micro_msg.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/micro_msg.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/components/bubble_message.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/components/bubble_message.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/person.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/person.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/chat/chatInfoUi.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/chat/chatInfoUi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/mainview.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/tool/pc_decrypt/pc_decrypt.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/tool/pc_decrypt/pc_decrypt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/tool/tool_window.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/tool/tool_window.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -276,13 +276,6 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1672848140146</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00020" summary="readme">
|
||||
<created>1684598177829</created>
|
||||
<option name="number" value="00020" />
|
||||
<option name="presentableId" value="LOCAL-00020" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1684598177830</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00021" summary="readme">
|
||||
<created>1684598440645</created>
|
||||
<option name="number" value="00021" />
|
||||
@ -619,7 +612,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700228064961</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="69" />
|
||||
<task id="LOCAL-00069" summary="修复聊天气泡不能更改大小的bug">
|
||||
<created>1700232296923</created>
|
||||
<option name="number" value="00069" />
|
||||
<option name="presentableId" value="LOCAL-00069" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700232296923</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="70" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -655,7 +655,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="增加中文路径提示" />
|
||||
<MESSAGE value="用stackWidget重写contactUI" />
|
||||
<MESSAGE value="修改联系人视图架构" />
|
||||
<MESSAGE value="加快打开速度" />
|
||||
@ -680,7 +679,8 @@
|
||||
<MESSAGE value="导出所有数据库的聊天记录" />
|
||||
<MESSAGE value="update readme" />
|
||||
<MESSAGE value="数据库加锁避免多线程访问报错" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="数据库加锁避免多线程访问报错" />
|
||||
<MESSAGE value="修复聊天气泡不能更改大小的bug" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修复聊天气泡不能更改大小的bug" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
@ -704,17 +704,17 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/app/person.py</url>
|
||||
<line>116</line>
|
||||
<line>101</line>
|
||||
<option name="timeStamp" value="10" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/app/person.py</url>
|
||||
<line>114</line>
|
||||
<line>99</line>
|
||||
<option name="timeStamp" value="11" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/app/person.py</url>
|
||||
<line>115</line>
|
||||
<line>100</line>
|
||||
<option name="timeStamp" value="12" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
|
@ -1,2 +1,2 @@
|
||||
version = '0.2.0'
|
||||
version = '0.2.1'
|
||||
contact = '474379264'
|
||||
|
@ -54,24 +54,7 @@ def singleton(cls):
|
||||
@singleton
|
||||
class MePC:
|
||||
def __init__(self):
|
||||
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]'
|
||||
}
|
||||
self.wxid = contact_info.get('UserName')
|
||||
self.remark = contact_info.get('Remark')
|
||||
# Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl
|
||||
self.alias = contact_info.get('Alias')
|
||||
self.nickName = contact_info.get('NickName')
|
||||
if not self.remark:
|
||||
self.remark = self.nickName
|
||||
self.smallHeadImgUrl = contact_info.get('smallHeadImgUrl')
|
||||
self.smallHeadImgBLOG = b''
|
||||
self.avatar = QPixmap()
|
||||
self.avatar = QPixmap(Icon.Default_avatar_path)
|
||||
|
||||
def set_avatar(self, img_bytes):
|
||||
if not img_bytes:
|
||||
@ -81,7 +64,7 @@ class MePC:
|
||||
self.avatar.loadFromData(img_bytes, format='PNG')
|
||||
else:
|
||||
self.avatar.loadFromData(img_bytes, format='jfif')
|
||||
self.avatar.scaled(60, 60, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
|
||||
self.avatar = QPixmap()
|
||||
|
||||
|
||||
class ContactPC:
|
||||
|
@ -3,6 +3,7 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSpacerItem, QSizePolicy, QLab
|
||||
|
||||
from app.DataBase import msg
|
||||
from app.components.bubble_message import BubbleMessage, ScrollBar, ScrollArea, ScrollAreaContent
|
||||
from app.person import MePC
|
||||
|
||||
|
||||
class ChatInfo(QWidget):
|
||||
@ -52,12 +53,13 @@ class ChatInfo(QWidget):
|
||||
try:
|
||||
type_ = message[2]
|
||||
# print(type_, type(type_))
|
||||
is_send = message[4]
|
||||
avatar = MePC().avatar if is_send else self.contact.avatar
|
||||
if type_ == 1:
|
||||
str_content = message[7]
|
||||
is_send = message[4]
|
||||
bubble_message = BubbleMessage(
|
||||
str_content,
|
||||
self.contact.avatar,
|
||||
avatar,
|
||||
type_,
|
||||
is_send
|
||||
)
|
||||
|
@ -10,15 +10,17 @@
|
||||
from random import randint
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from app import config
|
||||
from app.DataBase import msg
|
||||
from app.DataBase import msg, misc
|
||||
from app.Ui.Icon import Icon
|
||||
from . import mainwindow
|
||||
from .chat import ChatWindow
|
||||
from .contact import ContactWindow
|
||||
from .tool import ToolWindow
|
||||
from ..person import MePC
|
||||
|
||||
# 美化样式表
|
||||
Stylesheet = """
|
||||
@ -81,6 +83,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
tool_item = QListWidgetItem(Icon.MyInfo_Icon, '工具', self.listWidget)
|
||||
|
||||
tool_window = ToolWindow()
|
||||
tool_window.get_info_signal.connect(self.set_my_info)
|
||||
self.chat_window = ChatWindow()
|
||||
self.stackedWidget.addWidget(self.chat_window)
|
||||
self.contact_window = ContactWindow()
|
||||
@ -102,6 +105,19 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.contact_window.show_contacts()
|
||||
self.stackedWidget.setCurrentIndex(row)
|
||||
|
||||
def set_my_info(self, wxid):
|
||||
self.avatar = QPixmap()
|
||||
img_bytes = misc.get_avatar_buffer(wxid)
|
||||
if img_bytes[:4] == b'\x89PNG':
|
||||
self.avatar.loadFromData(img_bytes, format='PNG')
|
||||
else:
|
||||
self.avatar.loadFromData(img_bytes, format='jfif')
|
||||
self.avatar.scaled(60, 60)
|
||||
me = MePC()
|
||||
me.set_avatar(img_bytes)
|
||||
self.myavatar.setScaledContents(True)
|
||||
self.myavatar.setPixmap(self.avatar)
|
||||
|
||||
def about(self):
|
||||
"""
|
||||
关于
|
||||
|
@ -12,7 +12,7 @@ from . import decryptUi
|
||||
|
||||
class DecryptControl(QWidget, decryptUi.Ui_Dialog):
|
||||
DecryptSignal = pyqtSignal(str)
|
||||
registerSignal = pyqtSignal(str)
|
||||
get_wxidSignal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(DecryptControl, self).__init__(parent)
|
||||
@ -47,6 +47,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
|
||||
self.label_version.setText(self.info['version'])
|
||||
self.lineEdit.setFocus()
|
||||
self.checkBox.setChecked(True)
|
||||
self.get_wxidSignal.emit(self.info['wxid'])
|
||||
if self.wx_dir and os.path.exists(os.path.join(self.wx_dir, self.info['wxid'])):
|
||||
self.label_ready.setText('已就绪')
|
||||
except Exception as e:
|
||||
|
@ -1,6 +1,6 @@
|
||||
from random import randint
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QLabel
|
||||
|
||||
from .pc_decrypt import DecryptControl
|
||||
@ -45,6 +45,8 @@ HistoryPanel::item:hover {
|
||||
|
||||
|
||||
class ToolWindow(QWidget, Ui_Dialog):
|
||||
get_info_signal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
@ -58,8 +60,9 @@ class ToolWindow(QWidget, Ui_Dialog):
|
||||
contact_item = QListWidgetItem(Icon.Contact_Icon, 'None', self.listWidget)
|
||||
myinfo_item = QListWidgetItem(Icon.MyInfo_Icon, 'None', self.listWidget)
|
||||
tool_item = QListWidgetItem(Icon.MyInfo_Icon, 'None', self.listWidget)
|
||||
tool_window = DecryptControl()
|
||||
self.stackedWidget.addWidget(tool_window)
|
||||
decrypt_window = DecryptControl()
|
||||
decrypt_window.get_wxidSignal.connect(self.get_info_signal)
|
||||
self.stackedWidget.addWidget(decrypt_window)
|
||||
label = QLabel('我是页面', self)
|
||||
label.setAlignment(Qt.AlignCenter)
|
||||
# 设置label的背景颜色(这里随机)
|
||||
|
Loading…
Reference in New Issue
Block a user