diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7303246..8bb6ddf 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,17 +4,21 @@
-
-
-
-
+
-
-
+
+
+
+
+
+
-
+
+
-
+
+
+
@@ -492,7 +496,14 @@
1699026207401
-
+
+ 1699104087256
+
+
+
+ 1699104087256
+
+
@@ -551,7 +562,8 @@
-
+
+
diff --git a/app/DataBase/output.py b/app/DataBase/output.py
index a979c76..e060379 100644
--- a/app/DataBase/output.py
+++ b/app/DataBase/output.py
@@ -12,6 +12,7 @@ from docx.enum.table import WD_ALIGN_VERTICAL
from docx.enum.text import WD_COLOR_INDEX, WD_PARAGRAPH_ALIGNMENT
from docxcompose.composer import Composer
+from app.person import Me
from . import data
@@ -52,12 +53,12 @@ class Output(QThread):
DOCX = 1
HTML = 2
- def __init__(self, Me, ta_u, parent=None, type_=DOCX):
+ def __init__(self, Me: Me, ta_u, parent=None, type_=DOCX):
super().__init__(parent)
self.Me = Me
self.sec = 2 # 默认1000秒
self.ta_username = ta_u
- self.my_avatar = self.Me.my_avatar
+ self.my_avatar = self.Me.avatar_path
self.ta_avatar = data.get_avator(ta_u)
self.msg_id = 0
self.output_type = type_
@@ -150,13 +151,13 @@ class ChildThread(QThread):
DOCX = 1
HTML = 2
- def __init__(self, Me, ta_u, message, conRemark, num, parent=None, type_=DOCX):
+ def __init__(self, Me: Me, ta_u, message, conRemark, num, parent=None, type_=DOCX):
super().__init__(parent)
self.Me = Me
self.sec = 2 # 默认1000秒
self.ta_username = ta_u
self.num = num
- self.my_avatar = self.Me.my_avatar
+ self.my_avatar = self.Me.avatar_path
self.ta_avatar = data.get_avator(ta_u)
self.conRemark = conRemark
self.message = message
diff --git a/app/Ui/ICON.py b/app/Ui/ICON.py
index 7754394..524a1b5 100644
--- a/app/Ui/ICON.py
+++ b/app/Ui/ICON.py
@@ -2,5 +2,6 @@ from PyQt5.QtGui import QIcon
class Icon:
+ Default_avatar_path = './app/data/icons/default_avatar.svg'
MainWindow = QIcon('./app/data/icons/logo.svg')
- Default_avatar = QIcon('./app/data/icons/default_avatar.svg')
+ Default_avatar = QIcon(Default_avatar_path)
diff --git a/app/Ui/MyComponents/Contact.py b/app/Ui/MyComponents/Button_Contact.py
similarity index 97%
rename from app/Ui/MyComponents/Contact.py
rename to app/Ui/MyComponents/Button_Contact.py
index c76b5ef..c9a5f97 100644
--- a/app/Ui/MyComponents/Contact.py
+++ b/app/Ui/MyComponents/Button_Contact.py
@@ -4,7 +4,7 @@ from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import *
import app.DataBase.data as data
-from app.person import Contact
+from app import person
class ContactUi(QtWidgets.QPushButton):
@@ -15,7 +15,7 @@ class ContactUi(QtWidgets.QPushButton):
def __init__(self, Ui, id=None, rconversation=None):
super(ContactUi, self).__init__(Ui)
- self.contact: Contact = Contact(rconversation[1])
+ self.contact: person.Contact = person.Contact(rconversation[1])
self.init_ui(Ui)
self.msgCount = rconversation[0]
self.username = rconversation[1]
diff --git a/app/Ui/MyComponents/__init__.py b/app/Ui/MyComponents/__init__.py
index ee70cf6..e69de29 100644
--- a/app/Ui/MyComponents/__init__.py
+++ b/app/Ui/MyComponents/__init__.py
@@ -1 +0,0 @@
-from . import Contact
diff --git a/app/Ui/__init__.py b/app/Ui/__init__.py
index d68395c..ebbb627 100644
--- a/app/Ui/__init__.py
+++ b/app/Ui/__init__.py
@@ -7,7 +7,6 @@
@Version : Python3.10
@comment : ···
"""
-from . import mainview
# 文件__init__.py
# from login import login
from . import mainwindow
@@ -15,4 +14,4 @@ from .ICON import Icon
from .MyComponents import *
from .decrypt import decrypt
-__all__ = ["decrypt", 'mainview', 'Contact', 'Icon']
+__all__ = ["decrypt", 'mainview', 'contact', 'ICON']
diff --git a/app/Ui/chat/chat.py b/app/Ui/chat/chat.py
index 4a041a3..7b1f2f8 100644
--- a/app/Ui/chat/chat.py
+++ b/app/Ui/chat/chat.py
@@ -16,7 +16,7 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
-from app.Ui.MyComponents.Contact import ContactUi
+from app.Ui.MyComponents.Button_Contact import ContactUi
from app.person import Me
from .chatUi import *
from ...DataBase import data
diff --git a/app/Ui/contact/contact.py b/app/Ui/contact/contact.py
index 04865fa..6caa187 100644
--- a/app/Ui/contact/contact.py
+++ b/app/Ui/contact/contact.py
@@ -10,17 +10,13 @@
from typing import Dict
from PyQt5.QtCore import *
-from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
-import app.Ui.MyComponents.Contact as MyLabel
-from .analysis import analysis
+import app.Ui.MyComponents.Button_Contact as MyLabel
from .contactInfo import ContactInfo
from .contactUi import *
-from .emotion import emotion
-from .report import report
-from .userinfo import userinfoUi
-from ...DataBase import data, output
+from ... import person
+from ...DataBase import data
EMOTION = 1
ANALYSIS = 2
@@ -37,51 +33,19 @@ class ContactController(QWidget, Ui_Dialog):
# username = ''
- def __init__(self, Me, parent=None):
+ def __init__(self, Me: person.Me, parent=None):
super(ContactController, self).__init__(parent)
- self.emotionView = None
- self.analysisView = None
self.chatroomFlag = None
self.ta_avatar = None
self.setupUi(self)
- self.setWindowTitle('WeChat')
- self.setWindowIcon(QIcon('./app/data/icons/logo.svg'))
- # self.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
- self.initui()
self.Me = Me
- self.Thread = ChatMsg(self.Me.wxid, None)
self.contacts: Dict[str, MyLabel.ContactUi] = {}
self.contactInfo: Dict[str, ContactInfo] = {}
- self.last_btn = None
- self.chat_flag = True
self.show_flag = False
- self.ta_username = None
- self.last_pos = 0
- self.last_msg_time = 0 # 上次信息的时间
self.last_talkerId = None
self.now_talkerId = None
- self.last_analysis = None
- self.now_analysis = None
- self.view_emotion = {}
- self.view_analysis = {}
self.showContact()
- # self.now_btn = self.userinfo
- self.now_btn = None
- self.last_btn = None
-
- def initui(self):
- return
- self.lay0 = QVBoxLayout()
- self.stackedWidget.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
- self.frame = QtWidgets.QFrame()
- self.frame.setObjectName("frame")
- self.userinfo = userinfoUi.Ui_Frame() # 联系人信息界面
- self.userinfo.setupUi(self.frame)
- self.userinfo.progressBar.setVisible(False)
- self.stackedWidget.addWidget(self.frame)
- # self.lay0.addWidget(self.frame)
-
def showContact(self):
"""
显示联系人
@@ -109,7 +73,7 @@ class ContactController(QWidget, Ui_Dialog):
pushButton_2.clicked.connect(pushButton_2.show_msg)
pushButton_2.usernameSingal.connect(self.Contact)
self.contacts[username] = pushButton_2
- self.contactInfo[username] = ContactInfo(username)
+ self.contactInfo[username] = ContactInfo(username, self.Me)
self.stackedWidget.addWidget(self.contactInfo[username])
def Contact(self, talkerId):
@@ -119,8 +83,6 @@ class ContactController(QWidget, Ui_Dialog):
:return:
"""
self.now_talkerId = talkerId
- # self.frame.setVisible(True)
- # self.setViewVisible(self.now_talkerId)
# 把当前按钮设置为灰色
if self.last_talkerId and self.last_talkerId != talkerId:
print('对方账号:', self.last_talkerId)
@@ -134,174 +96,8 @@ class ContactController(QWidget, Ui_Dialog):
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
)
self.stackedWidget.setCurrentWidget(self.contactInfo[talkerId])
- # # 设置联系人的基本信息
- # conRemark = self.contacts[talkerId].contact.conRemark
- # nickname = self.contacts[talkerId].contact.nickname
- # alias = self.contacts[talkerId].contact.alias
- #
- # self.label_remark.setText(conRemark)
- # self.ta_username = talkerId
- # if '@chatroom' in talkerId:
- # self.chatroomFlag = True
- # else:
- # self.chatroomFlag = False
- # self.userinfo.l_remark.setText(conRemark)
- # pixmap = self.contacts[talkerId].contact.avatar
- # self.userinfo.l_avatar.setPixmap(pixmap)
- # self.userinfo.l_nickname.setText(f'昵称:{nickname}')
- # self.userinfo.l_username.setText(f'微信号:{alias}')
- # self.userinfo.lineEdit.setText(conRemark)
- def output(self):
- """
- 导出聊天记录
- :return:
- """
- self.setViewVisible(self.now_talkerId)
-
- if self.sender() == self.toDocxAct:
- self.outputThread = output.Output(self.Me, self.now_talkerId)
- self.outputThread.progressSignal.connect(self.output_progress)
- self.outputThread.rangeSignal.connect(self.set_progressBar_range)
- self.outputThread.okSignal.connect(self.hide_progress_bar)
- self.outputThread.start()
- elif self.sender() == self.toCSVAct:
- print('开始导出csv')
- self.outputThread = output.Output(self.Me, self.now_talkerId, type_=output.Output.CSV)
- self.outputThread.progressSignal.connect(self.output_progress)
- self.outputThread.rangeSignal.connect(self.set_progressBar_range)
- self.outputThread.okSignal.connect(self.hide_progress_bar)
- self.outputThread.start()
- print('导出csv')
- elif self.sender() == self.toHtmlAct:
- print('功能暂未实现')
- QMessageBox.warning(self,
- "别急别急",
- "马上就实现该功能"
- )
-
- def hide_progress_bar(self, int):
- reply = QMessageBox(self)
- reply.setIcon(QMessageBox.Information)
- reply.setWindowTitle('OK')
- reply.setText(f"导出聊天记录成功\n在.\\data\\目录下")
- reply.addButton("确认", QMessageBox.AcceptRole)
- reply.addButton("取消", QMessageBox.RejectRole)
- api = reply.exec_()
- self.userinfo.progressBar.setVisible(False)
-
- def set_progressBar_range(self, value):
- self.userinfo.progressBar.setVisible(True)
- self.userinfo.progressBar.setRange(0, value)
-
- def output_progress(self, value):
- self.userinfo.progressBar.setProperty('value', value)
-
- def analysis(self):
- """
- 聊天分析
- :return:
- """
- self.frame.setVisible(False) # 将userinfo界面设置为不可见
- # 判断talkerId是否已经分析过了
- # 是:则清空其他界面,直接显示该界面
- # 否:清空其他界面,创建用户界面并显示
- if 'room' in self.now_talkerId:
- QMessageBox.warning(
- self, '警告',
- '暂不支持群组'
- )
- return
- if self.now_talkerId in self.view_analysis:
- self.setViewVisible(self.now_talkerId, mod=ANALYSIS)
- return True
+ if '@chatroom' in talkerId:
+ self.chatroomFlag = True
else:
- self.setViewVisible(self.now_talkerId)
- self.view_analysis[self.now_talkerId] = analysis.AnalysisController(self.now_talkerId)
- # self.lay0.addWidget(self.view_analysis[self.now_talkerId])
- self.last_analysis = self.now_talkerId
- self.stackedWidget.addWidget(self.view_analysis[self.now_talkerId])
- self.setViewVisible(self.now_talkerId, mod=ANALYSIS)
-
- def emotionale_Analysis(self):
- print('情感分析', data.get_conRemark(self.now_talkerId))
- self.frame.setVisible(False) # 将userinfo界面设置为不可见
- # 判断talkerId是否已经分析过了
- # 是:则清空其他界面,直接显示该界面
- # 否:清空其他界面,创建用户界面并显示
- if self.now_talkerId in self.view_emotion:
- self.setViewVisible(self.now_talkerId, mod=EMOTION)
- return True
- else:
- self.setViewVisible(self.now_talkerId)
- self.view_emotion[self.now_talkerId] = emotion.EmotionController(self.ta_username)
- # self.lay0.addWidget(self.view_emotion[self.now_talkerId])
- self.last_analysis = self.now_talkerId
- self.stackedWidget.addWidget(self.view_emotion[self.now_talkerId])
- self.setViewVisible(self.now_talkerId, mod=EMOTION)
- pass
-
- def annual_report(self):
- QMessageBox.warning(
- self,
- "提示",
- "敬请期待"
- )
- return
- self.report = report.ReportController(123)
- self.report.show()
-
- def showUserinfo(self):
- pass
- # self.analysisView = analysis.AnalysisController(self.now_talkerId)
- # # self.lay0 = QHBoxLayout()
- # # self.widget.setLayout(self.lay0)
- # self.lay0.addWidget(self.analysisView)
-
- def setViewVisible(self, wxid: str, mod=None):
- """
- 设置当前可见窗口
- """
- match mod:
- case None:
- self.stackedWidget.setCurrentWidget(self.frame)
- case 1:
- if not self.last_analysis:
- return False
- self.stackedWidget.setCurrentWidget(self.view_emotion[self.now_talkerId])
- case 2:
- if not self.last_analysis:
- return False
- self.stackedWidget.setCurrentWidget(self.view_analysis[self.now_talkerId])
-
- def back(self):
- """
- 将userinfo界面设置为可见,其他界面设置为不可见
- """
- self.frame.setVisible(True)
- self.setViewVisible(self.now_talkerId)
-
-
-class ChatMsg(QThread):
- """
- 发送信息线程
- """
- isSend_signal = pyqtSignal(tuple)
- okSignal = pyqtSignal(int)
-
- def __init__(self, my_u, ta_u, parent=None):
- super().__init__(parent)
- self.sec = 2 # 默认1000秒
- self.my_u = my_u
- self.ta_u = ta_u
- self.my_avatar = data.get_avator(my_u)
- self.msg_id = 0
-
- def run(self):
- self.ta_avatar = data.get_avator(self.ta_u)
- messages = data.get_message(self.ta_u, self.msg_id)
- # messages.reverse()
- for message in messages:
- self.isSend_signal.emit(message)
- self.msg_id += 1
- self.okSignal.emit(1)
+ self.chatroomFlag = False
diff --git a/app/Ui/contact/contactInfo.py b/app/Ui/contact/contactInfo.py
index 6e413da..76de500 100644
--- a/app/Ui/contact/contactInfo.py
+++ b/app/Ui/contact/contactInfo.py
@@ -2,11 +2,13 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
+from app.DataBase import output
from app.person import Contact
from .analysis import analysis
from .contactInfoUi import Ui_Form
from .emotion import emotion
from .userinfo import userinfo
+from ... import person
class ContactInfo(QWidget, Ui_Form):
@@ -14,7 +16,7 @@ class ContactInfo(QWidget, Ui_Form):
urlSignal = pyqtSignal(QUrl)
# username = ''
- def __init__(self, wxid, parent=None):
+ def __init__(self, wxid, me: person.Me, parent=None):
super(ContactInfo, self).__init__(parent)
self.setupUi(self)
self.contact = Contact(wxid)
@@ -22,6 +24,10 @@ class ContactInfo(QWidget, Ui_Form):
self.view_analysis = analysis.AnalysisController(wxid)
self.view_emotion = emotion.EmotionController(wxid)
self.btn_analysis.clicked.connect(self.analysis)
+ self.btn_emotion.clicked.connect(self.emotionale_Analysis)
+ self.btn_report.clicked.connect(self.annual_report)
+ self.btn_back.clicked.connect(self.back)
+ self.Me = me
self.init_ui()
def init_ui(self):
@@ -46,9 +52,6 @@ class ContactInfo(QWidget, Ui_Form):
def analysis(self):
self.stackedWidget.setCurrentWidget(self.view_analysis)
- # 判断talkerId是否已经分析过了
- # 是:则清空其他界面,直接显示该界面
- # 否:清空其他界面,创建用户界面并显示
if 'room' in self.contact.wxid:
QMessageBox.warning(
self, '警告',
@@ -57,5 +60,69 @@ class ContactInfo(QWidget, Ui_Form):
return
self.view_analysis.start()
- def output(self):
+ def annual_report(self):
+ QMessageBox.warning(
+ self,
+ "提示",
+ "敬请期待"
+ )
return
+ self.report = report.ReportController(123)
+ self.report.show()
+
+ def emotionale_Analysis(self):
+ self.stackedWidget.setCurrentWidget(self.view_emotion)
+ if 'room' in self.contact.wxid:
+ QMessageBox.warning(
+ self, '警告',
+ '暂不支持群组'
+ )
+ return
+ self.view_emotion.start()
+
+ def back(self):
+ """
+ 将userinfo界面设置为可见,其他界面设置为不可见
+ """
+ self.stackedWidget.setCurrentWidget(self.view_userinfo)
+
+ def output(self):
+ """
+ 导出聊天记录
+ :return:
+ """
+ self.stackedWidget.setCurrentWidget(self.view_userinfo)
+ if self.sender() == self.toDocxAct:
+ self.outputThread = output.Output(self.Me, self.contact.wxid)
+ elif self.sender() == self.toCSVAct:
+ print('开始导出csv')
+ self.outputThread = output.Output(self.Me, self.contact.wxid, type_=output.Output.CSV)
+ print('导出csv')
+ elif self.sender() == self.toHtmlAct:
+ print('功能暂未实现')
+ QMessageBox.warning(self,
+ "别急别急",
+ "马上就实现该功能"
+ )
+ return
+ self.outputThread.progressSignal.connect(self.output_progress)
+ self.outputThread.rangeSignal.connect(self.set_progressBar_range)
+ self.outputThread.okSignal.connect(self.hide_progress_bar)
+ self.outputThread.start()
+
+ def hide_progress_bar(self, int):
+ reply = QMessageBox(self)
+ reply.setIcon(QMessageBox.Information)
+ reply.setWindowTitle('OK')
+ reply.setText(f"导出聊天记录成功\n在.\\data\\目录下")
+ 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)
diff --git a/app/Ui/contact/contactInfoUi.ui b/app/Ui/contact/contactInfoUi.ui
index d143fac..ec5413d 100644
--- a/app/Ui/contact/contactInfoUi.ui
+++ b/app/Ui/contact/contactInfoUi.ui
@@ -85,6 +85,9 @@
-
+
+ 1
+
diff --git a/app/Ui/contact/userinfo/userinfo.py b/app/Ui/contact/userinfo/userinfo.py
index 1fc78c4..10c6237 100644
--- a/app/Ui/contact/userinfo/userinfo.py
+++ b/app/Ui/contact/userinfo/userinfo.py
@@ -13,3 +13,4 @@ class UserinfoController(QWidget, Ui_Frame):
self.l_nickname.setText(f'昵称:{contact.nickname}')
self.l_username.setText(f'微信号:{contact.alias}')
self.lineEdit.setText(contact.conRemark)
+ self.progressBar.setVisible(False)
diff --git a/app/Ui/mainviewUi.ui b/app/Ui/mainviewUi.ui
deleted file mode 100644
index 4f39e12..0000000
--- a/app/Ui/mainviewUi.ui
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
- Dialog
-
-
-
- 0
- 0
- 1244
- 738
-
-
-
- ArrowCursor
-
-
- Dialog
-
-
- false
-
-
-
-
- 115
- 9
- 1120
- 720
-
-
-
-
- 1120
- 720
-
-
-
- Qt::LeftToRight
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
-
- 9
- 9
- 100
- 720
-
-
-
-
- 100
- 500
-
-
-
- background-color:rgb(240,240,240)
-
-
- QFrame::StyledPanel
-
-
- QFrame::Sunken
-
-
-
-
- 0
- 190
- 91
- 271
-
-
-
-
- 0
-
-
-
-
-
-
- 0
- 60
-
-
-
- QPushButton {background-color: rgb(240,240,240);}
- QPushButton:hover{background-color: rgb(209,209,209);}
-
-
-
- 聊天
-
-
-
- -
-
-
-
- 0
- 60
-
-
-
- QPushButton {background-color: rgb(240,240,240);}
- QPushButton:hover{background-color: rgb(209,209,209);}
-
-
-
- 联系人
-
-
-
- -
-
-
-
- 60
- 60
-
-
-
- QPushButton {background-color: rgb(240,240,240);}
- QPushButton:hover{background-color: rgb(209,209,209);}
-
-
-
- 我的
-
-
-
- -
-
-
-
- 60
- 60
-
-
-
- QPushButton {background-color: rgb(240,240,240);}
- QPushButton:hover{background-color: rgb(209,209,209);}
-
-
-
- 关于
-
-
-
-
-
-
-
-
- 10
- 40
- 80
- 80
-
-
-
- avatar
-
-
-
-
-
- 0
- 0
- 40
- 28
-
-
-
- 退出
-
-
-
-
-
- 50
- 0
- 40
- 28
-
-
-
- 注销
-
-
-
-
-
-
-
diff --git a/app/Ui/mainwindow.py b/app/Ui/mainwindow.py
index 002f91d..81722a4 100644
--- a/app/Ui/mainwindow.py
+++ b/app/Ui/mainwindow.py
@@ -75,15 +75,9 @@ class Ui_MainWindow(object):
self.stackedWidget.setObjectName("stackedWidget")
self.page_chat = QtWidgets.QWidget()
self.page_chat.setObjectName("page_chat")
- self.pushButton = QtWidgets.QPushButton(self.page_chat)
- self.pushButton.setGeometry(QtCore.QRect(250, 150, 75, 23))
- self.pushButton.setObjectName("pushButton")
self.stackedWidget.addWidget(self.page_chat)
self.page_contact = QtWidgets.QWidget()
self.page_contact.setObjectName("page_contact")
- self.toolButton = QtWidgets.QToolButton(self.page_contact)
- self.toolButton.setGeometry(QtCore.QRect(340, 250, 37, 18))
- self.toolButton.setObjectName("toolButton")
self.stackedWidget.addWidget(self.page_contact)
self.page_myinfo = QtWidgets.QWidget()
self.page_myinfo.setObjectName("page_myinfo")
@@ -132,8 +126,6 @@ class Ui_MainWindow(object):
self.btn_myinfo.setText(_translate("MainWindow", "我的"))
self.btn_about.setText(_translate("MainWindow", "关于"))
self.myavatar.setText(_translate("MainWindow", "avatar"))
- self.pushButton.setText(_translate("MainWindow", "PushButton"))
- self.toolButton.setText(_translate("MainWindow", "..."))
self.menu_F.setTitle(_translate("MainWindow", "文件(F)"))
self.menu.setTitle(_translate("MainWindow", "编辑"))
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
diff --git a/app/Ui/mainwindow.ui b/app/Ui/mainwindow.ui
index c0006f5..c093b38 100644
--- a/app/Ui/mainwindow.ui
+++ b/app/Ui/mainwindow.ui
@@ -157,36 +157,8 @@
-
-
-
-
-
- 250
- 150
- 75
- 23
-
-
-
- PushButton
-
-
-
-
-
-
-
- 340
- 250
- 37
- 18
-
-
-
- ...
-
-
-
+
+
diff --git a/app/person.py b/app/person.py
index eef4924..caa951e 100644
--- a/app/person.py
+++ b/app/person.py
@@ -1,6 +1,9 @@
+import os.path
+
from PyQt5.QtGui import QPixmap
import app.DataBase.data as data
+from app.Ui.ICON import Icon
class Person:
@@ -9,7 +12,11 @@ class Person:
self.conRemark = data.get_conRemark(wxid)
self.nickname, self.alias = data.get_nickname(wxid)
self.avatar_path = data.get_avator(wxid)
- self.avatar = QPixmap(self.avatar_path).scaled(60, 60)
+ if os.path.exists(self.avatar_path):
+ self.avatar = QPixmap(self.avatar_path).scaled(60, 60)
+ else:
+ self.avatar_path = Icon.Default_avatar_path
+ self.avatar = QPixmap(self.avatar_path).scaled(60, 60)
class Me(Person):