mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 10:52:18 +08:00
修改联系人视图架构
This commit is contained in:
parent
fa2d0ec6c1
commit
751d9cb1a9
@ -4,17 +4,21 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="update readme">
|
||||
<change afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/Ui/contact/userinfo/userinfo.py" afterDir="false" />
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="用stackWidget重写contactUI">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/data.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/analysis/analysis.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/analysis/analysis.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/output.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/output.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/ICON.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/ICON.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/MyComponents/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/MyComponents/Button_Contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/MyComponents/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/MyComponents/__init__.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/__init__.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/chat/chat.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/chat/chat.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactUi.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactUi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactUi.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/emotion/emotion.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/emotion/emotion.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/person.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/person.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -492,7 +496,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699026207401</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="42" />
|
||||
<task id="LOCAL-00042" summary="用stackWidget重写contactUI">
|
||||
<created>1699104087256</created>
|
||||
<option name="number" value="00042" />
|
||||
<option name="presentableId" value="LOCAL-00042" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699104087256</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="43" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -551,7 +562,8 @@
|
||||
<MESSAGE value="替换chat里的contact" />
|
||||
<MESSAGE value="增加中文路径提示" />
|
||||
<MESSAGE value="update readme" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="update readme" />
|
||||
<MESSAGE value="用stackWidget重写contactUI" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="用stackWidget重写contactUI" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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]
|
@ -1 +0,0 @@
|
||||
from . import Contact
|
@ -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']
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -85,6 +85,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_3"/>
|
||||
<widget class="QWidget" name="page_4"/>
|
||||
</widget>
|
||||
|
@ -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)
|
||||
|
@ -1,201 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1244</width>
|
||||
<height>738</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_main">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>115</x>
|
||||
<y>9</y>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_info">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>100</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>500</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:rgb(240,240,240)</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>190</y>
|
||||
<width>91</width>
|
||||
<height>271</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,1,1,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_chat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>聊天</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_contact">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_myinfo">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我的</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_about">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>关于</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="myavatar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>avatar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="sign_up">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>40</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>退出</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_destroy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>0</y>
|
||||
<width>40</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>注销</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -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", "帮助"))
|
||||
|
@ -157,36 +157,8 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<widget class="QWidget" name="page_chat">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>150</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_contact">
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>250</y>
|
||||
<width>37</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_chat"/>
|
||||
<widget class="QWidget" name="page_contact"/>
|
||||
<widget class="QWidget" name="page_myinfo"/>
|
||||
<widget class="QWidget" name="page_2"/>
|
||||
</widget>
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user