修改部分UI

This commit is contained in:
shuaikangzhou 2023-11-06 21:00:42 +08:00
parent 751d9cb1a9
commit c8194fe2d9
6 changed files with 134 additions and 25 deletions

View File

@ -4,21 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="用stackWidget重写contactUI">
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改联系人视图架构">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/DataBase/output.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/output.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/ICON.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/ICON.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/MyComponents/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/MyComponents/Button_Contact.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/MyComponents/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/MyComponents/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/chat/chat.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/chat/chat.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contact.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactUi.ui" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.ui" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/person.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/person.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainview.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -73,7 +65,7 @@
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/Program Files/Python310/Scripts/pyuic5.exe&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;
&quot;settings.editor.selected.configurable&quot;: &quot;reference.settings.ide.settings.new.ui&quot;
}
}</component>
<component name="RecentsManager">
@ -503,7 +495,14 @@
<option name="project" value="LOCAL" />
<updated>1699104087256</updated>
</task>
<option name="localTasksCounter" value="43" />
<task id="LOCAL-00043" summary="修改联系人视图架构">
<created>1699190056580</created>
<option name="number" value="00043" />
<option name="presentableId" value="LOCAL-00043" />
<option name="project" value="LOCAL" />
<updated>1699190056580</updated>
</task>
<option name="localTasksCounter" value="44" />
<servers />
</component>
<component name="UnknownFeatures">
@ -563,7 +562,8 @@
<MESSAGE value="增加中文路径提示" />
<MESSAGE value="update readme" />
<MESSAGE value="用stackWidget重写contactUI" />
<option name="LAST_COMMIT_MESSAGE" value="用stackWidget重写contactUI" />
<MESSAGE value="修改联系人视图架构" />
<option name="LAST_COMMIT_MESSAGE" value="修改联系人视图架构" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
</component>
@ -572,7 +572,7 @@
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/app/DataBase/output.py</url>
<line>412</line>
<line>413</line>
<option name="timeStamp" value="7" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">

View File

@ -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')

View File

@ -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:

View File

@ -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", "导出聊天记录"))

View File

@ -14,6 +14,21 @@
<string>Form</string>
</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">
<property name="frameShape">
@ -23,6 +38,21 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
@ -48,9 +78,21 @@
</item>
<item>
<widget class="QPushButton" name="btn_analysis">
<property name="styleSheet">
<string notr="true">QPushButton:hover {
background-color: rgb(240, 240, 240);
}
QPushButton{
background-color:transparent;
}
</string>
</property>
<property name="text">
<string>统计信息</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -58,6 +100,9 @@
<property name="text">
<string>情感分析</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -65,6 +110,19 @@
<property name="text">
<string>生成年度报告</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_back">
<property name="text">
<string>退出</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -72,12 +130,26 @@
<property name="text">
<string>导出聊天记录</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_back">
<property name="text">
<string>退出</string>
<property name="icon">
<iconset>
<normaloff>../../data/icons/output.svg</normaloff>
../../data/icons/output.svg
</iconset>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
</widget>
</item>

View File

@ -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)