用stackWidget重写contactUI

This commit is contained in:
shuaikangzhou 2023-11-04 21:21:26 +08:00
parent 51a4d9af00
commit fa2d0ec6c1
11 changed files with 347 additions and 189 deletions

View File

@ -4,11 +4,17 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="增加中文路径提示">
<change afterPath="$PROJECT_DIR$/doc/解密教程/使用说明.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<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" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" 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/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/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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -71,7 +77,7 @@
<recent name="D:\Project\PythonProject\WeChatMsg\app\Ui" />
</key>
</component>
<component name="RunManager" selected="Python.test">
<component name="RunManager" selected="Python.main">
<configuration name="decrypt" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="WeChatMsg" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -179,8 +185,8 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.test" />
<item itemvalue="Python.main" />
<item itemvalue="Python.test" />
<item itemvalue="Python.decrypt" />
<item itemvalue="Python.output" />
<item itemvalue="Python.report" />
@ -479,7 +485,14 @@
<option name="project" value="LOCAL" />
<updated>1699025065814</updated>
</task>
<option name="localTasksCounter" value="41" />
<task id="LOCAL-00041" summary="update readme">
<created>1699026207401</created>
<option name="number" value="00041" />
<option name="presentableId" value="LOCAL-00041" />
<option name="project" value="LOCAL" />
<updated>1699026207401</updated>
</task>
<option name="localTasksCounter" value="42" />
<servers />
</component>
<component name="UnknownFeatures">
@ -532,13 +545,13 @@
<MESSAGE value="支持导出csv格式聊天记录" />
<MESSAGE value="增加几个图标" />
<MESSAGE value="修改部分UI" />
<MESSAGE value="update readme" />
<MESSAGE value="重构一些class删除一些不必要的文件" />
<MESSAGE value="用stackedWidget实现导航栏" />
<MESSAGE value="修复部分bug" />
<MESSAGE value="替换chat里的contact" />
<MESSAGE value="增加中文路径提示" />
<option name="LAST_COMMIT_MESSAGE" value="增加中文路径提示" />
<MESSAGE value="update readme" />
<option name="LAST_COMMIT_MESSAGE" value="update readme" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
</component>

View File

@ -10,6 +10,7 @@
import hashlib
import os
import sqlite3
import threading
import time
import requests
@ -18,7 +19,7 @@ from app import person
DB = None
cursor = None
lock = threading.Lock()
Type = {
1: '文本内容',
2: '位置信息',
@ -187,14 +188,29 @@ def timestamp2str(timestamp):
def get_conRemark(username):
sql = 'select conRemark,nickname from rcontact where username=?'
cursor.execute(sql, [username])
result = cursor.fetchone()
if result:
if result[0]:
return result[0]
else:
return result[1]
try:
lock.acquire(True)
sql = 'select conRemark,nickname from rcontact where username=?'
cursor.execute(sql, [username])
result = cursor.fetchone()
if result:
if result[0]:
return result[0]
else:
return result[1]
except:
time.sleep(0.1)
sql = 'select conRemark,nickname from rcontact where username=?'
cursor.execute(sql, [username])
result = cursor.fetchone()
if result:
if result[0]:
return result[0]
else:
return result[1]
finally:
lock.release()
return False

View File

@ -23,9 +23,7 @@ class AnalysisController(QWidget):
self.center()
self.setAttribute(Qt.WA_AttributeCount)
self.label_01()
self.Thread = LoadData(username)
self.Thread.okSignal.connect(self.initUI)
self.Thread.start()
self.isStart = False
def center(self): # 定义一个函数使得窗口居中显示
# 获取屏幕坐标系
@ -128,6 +126,13 @@ class AnalysisController(QWidget):
# palette.setColor(self.backgroundRole(), QColor(192, 253, 123)) # 设置背景颜色
self.setPalette(palette)
def start(self):
if not self.isStart:
self.Thread = LoadData(self.ta_username)
self.Thread.okSignal.connect(self.initUI)
self.Thread.start()
self.isStart = True
class LoadData(QThread):
"""

View File

@ -15,6 +15,7 @@ from PyQt5.QtWidgets import *
import app.Ui.MyComponents.Contact as MyLabel
from .analysis import analysis
from .contactInfo import ContactInfo
from .contactUi import *
from .emotion import emotion
from .report import report
@ -50,6 +51,7 @@ class ContactController(QWidget, Ui_Dialog):
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
@ -64,21 +66,13 @@ class ContactController(QWidget, Ui_Dialog):
self.view_analysis = {}
self.showContact()
self.now_btn = self.userinfo
# self.now_btn = self.userinfo
self.now_btn = None
self.last_btn = None
def initui(self):
# 槽函数连接
self.btn_back.clicked.connect(self.back)
# self.btn_output.clicked.connect(self.output)
self.btn_analysis.clicked.connect(self.analysis)
self.btn_emotion.clicked.connect(self.emotionale_Analysis)
self.btn_report.clicked.connect(self.annual_report)
return
self.lay0 = QVBoxLayout()
# self.widget.setLayout(self.lay0)
# self.widget.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
# self.stackedWidget.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
self.stackedWidget.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
self.frame = QtWidgets.QFrame()
self.frame.setObjectName("frame")
@ -87,19 +81,6 @@ class ContactController(QWidget, Ui_Dialog):
self.userinfo.progressBar.setVisible(False)
self.stackedWidget.addWidget(self.frame)
# self.lay0.addWidget(self.frame)
menu = QMenu(self)
self.toDocxAct = QAction(QIcon('app/data/icons/word.svg'), '导出Docx', self)
self.toCSVAct = QAction(QIcon('app/data/icons/csv.svg'), '导出CSV', self)
self.toHtmlAct = QAction(QIcon('app/data/icons/html.svg'), '导出HTML', self)
self.toolButton_output.setPopupMode(QToolButton.MenuButtonPopup)
menu.addAction(self.toDocxAct)
menu.addAction(self.toCSVAct)
menu.addAction(self.toHtmlAct)
self.toolButton_output.setMenu(menu)
# self.toolButton_output.addSeparator()
self.toHtmlAct.triggered.connect(self.output)
self.toDocxAct.triggered.connect(self.output)
self.toCSVAct.triggered.connect(self.output)
def showContact(self):
"""
@ -128,6 +109,8 @@ 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.stackedWidget.addWidget(self.contactInfo[username])
def Contact(self, talkerId):
"""
@ -137,7 +120,7 @@ class ContactController(QWidget, Ui_Dialog):
"""
self.now_talkerId = talkerId
# self.frame.setVisible(True)
self.setViewVisible(self.now_talkerId)
# self.setViewVisible(self.now_talkerId)
# 把当前按钮设置为灰色
if self.last_talkerId and self.last_talkerId != talkerId:
print('对方账号:', self.last_talkerId)
@ -150,23 +133,24 @@ class ContactController(QWidget, Ui_Dialog):
"QPushButton {background-color: rgb(198,198,198);}"
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
)
# 设置联系人的基本信息
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)
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):
"""

View File

@ -0,0 +1,61 @@
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from app.person import Contact
from .analysis import analysis
from .contactInfoUi import Ui_Form
from .emotion import emotion
from .userinfo import userinfo
class ContactInfo(QWidget, Ui_Form):
exitSignal = pyqtSignal()
urlSignal = pyqtSignal(QUrl)
# username = ''
def __init__(self, wxid, parent=None):
super(ContactInfo, self).__init__(parent)
self.setupUi(self)
self.contact = Contact(wxid)
self.view_userinfo = userinfo.UserinfoController(self.contact)
self.view_analysis = analysis.AnalysisController(wxid)
self.view_emotion = emotion.EmotionController(wxid)
self.btn_analysis.clicked.connect(self.analysis)
self.init_ui()
def init_ui(self):
self.label_remark.setText(self.contact.conRemark)
self.stackedWidget.addWidget(self.view_userinfo)
self.stackedWidget.addWidget(self.view_analysis)
self.stackedWidget.addWidget(self.view_emotion)
self.stackedWidget.setCurrentWidget(self.view_userinfo)
menu = QMenu(self)
self.toDocxAct = QAction(QIcon('app/data/icons/word.svg'), '导出Docx', self)
self.toCSVAct = QAction(QIcon('app/data/icons/csv.svg'), '导出CSV', self)
self.toHtmlAct = QAction(QIcon('app/data/icons/html.svg'), '导出HTML', self)
self.toolButton_output.setPopupMode(QToolButton.MenuButtonPopup)
menu.addAction(self.toDocxAct)
menu.addAction(self.toCSVAct)
menu.addAction(self.toHtmlAct)
self.toolButton_output.setMenu(menu)
# self.toolButton_output.addSeparator()
self.toHtmlAct.triggered.connect(self.output)
self.toDocxAct.triggered.connect(self.output)
self.toCSVAct.triggered.connect(self.output)
def analysis(self):
self.stackedWidget.setCurrentWidget(self.view_analysis)
# 判断talkerId是否已经分析过了
# 是:则清空其他界面,直接显示该界面
# 否:清空其他界面,创建用户界面并显示
if 'room' in self.contact.wxid:
QMessageBox.warning(
self, '警告',
'暂不支持群组'
)
return
self.view_analysis.start()
def output(self):
return

View File

@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'contactInfoUi.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(817, 748)
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout.setObjectName("horizontalLayout")
self.frame = QtWidgets.QFrame(Form)
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setSpacing(0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_remark = QtWidgets.QLabel(self.frame)
self.label_remark.setMaximumSize(QtCore.QSize(16777215, 100))
font = QtGui.QFont()
font.setPointSize(12)
self.label_remark.setFont(font)
self.label_remark.setText("")
self.label_remark.setObjectName("label_remark")
self.horizontalLayout_3.addWidget(self.label_remark)
self.btn_analysis = QtWidgets.QPushButton(self.frame)
self.btn_analysis.setObjectName("btn_analysis")
self.horizontalLayout_3.addWidget(self.btn_analysis)
self.btn_emotion = QtWidgets.QPushButton(self.frame)
self.btn_emotion.setObjectName("btn_emotion")
self.horizontalLayout_3.addWidget(self.btn_emotion)
self.btn_report = QtWidgets.QPushButton(self.frame)
self.btn_report.setObjectName("btn_report")
self.horizontalLayout_3.addWidget(self.btn_report)
self.toolButton_output = QtWidgets.QToolButton(self.frame)
self.toolButton_output.setObjectName("toolButton_output")
self.horizontalLayout_3.addWidget(self.toolButton_output)
self.btn_back = QtWidgets.QPushButton(self.frame)
self.btn_back.setObjectName("btn_back")
self.horizontalLayout_3.addWidget(self.btn_back)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.stackedWidget = QtWidgets.QStackedWidget(self.frame)
self.stackedWidget.setObjectName("stackedWidget")
self.page_3 = QtWidgets.QWidget()
self.page_3.setObjectName("page_3")
self.stackedWidget.addWidget(self.page_3)
self.page_4 = QtWidgets.QWidget()
self.page_4.setObjectName("page_4")
self.stackedWidget.addWidget(self.page_4)
self.verticalLayout.addWidget(self.stackedWidget)
self.horizontalLayout.addWidget(self.frame)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.btn_analysis.setText(_translate("Form", "统计信息"))
self.btn_emotion.setText(_translate("Form", "情感分析"))
self.btn_report.setText(_translate("Form", "生成年度报告"))
self.toolButton_output.setText(_translate("Form", "导出聊天记录"))
self.btn_back.setText(_translate("Form", "退出"))

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>817</width>
<height>748</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_remark">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_analysis">
<property name="text">
<string>统计信息</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_emotion">
<property name="text">
<string>情感分析</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_report">
<property name="text">
<string>生成年度报告</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_output">
<property name="text">
<string>导出聊天记录</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_back">
<property name="text">
<string>退出</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="page_3"/>
<widget class="QWidget" name="page_4"/>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -57,49 +57,15 @@ class Ui_Dialog(object):
self.label.setObjectName("label")
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.horizontalLayout_2.addWidget(self.scrollArea)
self.frame = QtWidgets.QFrame(self.frame_2)
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setSpacing(0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_remark = QtWidgets.QLabel(self.frame)
self.label_remark.setMaximumSize(QtCore.QSize(16777215, 100))
font = QtGui.QFont()
font.setPointSize(12)
self.label_remark.setFont(font)
self.label_remark.setText("")
self.label_remark.setObjectName("label_remark")
self.horizontalLayout_3.addWidget(self.label_remark)
self.btn_analysis = QtWidgets.QPushButton(self.frame)
self.btn_analysis.setObjectName("btn_analysis")
self.horizontalLayout_3.addWidget(self.btn_analysis)
self.btn_emotion = QtWidgets.QPushButton(self.frame)
self.btn_emotion.setObjectName("btn_emotion")
self.horizontalLayout_3.addWidget(self.btn_emotion)
self.btn_report = QtWidgets.QPushButton(self.frame)
self.btn_report.setObjectName("btn_report")
self.horizontalLayout_3.addWidget(self.btn_report)
self.toolButton_output = QtWidgets.QToolButton(self.frame)
self.toolButton_output.setObjectName("toolButton_output")
self.horizontalLayout_3.addWidget(self.toolButton_output)
self.btn_back = QtWidgets.QPushButton(self.frame)
self.btn_back.setObjectName("btn_back")
self.horizontalLayout_3.addWidget(self.btn_back)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.stackedWidget = QtWidgets.QStackedWidget(self.frame)
self.stackedWidget = QtWidgets.QStackedWidget(self.frame_2)
self.stackedWidget.setObjectName("stackedWidget")
self.page_3 = QtWidgets.QWidget()
self.page_3.setObjectName("page_3")
self.stackedWidget.addWidget(self.page_3)
self.page_4 = QtWidgets.QWidget()
self.page_4.setObjectName("page_4")
self.stackedWidget.addWidget(self.page_4)
self.verticalLayout.addWidget(self.stackedWidget)
self.horizontalLayout_2.addWidget(self.frame)
self.page = QtWidgets.QWidget()
self.page.setObjectName("page")
self.stackedWidget.addWidget(self.page)
self.page_2 = QtWidgets.QWidget()
self.page_2.setObjectName("page_2")
self.stackedWidget.addWidget(self.page_2)
self.horizontalLayout_2.addWidget(self.stackedWidget)
self.horizontalLayout.addWidget(self.frame_2)
self.retranslateUi(Dialog)
@ -109,8 +75,3 @@ class Ui_Dialog(object):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.label.setText(_translate("Dialog", "TextLabel"))
self.btn_analysis.setText(_translate("Dialog", "统计信息"))
self.btn_emotion.setText(_translate("Dialog", "情感分析"))
self.btn_report.setText(_translate("Dialog", "生成年度报告"))
self.toolButton_output.setText(_translate("Dialog", "导出聊天记录"))
self.btn_back.setText(_translate("Dialog", "退出"))

View File

@ -151,81 +151,9 @@
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_remark">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_analysis">
<property name="text">
<string>统计信息</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_emotion">
<property name="text">
<string>情感分析</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_report">
<property name="text">
<string>生成年度报告</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_output">
<property name="text">
<string>导出聊天记录</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_back">
<property name="text">
<string>退出</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="page_3"/>
<widget class="QWidget" name="page_4"/>
</widget>
</item>
</layout>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>

View File

@ -93,10 +93,6 @@ class EmotionController(QWidget, emotionUi.Ui_Dialog):
# 加载动画
self.center()
self.label_01()
# 防止卡死,新建线程处理数据
self.Thread = LoadData(username)
self.Thread.okSignal.connect(self.initUI)
self.Thread.start()
def center(self): # 定义一个函数使得窗口居中显示
# 获取屏幕坐标系
@ -142,6 +138,12 @@ class EmotionController(QWidget, emotionUi.Ui_Dialog):
# palette.setColor(self.backgroundRole(), QColor(192, 253, 123)) # 设置背景颜色
self.setPalette(palette)
def start(self):
# 防止卡死,新建线程处理数据
self.Thread = LoadData(self.ta_username)
self.Thread.okSignal.connect(self.initUI)
self.Thread.start()
class LoadData(QThread):
"""

View File

@ -0,0 +1,15 @@
from PyQt5.QtWidgets import *
from app.person import Contact
from .userinfoUi import Ui_Frame
class UserinfoController(QWidget, Ui_Frame):
def __init__(self, contact: Contact, parent=None):
super().__init__(parent)
self.setupUi(self)
self.l_remark.setText(contact.conRemark)
self.l_avatar.setPixmap(contact.avatar)
self.l_nickname.setText(f'昵称:{contact.nickname}')
self.l_username.setText(f'微信号:{contact.alias}')
self.lineEdit.setText(contact.conRemark)