新增对话情感分析,增加窗口自适应,新增emotion界面

This commit is contained in:
shuaikangzhou 2023-04-02 21:23:20 +08:00
parent 5faa0cb1e6
commit 19d529c36e
22 changed files with 1351 additions and 994 deletions

46
TEST.py
View File

@ -1,40 +1,8 @@
import json
from snownlp import SnowNLP
from pyecharts import options as opts
from pyecharts.charts import Graph
with open(r'data/npmdepgraph.min10.json', 'r') as f:
data = json.load(f)
nodes = [
{
'x': node['x'],
'y': node['y'],
'name': node['label'],
'symbolSize': node['size'],
'itemStyle': {'color': node['color']}
}
for node in data['nodes']
]
edges = [
{
'source': edge['sourceID'],
'target': edge['targetID']
}
for edge in data['edges']
]
G = Graph(init_opts=opts.InitOpts(width='900', height='900'))
G.add(
series_name='',
nodes=nodes,
links=edges,
layout='none',
is_roam=True,
is_focusnode=True,
label_opts=opts.LabelOpts(is_show=True),
linestyle_opts=opts.LineStyleOpts(width=0.5, curve=0.3, opacity=0.7)
)
G.set_global_opts(title_opts=opts.TitleOpts(title='NPM Dependencies'))
G.render('npm_dependencies.html')
# 文本
text = u'🙄”'
# 分析
s = SnowNLP(text)
# 输出情绪为积极的概率
print(s)

103
TEST/mainwindow.ui Normal file
View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>29</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu">
<property name="title">
<string>你好</string>
</property>
</widget>
<widget class="QMenu" name="menuOK">
<property name="title">
<string>OK</string>
</property>
</widget>
<addaction name="menu"/>
<addaction name="menuOK"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -200,13 +200,25 @@ def get_message(wxid, num):
sql = '''
select * from message
where talker = ?
order by msgId desc
order by createTime desc
limit ?,100
'''
cursor.execute(sql, [wxid, num * 100])
return cursor.fetchall()
def get_text_by_num(wxid, num):
sql = '''
SELECT content,strftime('%Y-%m-%d',createTime/1000,'unixepoch','localtime') as days
from message
where talker = ? and type=1
order by days
'''
'''group by days'''
cursor.execute(sql, [wxid])
return cursor.fetchall()
def search_send_message(start_time, end_time):
start_time = '2022-1-1 00:00:00'
end_time = '2023-1-1 00:00:00'
@ -261,7 +273,7 @@ def get_emoji(imgPath):
except sqlite3.ProgrammingError as e:
print(e, imgPath)
return False
return newPath
return False
def download_emoji(imgPath, url):
@ -654,6 +666,12 @@ def chat_start_endTime(username):
print(year, month, day, hour, minute, second)
if __name__ == '__main__':
wxid = 'wxid_8piw6sb4hvfm22'
wxid = 'wxid_wt2vsktnu4z022'
# emotion_analysis(wxid)
plot_emotion(wxid)
'''
if __name__ == '__main__':
# rconversation = get_rconversation()
# for i in rconversation:
@ -680,5 +698,17 @@ if __name__ == '__main__':
# print(result)
# radar_hour('wxid_8piw6sb4hvfm22')
# print(result)
print(get_msg_start_time('wxid_8piw6sb4hvfm22'), get_msg_end_time('wxid_8piw6sb4hvfm22'))
chat_start_endTime('wxid_8piw6sb4hvfm22')
# print(get_msg_start_time('wxid_8piw6sb4hvfm22'), get_msg_end_time('wxid_8piw6sb4hvfm22'))
# chat_start_endTime('wxid_8piw6sb4hvfm22')
msg = get_text_by_num('wxid_8piw6sb4hvfm22', 1)
from snownlp import SnowNLP
# print(msg[0])
for m in msg:
content = m[0]
print(content)
s = SnowNLP(content)
# # 输出情绪为积极的概率
print(s.sentiments)
# print(msg)
'''

View File

@ -14,11 +14,11 @@ from . import data
def IS_5_min(last_m, now_m):
'''
"""
#! 判断两次聊天时间是不是大于五分钟
#! 若大于五分钟则显示时间
#! 否则不显示
'''
"""
'''两次聊天记录时间差,单位是秒'''
dt = now_m - last_m
return abs(dt // 1000) >= 300
@ -55,7 +55,6 @@ class Output(QThread):
def merge_docx(self, conRemark, n):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{conRemark}"
all_word = os.listdir(origin_docx_path)
all_file_path = []
for i in range(n):
file_name = f"{conRemark}{i}.docx"
@ -295,14 +294,14 @@ class ChildThread(QThread):
doc.add_paragraph()
def pat_a_pat(self, doc, isSend, content, status):
'''
"""
#! 添加拍一拍信息
todo 把wxid转化成昵称
:param isSend:
:param content:
:param status:
:return:
'''
"""
try:
pat_data = xmltodict.parse(content)
pat_data = pat_data['msg']['appmsg']['patMsg']['records']['record']

5
app/Ui/123.py Normal file
View File

@ -0,0 +1,5 @@
# This Python file uses the following encoding: utf-8
# if __name__ == "__main__":
# pass
print('hello')

View File

@ -21,7 +21,7 @@ from ...DataBase import data
from ...ImageBox.ui import MainDemo
class ChatController(QWidget, Ui_Dialog):
class ChatController(QWidget, Ui_Form):
exitSignal = pyqtSignal()
urlSignal = pyqtSignal(QUrl)
@ -32,6 +32,11 @@ class ChatController(QWidget, Ui_Dialog):
self.chatroomFlag = None
self.ta_avatar = None
self.setupUi(self)
self.message = self.message_2
self.frame = self.frame_2
self.scrollAreaWidgetContents = self.scrollAreaWidgetContents_2
self.label_remark = self.label_remark_2
self.textEdit = self.textEdit_2
self.setWindowTitle('WeChat')
self.setWindowIcon(QIcon('./app/data/icon.png'))
self.initui()
@ -43,6 +48,7 @@ class ChatController(QWidget, Ui_Dialog):
self.last_btn = None
self.chat_flag = True
# self.showChat()
self.message.verticalScrollBar().valueChanged.connect(self.textbrower_verticalScrollBar)
self.show_flag = False
self.ta_username = None
@ -59,29 +65,29 @@ class ChatController(QWidget, Ui_Dialog):
self.message.setOpenExternalLinks(False)
# self.message.anchorClicked(self.hyperlink())
self.message.anchorClicked.connect(self.hyperlink)
self.btn_sendMsg = QtWidgets.QPushButton(self.frame)
self.btn_sendMsg.setGeometry(QtCore.QRect(680, 670, 121, 51))
font = QtGui.QFont()
font.setFamily("黑体")
font.setPointSize(15)
font.setBold(False)
font.setWeight(50)
self.btn_sendMsg.setFont(font)
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.btn_sendMsg.setMouseTracking(False)
self.btn_sendMsg.setAutoFillBackground(False)
self.btn_sendMsg.setStyleSheet("QPushButton {background-color: #f0f0f0;\n"
"padding: 10px;\n"
"color:rgb(5,180,104);}\n"
"QPushButton:hover{background-color: rgb(198,198,198)}\n"
)
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
self.btn_sendMsg.setCheckable(False)
self.btn_sendMsg.setAutoDefault(True)
self.btn_sendMsg.setObjectName("btn_sendMsg")
_translate = QtCore.QCoreApplication.translate
self.btn_sendMsg.setText(_translate("Dialog", "发送"))
self.btn_sendMsg.setToolTip('按Enter键发送按Ctrl+Enter键换行')
# self.btn_sendMsg = QtWidgets.QPushButton(self.textEdit)
# self.btn_sendMsg.setGeometry(QtCore.QRect(1, 1, 121, 51))
# font = QtGui.QFont()
# font.setFamily("黑体")
# font.setPointSize(15)
# font.setBold(False)
# font.setWeight(50)
# self.btn_sendMsg.setFont(font)
# self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
# self.btn_sendMsg.setMouseTracking(False)
# self.btn_sendMsg.setAutoFillBackground(False)
# self.btn_sendMsg.setStyleSheet("QPushButton {background-color: #f0f0f0;\n"
# "padding: 10px;\n"
# "color:rgb(5,180,104);}\n"
# "QPushButton:hover{background-color: rgb(198,198,198)}\n"
# )
# self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
# self.btn_sendMsg.setCheckable(False)
# self.btn_sendMsg.setAutoDefault(True)
# self.btn_sendMsg.setObjectName("btn_sendMsg")
# _translate = QtCore.QCoreApplication.translate
# self.btn_sendMsg.setText(_translate("Dialog", "发送"))
self.btn_sendMsg_2.setToolTip('按Enter键发送按Ctrl+Enter键换行')
def showChat(self):
"""
@ -92,7 +98,9 @@ class ChatController(QWidget, Ui_Dialog):
return
self.show_flag = True
rconversations = data.get_rconversation()
max_hight = max(len(rconversations) * 80, 680)
# max_hight = max(len(rconversations) * 80, 680)
max_hight = max(len(rconversations) * 80, self.size().height())
self.scrollAreaWidgetContents.setGeometry(
QtCore.QRect(0, 0, 300, max_hight))
for i in range(len(rconversations)):
@ -117,8 +125,8 @@ class ChatController(QWidget, Ui_Dialog):
if self.last_talkerId and self.last_talkerId != talkerId:
print('对方账号:', self.last_talkerId)
self.contacts[self.last_talkerId].setStyleSheet(
"QPushButton {background-color: rgb(253,253,253);}"
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
"QPushButton {background-color: rgb(220,220,220);}"
"QPushButton:hover{background-color: rgb(208,208,208);}\n"
)
self.last_talkerId = talkerId
self.contacts[talkerId].setStyleSheet(
@ -264,6 +272,7 @@ class ChatController(QWidget, Ui_Dialog):
def show_emoji(self, isSend, imagePath, content):
imgPath = data.get_emoji(imagePath)
print('emoji:', imgPath)
if not imgPath:
return False
image = Image.open(imgPath)
@ -496,8 +505,8 @@ class Contact(QtWidgets.QPushButton):
self.gridLayout1.setRowStretch(1, 3)
self.setLayout(self.gridLayout1)
self.setStyleSheet(
"QPushButton {background-color: rgb(253,253,253);}"
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
"QPushButton {background-color: rgb(220,220,220);}"
"QPushButton:hover{background-color: rgb(208,208,208);}\n"
)
self.msgCount = contact[0]
self.username = contact[1]

View File

@ -11,120 +11,140 @@
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))
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.setStyleSheet("background-color: #F5F5F5;")
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_2.setObjectName("frame_2")
self.scrollArea = QtWidgets.QScrollArea(self.frame_2)
self.scrollArea.setEnabled(True)
self.scrollArea.setGeometry(QtCore.QRect(0, 40, 326, 680))
self.scrollArea.setMaximumSize(QtCore.QSize(400, 150000))
self.scrollArea.setAutoFillBackground(False)
self.scrollArea.setFrameShape(QtWidgets.QFrame.WinPanel)
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Raised)
self.scrollArea.setMidLineWidth(0)
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.scrollArea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContentsOnFirstShow)
self.scrollArea.setWidgetResizable(False)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 300, 12000))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.pushButton_2 = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
self.pushButton_2.setGeometry(QtCore.QRect(0, 0, 300, 80))
self.pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
self.pushButton_2.setAutoFillBackground(False)
self.pushButton_2.setText("")
self.pushButton_2.setIconSize(QtCore.QSize(80, 80))
self.pushButton_2.setObjectName("pushButton_2")
self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
self.label.setGeometry(QtCore.QRect(220, 10, 72, 15))
self.label.setObjectName("label")
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.frame = QtWidgets.QFrame(self.frame_2)
self.frame.setGeometry(QtCore.QRect(321, 0, 801, 720))
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.message = QtWidgets.QTextBrowser(self.frame)
self.message.setGeometry(QtCore.QRect(9, 39, 801, 541))
self.message.setStyleSheet("background-color: #F5F5F5;")
self.message.setObjectName("message")
self.textEdit = QtWidgets.QTextEdit(self.frame)
self.textEdit.setGeometry(QtCore.QRect(9, 579, 821, 141))
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame_2)
self.verticalLayout.setContentsMargins(0, 5, 0, 0)
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_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.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.textEdit_2 = QtWidgets.QTextEdit(self.frame_2)
font = QtGui.QFont()
font.setPointSize(15)
self.textEdit.setFont(font)
self.textEdit.setTabStopWidth(80)
self.textEdit.setCursorWidth(1)
self.textEdit.setObjectName("textEdit")
self.btn_sendMsg = QtWidgets.QPushButton(self.frame)
self.btn_sendMsg.setGeometry(QtCore.QRect(680, 670, 121, 51))
self.textEdit_2.setFont(font)
self.textEdit_2.setAutoFillBackground(False)
self.textEdit_2.setStyleSheet("background-color: #F5F5F5;")
self.textEdit_2.setFrameShape(QtWidgets.QFrame.NoFrame)
self.textEdit_2.setOverwriteMode(False)
self.textEdit_2.setTabStopWidth(80)
self.textEdit_2.setAcceptRichText(True)
self.textEdit_2.setCursorWidth(1)
self.textEdit_2.setTextInteractionFlags(QtCore.Qt.TextEditorInteraction)
self.textEdit_2.setObjectName("textEdit_2")
self.verticalLayout.addWidget(self.textEdit_2)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
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.setFont(font)
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.btn_sendMsg.setMouseTracking(False)
self.btn_sendMsg.setAutoFillBackground(False)
self.btn_sendMsg.setStyleSheet("QPushButton {\n"
" background-color: #f0f0f0;\n"
" \n"
" padding: 10px;\n"
" color:rgb(5,180,104);\n"
"}")
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
self.btn_sendMsg.setCheckable(False)
self.btn_sendMsg.setAutoDefault(True)
self.btn_sendMsg.setObjectName("btn_sendMsg")
self.toolButton = QtWidgets.QToolButton(self.frame)
self.toolButton.setGeometry(QtCore.QRect(760, 0, 47, 41))
self.toolButton.setObjectName("toolButton")
self.line_3 = QtWidgets.QFrame(self.frame)
self.line_3.setGeometry(QtCore.QRect(2, 0, 3, 720))
self.line_3.setLineWidth(6)
self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_3.setObjectName("line_3")
self.line_2 = QtWidgets.QFrame(self.frame)
self.line_2.setGeometry(QtCore.QRect(9, 30, 831, 20))
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_2.setObjectName("line_2")
self.label_remark = QtWidgets.QLabel(self.frame)
self.label_remark.setGeometry(QtCore.QRect(30, 0, 351, 41))
font = QtGui.QFont()
font.setPointSize(12)
self.label_remark.setFont(font)
self.label_remark.setText("")
self.label_remark.setObjectName("label_remark")
self.line = QtWidgets.QFrame(self.frame)
self.line.setGeometry(QtCore.QRect(20, 580, 800, 3))
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
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:rgb(233,233,233);\n"
"padding: 10px;\n"
"color:rgb(5,180,104);}\n"
"QPushButton:hover{\n"
"background-color:rgb(198,198,198)}")
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.horizontalLayout_2.addWidget(self.btn_sendMsg_2)
self.horizontalLayout_2.setStretch(0, 7)
self.horizontalLayout_2.setStretch(1, 2)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.verticalLayout.setStretch(0, 2)
self.verticalLayout.setStretch(1, 2)
self.verticalLayout.setStretch(2, 60)
self.verticalLayout.setStretch(3, 2)
self.verticalLayout.setStretch(4, 2)
self.verticalLayout.setStretch(5, 1)
self.horizontalLayout.addWidget(self.frame_2)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Dialog):
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.label.setText(_translate("Dialog", "TextLabel"))
self.textEdit.setHtml(_translate("Dialog", "<!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.setText(_translate("Dialog", "发送"))
self.toolButton.setText(_translate("Dialog", "..."))
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", "发送"))

View File

@ -1,315 +1,306 @@
<?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="QScrollArea" name="scrollArea">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<width>326</width>
<height>680</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>150000</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>12000</height>
</rect>
</property>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>80</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>220</x>
<y>10</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>878</width>
<height>720</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>325</width>
<height>150000</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>12000</height>
</rect>
</property>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>80</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>220</x>
<y>10</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="minimumSize">
<size>
<width>500</width>
<height>500</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: #F5F5F5;</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,2,60,2,2,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_remark_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="message_2">
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">background-color: #F5F5F5;</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit_2">
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: #F5F5F5;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot;
/&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun';
font-size:15pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br
/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
</string>
</property>
<property name="overwriteMode">
<bool>false</bool>
</property>
<property name="tabStopWidth">
<number>80</number>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
<property name="textInteractionFlags">
<set>Qt::TextEditorInteraction</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="7,2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_sendMsg_2">
<property name="font">
<font>
<family>黑体</family>
<pointsize>15</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color:rgb(233,233,233);
padding: 10px;
color:rgb(5,180,104);}
QPushButton:hover{
background-color:rgb(198,198,198)}
</string>
</property>
<property name="text">
<string>发送</string>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>321</x>
<y>0</y>
<width>801</width>
<height>720</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QTextBrowser" name="message">
<property name="geometry">
<rect>
<x>9</x>
<y>39</y>
<width>801</width>
<height>541</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">background-color: #F5F5F5;</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>9</x>
<y>579</y>
<width>821</width>
<height>141</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>15</pointsize>
</font>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun'; font-size:15pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="tabStopWidth">
<number>80</number>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
</widget>
<widget class="QPushButton" name="btn_sendMsg">
<property name="geometry">
<rect>
<x>680</x>
<y>670</y>
<width>121</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>15</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: #f0f0f0;
padding: 10px;
color:rgb(5,180,104);
}</string>
</property>
<property name="text">
<string>发送</string>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
<widget class="QToolButton" name="toolButton">
<property name="geometry">
<rect>
<x>760</x>
<y>0</y>
<width>47</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="Line" name="line_3">
<property name="geometry">
<rect>
<x>2</x>
<y>0</y>
<width>3</width>
<height>720</height>
</rect>
</property>
<property name="lineWidth">
<number>6</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>9</x>
<y>30</y>
<width>831</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_remark">
<property name="geometry">
<rect>
<x>30</x>
<y>0</y>
<width>351</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>20</x>
<y>580</y>
<width>800</width>
<height>3</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</widget>
</widget>
</widget>
<resources/>
<connections/>
<resources/>
<connections/>
</ui>

View File

@ -5,19 +5,20 @@ from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import *
QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)
from . import charts
class AnalysisController(QWidget):
def __init__(self, username):
super().__init__()
def __init__(self, username, parent=None):
super().__init__(parent)
self.ta_username = username
self.setWindowTitle('数据分析')
self.setWindowIcon(QIcon('./app/data/icon.png'))
# self.setWindowFlag(Qt.FramelessWindowHint)
# self.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
self.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
# self.setBackground()
self.resize(400, 300)
# self.resize(400, 300)
self.center()
self.setAttribute(Qt.WA_AttributeCount)
self.label_01()
@ -47,6 +48,7 @@ class AnalysisController(QWidget):
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/聊天统计/title.html'))

View File

@ -286,7 +286,8 @@ def sport(username):
.set_global_opts(
title_opts=opts.TitleOpts(title="{}".format(months[i + 1].strftime("%Y-%m"))),
# legend_opts=opts.LegendOpts(is_show=False),
yaxis_opts=opts.AxisOpts(is_inverse=True)
yaxis_opts=opts.AxisOpts(is_inverse=True),
# xaxis_opts=opts.AxisOpts(type_='time')
)
.set_series_opts(
label_opts=opts.LabelOpts(
@ -307,7 +308,8 @@ def sport(username):
)
.set_global_opts(
yaxis_opts=opts.AxisOpts(is_inverse=True)
yaxis_opts=opts.AxisOpts(is_inverse=True),
# xaxis_opts=opts.AxisOpts(type_='time')
)
.set_series_opts(
label_opts=opts.LabelOpts(

View File

@ -8,13 +8,19 @@
@comment : ···
"""
import datetime
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from .contactUi import *
from ...DataBase import data, output
from .userinfo import userinfoUi
from PyQt5.QtWidgets import *
from .analysis import analysis
from .contactUi import *
from .emotion import emotion
from .userinfo import userinfoUi
from ...DataBase import data, output
EMOTION = 1
ANALYSIS = 2
class ContactController(QWidget, Ui_Dialog):
@ -25,6 +31,8 @@ class ContactController(QWidget, Ui_Dialog):
def __init__(self, Me, parent=None):
super(ContactController, self).__init__(parent)
self.emotionView = None
self.analysisView = None
self.chatroomFlag = None
self.ta_avatar = None
self.setupUi(self)
@ -42,18 +50,32 @@ class ContactController(QWidget, Ui_Dialog):
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.userinfo = userinfoUi.Ui_Frame() # 联系人信息界面
self.userinfo.setupUi(self.frame)
self.userinfo.btn_outbut.clicked.connect(self.output)
self.userinfo.progressBar.setVisible(False)
self.userinfo.btn_analysis.clicked.connect(self.analysis)
self.now_btn = self.userinfo
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.qurl = QUrl('baidu.com')
# self.urlSignal.connect(self.hyperlink)
# self.message.setOpenLinks(False)
# self.message.setOpenExternalLinks(False)
self.lay0 = QHBoxLayout()
self.widget.setLayout(self.lay0)
self.frame = QtWidgets.QFrame()
self.frame.setObjectName("frame")
self.userinfo = userinfoUi.Ui_Frame() # 联系人信息界面
self.userinfo.setupUi(self.frame)
# self.userinfo.btn_outbut.clicked.connect(self.output)
self.userinfo.progressBar.setVisible(False)
self.lay0.addWidget(self.frame)
# self.userinfo.btn_analysis.clicked.connect(self.analysis)
def showContact(self):
"""
@ -86,6 +108,8 @@ 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)
@ -149,10 +173,70 @@ class ContactController(QWidget, Ui_Dialog):
聊天分析
:return:
"""
self.analysisView = analysis.AnalysisController(self.now_talkerId)
self.analysisView.show()
self.frame.setVisible(False)
if self.now_talkerId in self.view_analysis:
self.setViewVisible(self.now_talkerId, mod=ANALYSIS)
return 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
def emotionale_Analysis(self):
print('情感分析', data.get_conRemark(self.now_talkerId))
self.frame.setVisible(False)
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
pass
def showUserinfo(self):
self.analysisView = analysis.AnalysisController(self.now_talkerId)
self.lay0 = QHBoxLayout()
self.widget.setLayout(self.lay0)
self.lay0.addWidget(self.analysisView)
def back(self):
self.frame.setVisible(True)
self.setViewVisible(self.now_talkerId)
def setViewVisible(self, wxid: str, mod=None):
"""将wxid的视图设置为可见"""
if not self.last_analysis:
return False
if mod == EMOTION:
for key, value in self.view_emotion.items():
# 如果key==wxid则将该视图设置为可见否则不可见
if key == wxid:
print(data.get_conRemark(wxid), '视图可见')
value.setVisible(True)
else:
print(data.get_conRemark(key), '视图不可见')
value.setVisible(False)
for key, value in self.view_analysis.items():
value.setVisible(False)
elif mod == ANALYSIS:
for key, value in self.view_analysis.items():
# 如果key==wxid则将该视图设置为可见否则不可见
if key == wxid:
value.setVisible(True)
else:
value.setVisible(False)
for key, value in self.view_emotion.items():
value.setVisible(False)
else:
for key, value in self.view_analysis.items():
value.setVisible(False)
for key, value in self.view_emotion.items():
value.setVisible(False)
class Contact(QtWidgets.QPushButton):
"""
@ -235,6 +319,7 @@ class Contact(QtWidgets.QPushButton):
self.show_info(id)
def show_info(self, id):
avatar = data.get_avator(self.username)
# print(avatar)
remark = data.get_conRemark(self.username)

View File

@ -14,18 +14,25 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(1120, 720)
Dialog.resize(1141, 740)
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
Dialog.setAutoFillBackground(False)
self.horizontalLayout = QtWidgets.QHBoxLayout(Dialog)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
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.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.frame_2)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setSpacing(0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.scrollArea = QtWidgets.QScrollArea(self.frame_2)
self.scrollArea.setEnabled(True)
self.scrollArea.setGeometry(QtCore.QRect(0, 40, 326, 680))
self.scrollArea.setMaximumSize(QtCore.QSize(400, 150000))
self.scrollArea.setMinimumSize(QtCore.QSize(325, 0))
self.scrollArea.setMaximumSize(QtCore.QSize(325, 150000))
self.scrollArea.setAutoFillBackground(False)
self.scrollArea.setFrameShape(QtWidgets.QFrame.WinPanel)
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Raised)
@ -49,34 +56,43 @@ class Ui_Dialog(object):
self.label.setGeometry(QtCore.QRect(220, 10, 72, 15))
self.label.setObjectName("label")
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.horizontalLayout_2.addWidget(self.scrollArea)
self.frame = QtWidgets.QFrame(self.frame_2)
self.frame.setGeometry(QtCore.QRect(321, 0, 801, 720))
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.line_3 = QtWidgets.QFrame(self.frame)
self.line_3.setGeometry(QtCore.QRect(2, 0, 3, 720))
self.line_3.setLineWidth(6)
self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_3.setObjectName("line_3")
self.line_2 = QtWidgets.QFrame(self.frame)
self.line_2.setGeometry(QtCore.QRect(9, 30, 831, 20))
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_2.setObjectName("line_2")
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_remark = QtWidgets.QLabel(self.frame)
self.label_remark.setGeometry(QtCore.QRect(30, 0, 351, 41))
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.line = QtWidgets.QFrame(self.frame)
self.line.setGeometry(QtCore.QRect(20, 580, 800, 3))
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
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_output = QtWidgets.QPushButton(self.frame)
self.btn_output.setObjectName("btn_output")
self.horizontalLayout_3.addWidget(self.btn_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.widget = QtWidgets.QWidget(self.frame)
self.widget.setObjectName("widget")
self.verticalLayout.addWidget(self.widget)
self.verticalLayout.setStretch(0, 1)
self.verticalLayout.setStretch(1, 30)
self.horizontalLayout_2.addWidget(self.frame)
self.horizontalLayout.addWidget(self.frame_2)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
@ -85,3 +101,7 @@ 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_output.setText(_translate("Dialog", "导出聊天记录"))
self.btn_back.setText(_translate("Dialog", "退出"))

View File

@ -1,208 +1,225 @@
<?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="QScrollArea" name="scrollArea">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<width>326</width>
<height>680</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>150000</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>12000</height>
</rect>
</property>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>80</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>220</x>
<y>10</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1141</width>
<height>740</height>
</rect>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>325</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>325</width>
<height>150000</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>false</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>12000</height>
</rect>
</property>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>80</height>
</rect>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>220</x>
<y>10</y>
<width>72</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,30">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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_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="QWidget" name="widget" native="true"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>321</x>
<y>0</y>
<width>801</width>
<height>720</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="Line" name="line_3">
<property name="geometry">
<rect>
<x>2</x>
<y>0</y>
<width>3</width>
<height>720</height>
</rect>
</property>
<property name="lineWidth">
<number>6</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>9</x>
<y>30</y>
<width>831</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_remark">
<property name="geometry">
<rect>
<x>30</x>
<y>0</y>
<width>351</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>20</x>
<y>580</y>
<width>800</width>
<height>3</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</widget>
</widget>
</widget>
<resources/>
<connections/>
<resources/>
<connections/>
</ui>

View File

View File

@ -0,0 +1,19 @@
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -13,12 +13,12 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from app.DataBase import data
from . import mainwindow
from .chat import chat
from .contact import contact
from .mainviewUi import *
class MainWinController(QMainWindow, Ui_Dialog):
class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
exitSignal = pyqtSignal()
# username = ''
@ -28,10 +28,22 @@ class MainWinController(QMainWindow, Ui_Dialog):
self.setWindowTitle('WeChat')
self.setWindowIcon(QIcon('./app/data/icon.png'))
self.Me = data.get_myinfo()
self.chatView = chat.ChatController(self.Me, parent=self.frame_main)
self.setAttribute(Qt.WA_AttributeCount)
self.chatView = chat.ChatController(self.Me, parent=None)
self.chatView.setVisible(False)
self.contactView = contact.ContactController(self.Me, parent=self.frame_main)
# self.chatView.setLayout()
self.lay = QHBoxLayout()
self.frame_main.setLayout(self.lay)
self.lay.addWidget(self.chatView)
# self.frame_main.setLayout(self.chatView)
# self.frame_main.setLayout()
self.contactView = contact.ContactController(self.Me, parent=None)
self.contactView.setVisible(False)
self.lay0 = QHBoxLayout()
self.frame_main.setLayout(self.lay0)
self.lay.addWidget(self.contactView)
# self.myinfoView = userinfo.MyinfoController(self.Me, parent=self.frame_main)
# self.myinfoView.setVisible(False)
self.btn_chat.clicked.connect(self.chat_view) # 聊天按钮

View File

@ -14,61 +14,70 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(1280, 720)
Dialog.resize(1244, 738)
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
Dialog.setAutoFillBackground(False)
self.frame_main = QtWidgets.QFrame(Dialog)
self.frame_main.setGeometry(QtCore.QRect(160, 0, 1120, 720))
self.frame_main.setGeometry(QtCore.QRect(115, 9, 1120, 720))
self.frame_main.setMinimumSize(QtCore.QSize(1120, 720))
self.frame_main.setLayoutDirection(QtCore.Qt.LeftToRight)
self.frame_main.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_main.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_main.setObjectName("frame_main")
self.frame_info = QtWidgets.QFrame(Dialog)
self.frame_info.setGeometry(QtCore.QRect(0, 0, 161, 721))
self.frame_info.setGeometry(QtCore.QRect(9, 9, 100, 720))
self.frame_info.setMinimumSize(QtCore.QSize(100, 500))
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(20, 190, 111, 501))
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 190, 91, 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, 80))
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);}")
" 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, 80))
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);}")
" 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(100, 80))
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);}")
" 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(100, 80))
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);}")
" 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(30, 50, 100, 100))
self.myavatar.setGeometry(QtCore.QRect(10, 40, 80, 80))
self.myavatar.setObjectName("myavatar")
self.sign_up = QtWidgets.QPushButton(self.frame_info)
self.sign_up.setGeometry(QtCore.QRect(0, 0, 71, 28))
self.sign_up.setGeometry(QtCore.QRect(0, 0, 40, 28))
self.sign_up.setObjectName("sign_up")
self.btn_destroy = QtWidgets.QPushButton(self.frame_info)
self.btn_destroy.setGeometry(QtCore.QRect(80, 0, 71, 28))
self.btn_destroy.setGeometry(QtCore.QRect(50, 0, 40, 28))
self.btn_destroy.setObjectName("btn_destroy")
self.retranslateUi(Dialog)
@ -82,5 +91,5 @@ class Ui_Dialog(object):
self.btn_myinfo.setText(_translate("Dialog", "我的"))
self.btn_about.setText(_translate("Dialog", "关于"))
self.myavatar.setText(_translate("Dialog", "avatar"))
self.sign_up.setText(_translate("Dialog", "退出登录"))
self.btn_destroy.setText(_translate("Dialog", "注销账户"))
self.sign_up.setText(_translate("Dialog", "退出"))
self.btn_destroy.setText(_translate("Dialog", "注销"))

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>720</height>
<width>1244</width>
<height>738</height>
</rect>
</property>
<property name="cursor">
@ -22,12 +22,21 @@
<widget class="QFrame" name="frame_main">
<property name="geometry">
<rect>
<x>160</x>
<y>0</y>
<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>
@ -38,12 +47,18 @@
<widget class="QFrame" name="frame_info">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>161</width>
<height>721</height>
<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>
@ -56,13 +71,13 @@
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<x>0</x>
<y>190</y>
<width>111</width>
<height>501</height>
<width>91</width>
<height>271</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,1,0">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,1,1,1">
<property name="spacing">
<number>0</number>
</property>
@ -71,7 +86,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
<height>60</height>
</size>
</property>
<property name="styleSheet">
@ -89,7 +104,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
<height>60</height>
</size>
</property>
<property name="styleSheet">
@ -106,8 +121,8 @@
<widget class="QPushButton" name="btn_myinfo">
<property name="minimumSize">
<size>
<width>100</width>
<height>80</height>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="styleSheet">
@ -124,8 +139,8 @@
<widget class="QPushButton" name="btn_about">
<property name="minimumSize">
<size>
<width>100</width>
<height>80</height>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="styleSheet">
@ -143,10 +158,10 @@
<widget class="QLabel" name="myavatar">
<property name="geometry">
<rect>
<x>30</x>
<y>50</y>
<width>100</width>
<height>100</height>
<x>10</x>
<y>40</y>
<width>80</width>
<height>80</height>
</rect>
</property>
<property name="text">
@ -158,25 +173,25 @@
<rect>
<x>0</x>
<y>0</y>
<width>71</width>
<width>40</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>退出登录</string>
<string>退出</string>
</property>
</widget>
<widget class="QPushButton" name="btn_destroy">
<property name="geometry">
<rect>
<x>80</x>
<x>50</x>
<y>0</y>
<width>71</width>
<width>40</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>注销账户</string>
<string>注销</string>
</property>
</widget>
</widget>

251
app/Ui/mainwindow.ui Normal file
View File

@ -0,0 +1,251 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>779</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame_info">
<property name="minimumSize">
<size>
<width>100</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</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>
</item>
<item>
<widget class="QFrame" name="frame_main">
<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::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>23</height>
</rect>
</property>
<widget class="QMenu" name="menu_F">
<property name="title">
<string>文件(F)</string>
</property>
<addaction name="separator"/>
<addaction name="separator"/>
<addaction name="action_3"/>
<addaction name="action_4"/>
</widget>
<widget class="QMenu" name="menu">
<property name="title">
<string>编辑</string>
</property>
</widget>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>帮助</string>
</property>
<addaction name="action"/>
</widget>
<addaction name="menu_F"/>
<addaction name="menu"/>
<addaction name="menu_2"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="action_3">
<property name="text">
<string>保存</string>
</property>
</action>
<action name="action_4">
<property name="text">
<string>退出</string>
</property>
</action>
<action name="action">
<property name="text">
<string>关于</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

12
main.py
View File

@ -7,12 +7,16 @@ from app.Ui import *
#
class ViewController:
def __init__(self):
self.viewMainWIn = None
self.viewDecrypt = None
def loadDecryptView(self):
"""
登录界面
:return:
"""
self.viewDecrypt = decrypt.DecryptControl() # 需要将viewlogin设为成员变量
self.viewDecrypt = decrypt.DecryptControl() # 需要将view login设为成员变量
self.viewDecrypt.DecryptSignal.connect(self.loadMainWinView)
self.viewDecrypt.registerSignal.connect(self.loadRegisterView)
self.viewDecrypt.show()
@ -24,7 +28,7 @@ class ViewController:
:return:
"""
pass
# self.viewDecrypt = register.registerControl() # 需要将viewlogin设为成员变量
# self.viewDecrypt = register.registerControl() # 需要将view login设为成员变量
# self.viewDecrypt.DecryptSignal.connect(self.loadDecryptView)
# self.viewDecrypt.show()
@ -47,6 +51,6 @@ class ViewController:
if __name__ == '__main__':
app = QApplication(sys.argv)
view = ViewController()
view.loadDecryptView() # 进入登录界面如果viewlogin不是成员变量则离开作用域后失效。
# view.loadMainWinView('102')
# view.loadDecryptView() # 进入登录界面如果view login不是成员变量则离开作用域后失效。
view.loadMainWinView('102')
sys.exit(app.exec_())

149
test.html
View File

@ -1,149 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
.mobile-page .admin-reply{
box-shadow: 0px 0px 2px #ddd;
}
.mobile-page .user-msg, .mobile-page .admin-msg{
width: 75%;
position: relative;
}
</style>
</head>
<body>
<div>
<table align="right" style="vertical-align: middle;">
<tbody>
<tr>
<td style="border: 1px #000000 solid;" height="150">
<a href="%s" target="_blank">
<img herf="baidu.com" align="right" src="./app/data/image2/ff/92/ff921ad247c22e77b9da5aadf2fd8a5e.jpg
" style="max-height:100%">
</a>
</td>
<td></td>
<td rowspan="2" style="border: 1px #000000 solid">
<a href="D:\Project\Python\WeChatMsg\app\data\icon.png" target="_blank">
<img align="right" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png"
width="45" height="45"/>
</a>
</td>
<td rowspan="2">ADC</td>
</tr>
>
<tr>
<td style="background-color: #9EEA6A;right: 4px;border-radius: 4px;">
%s 13245:
</td>
<td width="55" style=""></td>
<!-- <td style="border: 1px #000000 solid"><img align="right" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png" width="45" height="45"/></td>-->
<td width="15"></td>
</tr>
</tbody>
</table>
</div>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table height="300" width="300" border="1">
<caption>我是标题</caption>
<thead>
<tr>
<th>英雄</th>
<th>性别</th>
<th>职业</th>
</tr>
</thead>
<tbody>
<tr>
<td>亚索</td>
<td></td>
<td>中单</td>
</tr>
<tr>
<td>卡莎</td>
<td></td>
<td rowspan="2">ADC</td>
</tr>
<tr>
<td>寒冰</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
<!-- <body>
<div class="mobile-page">
<div class="user-group" style="padding: 6px;
display: flex;
display: -webkit-flex;
justify-content: flex-end;
-webkit-justify-content: flex-end;
">
<div class="user-msg" style="text-align: right;
width: 75%;
position: relative;">
<span class="user-reply" style="display: inline-block;
padding: 8px;
border-radius: 4px;
margin:0 15px 12px;
text-align: left;
background-color: #9EEA6A;
box-shadow: 0px 0px 2px #bbb;
">我要抢楼</span>
<i style="width: 0;
height: 0;
position: absolute;
top: 10px;
display: inline-block;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
right: 4px;
border-left: 12px solid #9EEA6A;"></i>
</div>
<img class="user-img" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png" width="45px" height="45px";/>
</div>
<div class="admin-group">
<img class="admin-img" src="http://localhost/public/img/aa.jpg"/>
<div class="admin-msg">
<i class="triangle-admin"></i>
<span class="admin-reply">欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!</span>
</div>
</div>
<div class="user-group">
<div class="user-msg">
<span class="user-reply">我要抢楼我要抢楼我要抢楼。</span>
<i class="triangle-user"></i>
</div>
<img class="user-img" src="img/cc.jpg"/>
</div>
<div class="admin-group">
<img class="admin-img" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png"/>
<div class="admin-msg">
<i class="triangle-admin"></i>
<span class="admin-reply">欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!</span>
</div>
</div>
</div>
</body> -->
</html>

View File

@ -1,55 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<title>聊天时间</title>
<style>
<style type="text/css">
#nav {
height: 40px;
margin-top: 50px;
background-color: #690;
}
#nav ul {
list-style: none;
margin-left: 50px;
}
#nav li {
display: block;
float: left;
}
#nav a {
line-height: 40px;
display: block;
color: #fff;
text-decoration: none;
padding: 0 20px;
}
#nav a:hover {
background-color: #060;
}
#menu li {
float:left; /* 往左浮动 */
}
</style>
</head>
<body>
<div>
你好
</div>
<div>
<ul id="menu">
<li><a href="http://www.baidu.com">Baidu.Com</a></li>
<li><a href="http://www.Code52.Net">Code52.Net</a></li>
<li><a href="http://www.yahoo.com">Yahoo.com</a></li>
<li><a href="http://www.google.com" class="last">Google.com</a></li>
</ul>
</div>
</body>
</html>