From c8194fe2d9e5b0369c88327847af27c4e5aecc42 Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Mon, 6 Nov 2023 21:00:42 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86UI?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 30 ++++++------
app/Ui/ICON.py | 2 +
app/Ui/contact/contactInfo.py | 8 ++++
app/Ui/contact/contactInfoUi.py | 31 ++++++++++--
app/Ui/contact/contactInfoUi.ui | 84 ++++++++++++++++++++++++++++++---
app/Ui/mainview.py | 4 ++
6 files changed, 134 insertions(+), 25 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8bb6ddf..c51249f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,21 +4,13 @@
-
+
-
-
-
-
-
-
+
-
-
-
-
+
@@ -73,7 +65,7 @@
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"last_opened_file_path": "D:/Program Files/Python310/Scripts/pyuic5.exe",
- "settings.editor.selected.configurable": "preferences.pluginManager"
+ "settings.editor.selected.configurable": "reference.settings.ide.settings.new.ui"
}
}
@@ -503,7 +495,14 @@
1699104087256
-
+
+ 1699190056580
+
+
+
+ 1699190056580
+
+
@@ -563,7 +562,8 @@
-
+
+
@@ -572,7 +572,7 @@
file://$PROJECT_DIR$/app/DataBase/output.py
- 412
+ 413
diff --git a/app/Ui/ICON.py b/app/Ui/ICON.py
index 524a1b5..45b3dbc 100644
--- a/app/Ui/ICON.py
+++ b/app/Ui/ICON.py
@@ -5,3 +5,5 @@ class Icon:
Default_avatar_path = './app/data/icons/default_avatar.svg'
MainWindow = QIcon('./app/data/icons/logo.svg')
Default_avatar = QIcon(Default_avatar_path)
+ Output = QIcon('./app/data/icons/output.svg')
+ Back = QIcon('./app/data/icons/back.svg')
diff --git a/app/Ui/contact/contactInfo.py b/app/Ui/contact/contactInfo.py
index 76de500..340d621 100644
--- a/app/Ui/contact/contactInfo.py
+++ b/app/Ui/contact/contactInfo.py
@@ -8,6 +8,7 @@ from .analysis import analysis
from .contactInfoUi import Ui_Form
from .emotion import emotion
from .userinfo import userinfo
+from .. import Icon
from ... import person
@@ -28,9 +29,11 @@ class ContactInfo(QWidget, Ui_Form):
self.btn_report.clicked.connect(self.annual_report)
self.btn_back.clicked.connect(self.back)
self.Me = me
+ # self.
self.init_ui()
def init_ui(self):
+ self.btn_back.setIcon(Icon.Back)
self.label_remark.setText(self.contact.conRemark)
self.stackedWidget.addWidget(self.view_userinfo)
self.stackedWidget.addWidget(self.view_analysis)
@@ -41,15 +44,20 @@ class ContactInfo(QWidget, Ui_Form):
self.toCSVAct = QAction(QIcon('app/data/icons/csv.svg'), '导出CSV', self)
self.toHtmlAct = QAction(QIcon('app/data/icons/html.svg'), '导出HTML', self)
self.toolButton_output.setPopupMode(QToolButton.MenuButtonPopup)
+ self.toolButton_output.clicked.connect(self.toolButton_show)
menu.addAction(self.toDocxAct)
menu.addAction(self.toCSVAct)
menu.addAction(self.toHtmlAct)
self.toolButton_output.setMenu(menu)
+ self.toolButton_output.setIcon(Icon.Output)
# self.toolButton_output.addSeparator()
self.toHtmlAct.triggered.connect(self.output)
self.toDocxAct.triggered.connect(self.output)
self.toCSVAct.triggered.connect(self.output)
+ def toolButton_show(self):
+ self.toolButton_output.showMenu()
+
def analysis(self):
self.stackedWidget.setCurrentWidget(self.view_analysis)
if 'room' in self.contact.wxid:
diff --git a/app/Ui/contact/contactInfoUi.py b/app/Ui/contact/contactInfoUi.py
index a47d7e5..a441126 100644
--- a/app/Ui/contact/contactInfoUi.py
+++ b/app/Ui/contact/contactInfoUi.py
@@ -16,12 +16,16 @@ class Ui_Form(object):
Form.setObjectName("Form")
Form.resize(817, 748)
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
+ self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
+ self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.frame = QtWidgets.QFrame(Form)
self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame)
+ self.verticalLayout.setContentsMargins(0, 0, 0, 0)
+ self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setSpacing(0)
@@ -35,20 +39,38 @@ class Ui_Form(object):
self.label_remark.setObjectName("label_remark")
self.horizontalLayout_3.addWidget(self.label_remark)
self.btn_analysis = QtWidgets.QPushButton(self.frame)
+ self.btn_analysis.setStyleSheet("QPushButton:hover {\n"
+ " background-color: rgb(240, 240, 240);\n"
+ "}\n"
+ "QPushButton{\n"
+ " background-color:transparent;\n"
+ "}")
+ self.btn_analysis.setFlat(True)
self.btn_analysis.setObjectName("btn_analysis")
self.horizontalLayout_3.addWidget(self.btn_analysis)
self.btn_emotion = QtWidgets.QPushButton(self.frame)
+ self.btn_emotion.setFlat(True)
self.btn_emotion.setObjectName("btn_emotion")
self.horizontalLayout_3.addWidget(self.btn_emotion)
self.btn_report = QtWidgets.QPushButton(self.frame)
+ self.btn_report.setFlat(True)
self.btn_report.setObjectName("btn_report")
self.horizontalLayout_3.addWidget(self.btn_report)
- self.toolButton_output = QtWidgets.QToolButton(self.frame)
- self.toolButton_output.setObjectName("toolButton_output")
- self.horizontalLayout_3.addWidget(self.toolButton_output)
self.btn_back = QtWidgets.QPushButton(self.frame)
+ self.btn_back.setFlat(True)
self.btn_back.setObjectName("btn_back")
self.horizontalLayout_3.addWidget(self.btn_back)
+ self.toolButton_output = QtWidgets.QToolButton(self.frame)
+ icon = QtGui.QIcon()
+ icon.addPixmap(QtGui.QPixmap("../../data/icons/output.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ self.toolButton_output.setIcon(icon)
+ self.toolButton_output.setCheckable(False)
+ self.toolButton_output.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
+ self.toolButton_output.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
+ self.toolButton_output.setAutoRaise(True)
+ self.toolButton_output.setArrowType(QtCore.Qt.NoArrow)
+ self.toolButton_output.setObjectName("toolButton_output")
+ self.horizontalLayout_3.addWidget(self.toolButton_output)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.stackedWidget = QtWidgets.QStackedWidget(self.frame)
self.stackedWidget.setObjectName("stackedWidget")
@@ -62,6 +84,7 @@ class Ui_Form(object):
self.horizontalLayout.addWidget(self.frame)
self.retranslateUi(Form)
+ self.stackedWidget.setCurrentIndex(1)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
@@ -70,5 +93,5 @@ class Ui_Form(object):
self.btn_analysis.setText(_translate("Form", "统计信息"))
self.btn_emotion.setText(_translate("Form", "情感分析"))
self.btn_report.setText(_translate("Form", "生成年度报告"))
- self.toolButton_output.setText(_translate("Form", "导出聊天记录"))
self.btn_back.setText(_translate("Form", "退出"))
+ self.toolButton_output.setText(_translate("Form", "导出聊天记录"))
diff --git a/app/Ui/contact/contactInfoUi.ui b/app/Ui/contact/contactInfoUi.ui
index ec5413d..52be0da 100644
--- a/app/Ui/contact/contactInfoUi.ui
+++ b/app/Ui/contact/contactInfoUi.ui
@@ -14,6 +14,21 @@
Form
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
@@ -23,6 +38,21 @@
QFrame::Raised
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
@@ -48,9 +78,21 @@
-
+
+ QPushButton:hover {
+ background-color: rgb(240, 240, 240);
+ }
+ QPushButton{
+ background-color:transparent;
+ }
+
+
统计信息
+
+ true
+
-
@@ -58,6 +100,9 @@
情感分析
+
+ true
+
-
@@ -65,6 +110,19 @@
生成年度报告
+
+ true
+
+
+
+ -
+
+
+ 退出
+
+
+ true
+
-
@@ -72,12 +130,26 @@
导出聊天记录
-
-
- -
-
-
- 退出
+
+
+ ../../data/icons/output.svg
+ ../../data/icons/output.svg
+
+
+
+ false
+
+
+ QToolButton::MenuButtonPopup
+
+
+ Qt::ToolButtonTextBesideIcon
+
+
+ true
+
+
+ Qt::NoArrow
diff --git a/app/Ui/mainview.py b/app/Ui/mainview.py
index 00ea144..abd9842 100644
--- a/app/Ui/mainview.py
+++ b/app/Ui/mainview.py
@@ -50,8 +50,12 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
self.last_btn = None
self.lastView = None
self.show_avatar()
+ self.init_ui()
# 创建右键菜单函数
+ def init_ui(self):
+ self.menubar.setStyleSheet("background-color: rgb(240, 240, 240);")
+
def create_rightmenu(self):
# 菜单对象
self.groupBox_menu = QMenu(self)