mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-09 09:31:18 +08:00
mainwindows文件修正
This commit is contained in:
parent
5b0eb3270d
commit
01f16c1168
140
app/Ui/chat/form.py
Normal file
140
app/Ui/chat/form.py
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'form.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(878, 720)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.scrollArea_2 = QtWidgets.QScrollArea(Form)
|
||||||
|
self.scrollArea_2.setEnabled(True)
|
||||||
|
self.scrollArea_2.setMaximumSize(QtCore.QSize(325, 150000))
|
||||||
|
self.scrollArea_2.setAutoFillBackground(False)
|
||||||
|
self.scrollArea_2.setFrameShape(QtWidgets.QFrame.WinPanel)
|
||||||
|
self.scrollArea_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.scrollArea_2.setMidLineWidth(0)
|
||||||
|
self.scrollArea_2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
|
||||||
|
self.scrollArea_2.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.scrollArea_2.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContentsOnFirstShow)
|
||||||
|
self.scrollArea_2.setWidgetResizable(False)
|
||||||
|
self.scrollArea_2.setObjectName("scrollArea_2")
|
||||||
|
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
|
||||||
|
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 300, 12000))
|
||||||
|
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
|
||||||
|
self.pushButton_3 = QtWidgets.QPushButton(self.scrollAreaWidgetContents_2)
|
||||||
|
self.pushButton_3.setGeometry(QtCore.QRect(0, 0, 300, 80))
|
||||||
|
self.pushButton_3.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||||
|
self.pushButton_3.setAutoFillBackground(False)
|
||||||
|
self.pushButton_3.setText("")
|
||||||
|
self.pushButton_3.setIconSize(QtCore.QSize(80, 80))
|
||||||
|
self.pushButton_3.setObjectName("pushButton_3")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents_2)
|
||||||
|
self.label_2.setGeometry(QtCore.QRect(220, 10, 72, 15))
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
|
||||||
|
self.horizontalLayout.addWidget(self.scrollArea_2)
|
||||||
|
self.frame_2 = QtWidgets.QFrame(Form)
|
||||||
|
self.frame_2.setMinimumSize(QtCore.QSize(500, 500))
|
||||||
|
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_2.setObjectName("frame_2")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame_2)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.label_remark_2 = QtWidgets.QLabel(self.frame_2)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setPointSize(12)
|
||||||
|
self.label_remark_2.setFont(font)
|
||||||
|
self.label_remark_2.setText("")
|
||||||
|
self.label_remark_2.setObjectName("label_remark_2")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_remark_2)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_3.addItem(spacerItem)
|
||||||
|
self.toolButton_2 = QtWidgets.QToolButton(self.frame_2)
|
||||||
|
self.toolButton_2.setObjectName("toolButton_2")
|
||||||
|
self.horizontalLayout_3.addWidget(self.toolButton_2)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_3)
|
||||||
|
self.line_4 = QtWidgets.QFrame(self.frame_2)
|
||||||
|
self.line_4.setLineWidth(6)
|
||||||
|
self.line_4.setFrameShape(QtWidgets.QFrame.VLine)
|
||||||
|
self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_4.setObjectName("line_4")
|
||||||
|
self.verticalLayout.addWidget(self.line_4)
|
||||||
|
self.line_5 = QtWidgets.QFrame(self.frame_2)
|
||||||
|
self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_5.setObjectName("line_5")
|
||||||
|
self.verticalLayout.addWidget(self.line_5)
|
||||||
|
self.message_2 = QtWidgets.QTextBrowser(self.frame_2)
|
||||||
|
self.message_2.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
|
self.message_2.setStyleSheet("background-color: #F5F5F5;")
|
||||||
|
self.message_2.setObjectName("message_2")
|
||||||
|
self.verticalLayout.addWidget(self.message_2)
|
||||||
|
self.textEdit_2 = QtWidgets.QTextEdit(self.frame_2)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setPointSize(15)
|
||||||
|
self.textEdit_2.setFont(font)
|
||||||
|
self.textEdit_2.setTabStopWidth(80)
|
||||||
|
self.textEdit_2.setCursorWidth(1)
|
||||||
|
self.textEdit_2.setObjectName("textEdit_2")
|
||||||
|
self.verticalLayout.addWidget(self.textEdit_2)
|
||||||
|
self.line_6 = QtWidgets.QFrame(self.frame_2)
|
||||||
|
self.line_6.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_6.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_6.setObjectName("line_6")
|
||||||
|
self.verticalLayout.addWidget(self.line_6)
|
||||||
|
self.btn_sendMsg_2 = QtWidgets.QPushButton(self.frame_2)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("黑体")
|
||||||
|
font.setPointSize(15)
|
||||||
|
font.setBold(False)
|
||||||
|
font.setWeight(50)
|
||||||
|
self.btn_sendMsg_2.setFont(font)
|
||||||
|
self.btn_sendMsg_2.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||||
|
self.btn_sendMsg_2.setMouseTracking(False)
|
||||||
|
self.btn_sendMsg_2.setAutoFillBackground(False)
|
||||||
|
self.btn_sendMsg_2.setStyleSheet("QPushButton {\n"
|
||||||
|
" background-color: #f0f0f0;\n"
|
||||||
|
" \n"
|
||||||
|
" padding: 10px;\n"
|
||||||
|
" color:rgb(5,180,104);\n"
|
||||||
|
"}")
|
||||||
|
self.btn_sendMsg_2.setIconSize(QtCore.QSize(40, 40))
|
||||||
|
self.btn_sendMsg_2.setCheckable(False)
|
||||||
|
self.btn_sendMsg_2.setAutoDefault(True)
|
||||||
|
self.btn_sendMsg_2.setObjectName("btn_sendMsg_2")
|
||||||
|
self.verticalLayout.addWidget(self.btn_sendMsg_2)
|
||||||
|
self.verticalLayout.setStretch(0, 1)
|
||||||
|
self.verticalLayout.setStretch(2, 3)
|
||||||
|
self.verticalLayout.setStretch(3, 20)
|
||||||
|
self.verticalLayout.setStretch(4, 1)
|
||||||
|
self.verticalLayout.setStretch(6, 1)
|
||||||
|
self.horizontalLayout.addWidget(self.frame_2)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.label_2.setText(_translate("Form", "TextLabel"))
|
||||||
|
self.toolButton_2.setText(_translate("Form", "..."))
|
||||||
|
self.textEdit_2.setHtml(_translate("Form",
|
||||||
|
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:\'SimSun\'; font-size:15pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||||
|
self.btn_sendMsg_2.setText(_translate("Form", "发送"))
|
BIN
app/Ui/chat/myinfo.zip
Normal file
BIN
app/Ui/chat/myinfo.zip
Normal file
Binary file not shown.
BIN
app/Ui/contact/analysis/charts - 副本.zip
Normal file
BIN
app/Ui/contact/analysis/charts - 副本.zip
Normal file
Binary file not shown.
164
app/Ui/contact/emotion/emotion.py
Normal file
164
app/Ui/contact/emotion/emotion.py
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
from pyecharts import options as opts
|
||||||
|
from pyecharts.charts import Line
|
||||||
|
|
||||||
|
from ....DataBase import data
|
||||||
|
|
||||||
|
|
||||||
|
def load_data(wxid):
|
||||||
|
message_data = data.get_text_by_num(wxid, 1)
|
||||||
|
df = pd.DataFrame(message_data, columns=['message', 'date'])
|
||||||
|
# print(df)
|
||||||
|
d = df.groupby('date')
|
||||||
|
for key, value in d:
|
||||||
|
yield key, value['message'].values
|
||||||
|
|
||||||
|
|
||||||
|
import snownlp
|
||||||
|
|
||||||
|
|
||||||
|
def emotion_analysis(wxid):
|
||||||
|
dates = []
|
||||||
|
emotions = []
|
||||||
|
for date, messages in load_data(wxid):
|
||||||
|
dates.append(date)
|
||||||
|
s = 0
|
||||||
|
for msg in messages:
|
||||||
|
val = snownlp.SnowNLP(msg).sentiments
|
||||||
|
s += val
|
||||||
|
emotions.append(s / len(messages))
|
||||||
|
emotions = np.array(emotions)
|
||||||
|
emotions = np.around(emotions, 3) * 100
|
||||||
|
return dates, emotions
|
||||||
|
|
||||||
|
|
||||||
|
def plot_emotion(wxid):
|
||||||
|
"""
|
||||||
|
画图
|
||||||
|
"""
|
||||||
|
datas, emotions = emotion_analysis(wxid) # 获取数据
|
||||||
|
max_ = max(emotions)
|
||||||
|
min_ = min(emotions)
|
||||||
|
c = (
|
||||||
|
Line()
|
||||||
|
.add_xaxis(
|
||||||
|
xaxis_data=datas,
|
||||||
|
)
|
||||||
|
.add_yaxis(
|
||||||
|
series_name="情感趋势",
|
||||||
|
is_smooth=True,
|
||||||
|
y_axis=emotions,
|
||||||
|
markpoint_opts=opts.MarkPointOpts(
|
||||||
|
data=[
|
||||||
|
opts.MarkPointItem(type_="max", name="最大值", value=int(max_ * 100) / 100),
|
||||||
|
opts.MarkPointItem(type_="min", name="最小值", value=int(min_ * 100) / 100),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
markline_opts=opts.MarkLineOpts(
|
||||||
|
data=[opts.MarkLineItem(type_="average", name="平均值")]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.set_global_opts(
|
||||||
|
yaxis_opts=opts.AxisOpts(
|
||||||
|
max_=max_,
|
||||||
|
min_=min_,
|
||||||
|
),
|
||||||
|
xaxis_opts=opts.AxisOpts(
|
||||||
|
type_='time'
|
||||||
|
),
|
||||||
|
axispointer_opts=opts.AxisPointerOpts(
|
||||||
|
is_show=True, link=[{"xAxisIndex": "all"}]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
|
||||||
|
.render("./data/聊天统计/emotion_chart.html")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5.QtCore import *
|
||||||
|
from PyQt5.QtGui import *
|
||||||
|
from PyQt5.QtWebEngineWidgets import QWebEngineView
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
|
from . import emotionUi
|
||||||
|
|
||||||
|
|
||||||
|
class EmotionController(QWidget, emotionUi.Ui_Dialog):
|
||||||
|
def __init__(self, username, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.ta_username = username
|
||||||
|
|
||||||
|
# self.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
|
||||||
|
# 加载动画
|
||||||
|
self.center()
|
||||||
|
self.label_01()
|
||||||
|
# 防止卡死,新建线程处理数据
|
||||||
|
self.Thread = LoadData(username)
|
||||||
|
self.Thread.okSignal.connect(self.initUI)
|
||||||
|
self.Thread.start()
|
||||||
|
|
||||||
|
def center(self): # 定义一个函数使得窗口居中显示
|
||||||
|
# 获取屏幕坐标系
|
||||||
|
screen = QDesktopWidget().screenGeometry()
|
||||||
|
# 获取窗口坐标系
|
||||||
|
size = self.geometry()
|
||||||
|
newLeft = (screen.width() - size.width()) / 2
|
||||||
|
newTop = (screen.height() - size.height()) / 2
|
||||||
|
self.move(int(newLeft), int(newTop))
|
||||||
|
|
||||||
|
def label_01(self):
|
||||||
|
w = self.size().width()
|
||||||
|
h = self.size().height()
|
||||||
|
self.label = QLabel(self)
|
||||||
|
self.label.setGeometry(w // 2, h // 2, 100, 100)
|
||||||
|
self.label.setToolTip("这是一个标签")
|
||||||
|
self.m_movie()
|
||||||
|
|
||||||
|
def m_movie(self):
|
||||||
|
movie = QMovie("./app/data/bg.gif")
|
||||||
|
self.label.setMovie(movie)
|
||||||
|
movie.start()
|
||||||
|
|
||||||
|
def initUI(self):
|
||||||
|
self.label.setVisible(False)
|
||||||
|
# self.setStyleSheet('''QWidget{background-color:rgb(244, 244, 244);}''')
|
||||||
|
main_box = QHBoxLayout(self)
|
||||||
|
self.browser1 = QWebEngineView()
|
||||||
|
self.browser1.load(QUrl('file:///data/聊天统计/emotion_chart.html'))
|
||||||
|
# self.browser1.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
|
||||||
|
|
||||||
|
splitter1 = QSplitter(Qt.Vertical)
|
||||||
|
|
||||||
|
splitter1.addWidget(self.browser1)
|
||||||
|
main_box.addWidget(splitter1)
|
||||||
|
self.setLayout(main_box)
|
||||||
|
|
||||||
|
def setBackground(self):
|
||||||
|
palette = QPalette()
|
||||||
|
pix = QPixmap("./app/data/bg.png")
|
||||||
|
pix = pix.scaled(self.width(), self.height(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation) # 自适应图片大小
|
||||||
|
palette.setBrush(self.backgroundRole(), QBrush(pix)) # 设置背景图片
|
||||||
|
# palette.setColor(self.backgroundRole(), QColor(192, 253, 123)) # 设置背景颜色
|
||||||
|
self.setPalette(palette)
|
||||||
|
|
||||||
|
|
||||||
|
class LoadData(QThread):
|
||||||
|
"""
|
||||||
|
发送信息线程
|
||||||
|
"""
|
||||||
|
okSignal = pyqtSignal(int)
|
||||||
|
|
||||||
|
def __init__(self, ta_u, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.ta_username = ta_u
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
plot_emotion(self.ta_username)
|
||||||
|
self.okSignal.emit(10)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# wxid = 'wxid_8piw6sb4hvfm22'
|
||||||
|
wxid = 'wxid_wt2vsktnu4z022'
|
||||||
|
load_data(wxid)
|
24
app/Ui/contact/emotion/emotionUi.py
Normal file
24
app/Ui/contact/emotion/emotionUi.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'emotionUi.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
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(400, 300)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
126
app/Ui/mainwindow.py
Normal file
126
app/Ui/mainwindow.py
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'mainwindow.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, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(1280, 779)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setSpacing(0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.frame_info = QtWidgets.QFrame(self.centralwidget)
|
||||||
|
self.frame_info.setMinimumSize(QtCore.QSize(80, 500))
|
||||||
|
self.frame_info.setMaximumSize(QtCore.QSize(80, 16777215))
|
||||||
|
self.frame_info.setStyleSheet("background-color:rgb(240,240,240)")
|
||||||
|
self.frame_info.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_info.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.frame_info.setObjectName("frame_info")
|
||||||
|
self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_info)
|
||||||
|
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 190, 61, 271))
|
||||||
|
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||||
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||||
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout_2.setSpacing(0)
|
||||||
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
|
self.btn_chat = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||||
|
self.btn_chat.setMinimumSize(QtCore.QSize(0, 60))
|
||||||
|
self.btn_chat.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||||
|
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||||
|
" ")
|
||||||
|
self.btn_chat.setObjectName("btn_chat")
|
||||||
|
self.verticalLayout_2.addWidget(self.btn_chat)
|
||||||
|
self.btn_contact = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||||
|
self.btn_contact.setMinimumSize(QtCore.QSize(0, 60))
|
||||||
|
self.btn_contact.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||||
|
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||||
|
" ")
|
||||||
|
self.btn_contact.setObjectName("btn_contact")
|
||||||
|
self.verticalLayout_2.addWidget(self.btn_contact)
|
||||||
|
self.btn_myinfo = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||||
|
self.btn_myinfo.setMinimumSize(QtCore.QSize(60, 60))
|
||||||
|
self.btn_myinfo.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||||
|
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||||
|
" ")
|
||||||
|
self.btn_myinfo.setObjectName("btn_myinfo")
|
||||||
|
self.verticalLayout_2.addWidget(self.btn_myinfo)
|
||||||
|
self.btn_about = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||||
|
self.btn_about.setMinimumSize(QtCore.QSize(60, 60))
|
||||||
|
self.btn_about.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||||
|
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||||
|
" ")
|
||||||
|
self.btn_about.setObjectName("btn_about")
|
||||||
|
self.verticalLayout_2.addWidget(self.btn_about)
|
||||||
|
self.verticalLayout_2.setStretch(0, 1)
|
||||||
|
self.verticalLayout_2.setStretch(1, 1)
|
||||||
|
self.verticalLayout_2.setStretch(2, 1)
|
||||||
|
self.verticalLayout_2.setStretch(3, 1)
|
||||||
|
self.myavatar = QtWidgets.QLabel(self.frame_info)
|
||||||
|
self.myavatar.setGeometry(QtCore.QRect(5, 40, 70, 70))
|
||||||
|
self.myavatar.setObjectName("myavatar")
|
||||||
|
self.horizontalLayout.addWidget(self.frame_info)
|
||||||
|
self.frame_main = QtWidgets.QFrame(self.centralwidget)
|
||||||
|
self.frame_main.setMinimumSize(QtCore.QSize(1120, 720))
|
||||||
|
self.frame_main.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||||
|
self.frame_main.setFrameShape(QtWidgets.QFrame.Box)
|
||||||
|
self.frame_main.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_main.setObjectName("frame_main")
|
||||||
|
self.horizontalLayout.addWidget(self.frame_main)
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||||
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 1280, 23))
|
||||||
|
self.menubar.setObjectName("menubar")
|
||||||
|
self.menu_F = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menu_F.setObjectName("menu_F")
|
||||||
|
self.menu = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menu.setObjectName("menu")
|
||||||
|
self.menu_2 = QtWidgets.QMenu(self.menubar)
|
||||||
|
self.menu_2.setObjectName("menu_2")
|
||||||
|
MainWindow.setMenuBar(self.menubar)
|
||||||
|
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||||
|
self.statusbar.setObjectName("statusbar")
|
||||||
|
MainWindow.setStatusBar(self.statusbar)
|
||||||
|
self.action_3 = QtWidgets.QAction(MainWindow)
|
||||||
|
self.action_3.setObjectName("action_3")
|
||||||
|
self.action_4 = QtWidgets.QAction(MainWindow)
|
||||||
|
self.action_4.setObjectName("action_4")
|
||||||
|
self.action = QtWidgets.QAction(MainWindow)
|
||||||
|
self.action.setObjectName("action")
|
||||||
|
self.menu_F.addSeparator()
|
||||||
|
self.menu_F.addSeparator()
|
||||||
|
self.menu_F.addAction(self.action_3)
|
||||||
|
self.menu_F.addAction(self.action_4)
|
||||||
|
self.menu_2.addAction(self.action)
|
||||||
|
self.menubar.addAction(self.menu_F.menuAction())
|
||||||
|
self.menubar.addAction(self.menu.menuAction())
|
||||||
|
self.menubar.addAction(self.menu_2.menuAction())
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||||
|
self.btn_chat.setText(_translate("MainWindow", "聊天"))
|
||||||
|
self.btn_contact.setText(_translate("MainWindow", "联系人"))
|
||||||
|
self.btn_myinfo.setText(_translate("MainWindow", "我的"))
|
||||||
|
self.btn_about.setText(_translate("MainWindow", "关于"))
|
||||||
|
self.myavatar.setText(_translate("MainWindow", "avatar"))
|
||||||
|
self.menu_F.setTitle(_translate("MainWindow", "文件(F)"))
|
||||||
|
self.menu.setTitle(_translate("MainWindow", "编辑"))
|
||||||
|
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
|
||||||
|
self.action_3.setText(_translate("MainWindow", "保存"))
|
||||||
|
self.action_4.setText(_translate("MainWindow", "退出"))
|
||||||
|
self.action.setText(_translate("MainWindow", "关于"))
|
40
app/Ui/userinfo/userinfo.py
Normal file
40
app/Ui/userinfo/userinfo.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
@File : contact.py
|
||||||
|
@Author : Shuaikang Zhou
|
||||||
|
@Time : 2022/12/13 15:07
|
||||||
|
@IDE : Pycharm
|
||||||
|
@Version : Python3.10
|
||||||
|
@comment : ···
|
||||||
|
"""
|
||||||
|
from PyQt5.QtCore import *
|
||||||
|
from PyQt5.QtGui import *
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
|
from .userinfoUi import *
|
||||||
|
from ...DataBase import data
|
||||||
|
|
||||||
|
|
||||||
|
class MyinfoController(QWidget, Ui_Dialog):
|
||||||
|
exitSignal = pyqtSignal()
|
||||||
|
urlSignal = pyqtSignal(QUrl)
|
||||||
|
|
||||||
|
# username = ''
|
||||||
|
|
||||||
|
def __init__(self, Me, parent=None):
|
||||||
|
super(MyinfoController, self).__init__(parent)
|
||||||
|
self.setupUi(self)
|
||||||
|
self.setWindowTitle('WeChat')
|
||||||
|
self.setWindowIcon(QIcon('./app/data/icon.png'))
|
||||||
|
self.Me = Me
|
||||||
|
self.initui()
|
||||||
|
|
||||||
|
def initui(self):
|
||||||
|
self.myinfo = data.get_myInfo()
|
||||||
|
avatar = self.Me.my_avatar
|
||||||
|
pixmap = QPixmap(avatar).scaled(80, 80) # 按指定路径找到图片
|
||||||
|
self.label_avatar.setPixmap(pixmap) # 在label上显示图片
|
||||||
|
self.label_name.setText(self.myinfo['name'])
|
||||||
|
self.label_wxid.setText('微信号:' + self.myinfo['username'])
|
||||||
|
city = f"地区:{self.myinfo['province']}{self.myinfo['city']}"
|
||||||
|
self.label_city.setText(city)
|
59
app/Ui/userinfo/userinfoUi.py
Normal file
59
app/Ui/userinfo/userinfoUi.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'userinfoUi.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_Dialog(object):
|
||||||
|
def setupUi(self, Dialog):
|
||||||
|
Dialog.setObjectName("Dialog")
|
||||||
|
Dialog.resize(1120, 720)
|
||||||
|
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||||
|
Dialog.setAutoFillBackground(False)
|
||||||
|
self.frame_2 = QtWidgets.QFrame(Dialog)
|
||||||
|
self.frame_2.setGeometry(QtCore.QRect(0, 0, 1120, 720))
|
||||||
|
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||||
|
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||||
|
self.frame_2.setObjectName("frame_2")
|
||||||
|
self.horizontalLayoutWidget = QtWidgets.QWidget(self.frame_2)
|
||||||
|
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(340, 60, 291, 82))
|
||||||
|
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
|
||||||
|
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.label_avatar = QtWidgets.QLabel(self.horizontalLayoutWidget)
|
||||||
|
self.label_avatar.setMinimumSize(QtCore.QSize(80, 80))
|
||||||
|
self.label_avatar.setObjectName("label_avatar")
|
||||||
|
self.horizontalLayout.addWidget(self.label_avatar)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.label_name = QtWidgets.QLabel(self.horizontalLayoutWidget)
|
||||||
|
self.label_name.setObjectName("label_name")
|
||||||
|
self.verticalLayout.addWidget(self.label_name)
|
||||||
|
self.label_wxid = QtWidgets.QLabel(self.horizontalLayoutWidget)
|
||||||
|
self.label_wxid.setObjectName("label_wxid")
|
||||||
|
self.verticalLayout.addWidget(self.label_wxid)
|
||||||
|
self.label_city = QtWidgets.QLabel(self.horizontalLayoutWidget)
|
||||||
|
self.label_city.setObjectName("label_city")
|
||||||
|
self.verticalLayout.addWidget(self.label_city)
|
||||||
|
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||||
|
self.horizontalLayout.setStretch(0, 1)
|
||||||
|
self.horizontalLayout.setStretch(1, 3)
|
||||||
|
|
||||||
|
self.retranslateUi(Dialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, Dialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||||
|
self.label_avatar.setText(_translate("Dialog", "TextLabel"))
|
||||||
|
self.label_name.setText(_translate("Dialog", "TextLabel"))
|
||||||
|
self.label_wxid.setText(_translate("Dialog", "TextLabel"))
|
||||||
|
self.label_city.setText(_translate("Dialog", "TextLabel"))
|
91
app/Ui/userinfo/userinfoUi.ui
Normal file
91
app/Ui/userinfo/userinfoUi.ui
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?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>1120</width>
|
||||||
|
<height>720</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_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1120</width>
|
||||||
|
<height>720</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>82</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_avatar">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>80</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_name">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_wxid">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_city">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue
Block a user