mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-14 05:21:41 +08:00
增加导航按钮效果
This commit is contained in:
parent
531fda20d5
commit
20b4b91366
@ -4,15 +4,14 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="上传html模板">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="增加几个图标">
|
||||
<change afterPath="$PROJECT_DIR$/app/Ui/MyComponents/prompt_bar.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/contact/contactInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainview.py" 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/data/html/1.html" beforeDir="false" afterPath="$PROJECT_DIR$/app/data/html/1.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/data/html/2.html" beforeDir="false" afterPath="$PROJECT_DIR$/app/data/html/2.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/config.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/config.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -542,7 +541,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699700323644</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="49" />
|
||||
<task id="LOCAL-00049" summary="增加几个图标">
|
||||
<created>1699702527136</created>
|
||||
<option name="number" value="00049" />
|
||||
<option name="presentableId" value="LOCAL-00049" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699702527136</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="50" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -590,7 +596,6 @@
|
||||
<MESSAGE value="match语法说明" />
|
||||
<MESSAGE value="增加群二维码" />
|
||||
<MESSAGE value="支持导出csv格式聊天记录" />
|
||||
<MESSAGE value="增加几个图标" />
|
||||
<MESSAGE value="重构一些class,删除一些不必要的文件" />
|
||||
<MESSAGE value="用stackedWidget实现导航栏" />
|
||||
<MESSAGE value="修复部分bug" />
|
||||
@ -603,7 +608,8 @@
|
||||
<MESSAGE value="修改导入路径,方便打包成exe" />
|
||||
<MESSAGE value="修改部分UI" />
|
||||
<MESSAGE value="上传html模板" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="上传html模板" />
|
||||
<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>
|
||||
@ -620,6 +626,11 @@
|
||||
<line>22</line>
|
||||
<option name="timeStamp" value="8" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/app/Ui/mainview.py</url>
|
||||
<line>10</line>
|
||||
<option name="timeStamp" value="12" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
<default-breakpoints>
|
||||
<breakpoint type="python-exception">
|
||||
|
39
app/Ui/MyComponents/prompt_bar.py
Normal file
39
app/Ui/MyComponents/prompt_bar.py
Normal file
@ -0,0 +1,39 @@
|
||||
from PyQt5 import QtGui
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
|
||||
class PromptBar(QLabel):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
def paintEvent(self, e): # 绘图事件
|
||||
qp = QPainter()
|
||||
qp.begin(self)
|
||||
self.drawRectangles1(qp) # 绘制线条矩形
|
||||
self.drawRectangles2(qp) # 绘制填充矩形
|
||||
self.drawRectangles3(qp) # 绘制线条+填充矩形
|
||||
self.drawRectangles4(qp) # 绘制线条矩形2
|
||||
qp.end()
|
||||
|
||||
def drawRectangles1(self, qp): # 绘制填充矩形
|
||||
qp.setPen(QPen(Qt.black, 2, Qt.SolidLine)) # 颜色、线宽、线性
|
||||
qp.drawRect(*self.data)
|
||||
|
||||
def drawRectangles2(self, qp): # 绘制填充矩形
|
||||
qp.setPen(QPen(Qt.black, 2, Qt.NoPen))
|
||||
qp.setBrush(QColor(200, 0, 0))
|
||||
qp.drawRect(220, 15, 200, 100)
|
||||
|
||||
def drawRectangles3(self, qp): # 绘制线条+填充矩形
|
||||
qp.setPen(QPen(Qt.black, 2, Qt.SolidLine))
|
||||
qp.setBrush(QColor(200, 0, 0))
|
||||
qp.drawRect(430, 15, 200, 100)
|
||||
|
||||
def drawRectangles4(self, qp): # 绘制线条矩形2
|
||||
path = QtGui.QPainterPath()
|
||||
qp.setPen(QPen(Qt.blue, 2, Qt.SolidLine))
|
||||
qp.setBrush(QColor(0, 0, 0, 0)) # 设置画刷颜色透明
|
||||
path.addRect(100, 200, 200, 100)
|
||||
qp.drawPath(path)
|
@ -12,10 +12,11 @@ from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
from app import person
|
||||
from app import person, config
|
||||
from app.DataBase import *
|
||||
from app.Ui import mainwindow
|
||||
from app.Ui.Icon import Icon
|
||||
from app.Ui.MyComponents.prompt_bar import PromptBar
|
||||
from app.Ui.chat import chat
|
||||
from app.Ui.contact import contact
|
||||
|
||||
@ -58,6 +59,8 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.init_ui()
|
||||
self.menubar.setVisible(False)
|
||||
self.statusbar.setVisible(False)
|
||||
self.prompt_bar = PromptBar(self)
|
||||
self.chat_view()
|
||||
# self.state_lable = QLabel(self)
|
||||
# self.state_lable.raise_()
|
||||
# pixmap = QPixmap('./app/data/icons/default_avatar.svg').scaled(32, 32) # 按指定路径找到图片
|
||||
@ -96,10 +99,15 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
"""
|
||||
self.now_btn = self.btn_chat
|
||||
self.now_btn.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}")
|
||||
"QPushButton {background-color: rgb(198,198,198);border:none;}")
|
||||
if self.last_btn and self.last_btn != self.now_btn:
|
||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||
self.last_btn.setStyleSheet(
|
||||
"QPushButton {"
|
||||
"background-color: rgb(240,240,240);"
|
||||
"border:none;"
|
||||
"}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
self.last_btn = self.btn_chat
|
||||
# self.state_lable.setGeometry(20, 300, 32, 32)
|
||||
self.stackedWidget.setCurrentIndex(0)
|
||||
@ -111,9 +119,9 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
"""
|
||||
self.now_btn = self.btn_contact
|
||||
self.now_btn.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}")
|
||||
"QPushButton {background-color: rgb(198,198,198);border:none;}")
|
||||
if self.last_btn and self.last_btn != self.now_btn:
|
||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);border:none;}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||
self.last_btn = self.btn_contact
|
||||
# geometry = self.btn_chat.geometry()
|
||||
@ -137,5 +145,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
关于
|
||||
"""
|
||||
QMessageBox.about(self, "关于",
|
||||
"关于作者\n姓名:周帅康\n邮箱:lc863854@mail.nwpu.edu.cn"
|
||||
f"版本:{config.version}\n"
|
||||
f"QQ交流群:{config.contact}\n"
|
||||
"地址:https://github.com/LC044/WeChatMsg"
|
||||
)
|
||||
|
@ -15,6 +15,14 @@ class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1280, 779)
|
||||
MainWindow.setStyleSheet("QPushButton {\n"
|
||||
"background-color: rgb(240,240,240);\n"
|
||||
"border:none;\n"
|
||||
"}\n"
|
||||
"QPushButton:hover{\n"
|
||||
"background-color: rgb(209,209,209);\n"
|
||||
"}\n"
|
||||
" ")
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
|
||||
@ -40,10 +48,15 @@ class Ui_MainWindow(object):
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("微软雅黑")
|
||||
self.btn_chat.setFont(font)
|
||||
self.btn_chat.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
self.btn_chat.setStyleSheet("QPushButton {\n"
|
||||
"background-color: rgb(240,240,240);\n"
|
||||
"border:none;\n"
|
||||
"}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
" ")
|
||||
self.btn_chat.setFlat(True)
|
||||
self.btn_chat.setAutoDefault(True)
|
||||
self.btn_chat.setDefault(False)
|
||||
self.btn_chat.setFlat(False)
|
||||
self.btn_chat.setObjectName("btn_chat")
|
||||
self.verticalLayout_2.addWidget(self.btn_chat)
|
||||
self.btn_contact = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
@ -51,10 +64,16 @@ class Ui_MainWindow(object):
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("微软雅黑")
|
||||
self.btn_contact.setFont(font)
|
||||
self.btn_contact.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
self.btn_contact.setStyleSheet("QPushButton {\n"
|
||||
"background-color: rgb(240,240,240);\n"
|
||||
"border:none;\n"
|
||||
"}\n"
|
||||
"QPushButton:hover{\n"
|
||||
"background-color: rgb(209,209,209);\n"
|
||||
"}\n"
|
||||
" ")
|
||||
self.btn_contact.setFlat(True)
|
||||
self.btn_contact.setDefault(True)
|
||||
self.btn_contact.setFlat(False)
|
||||
self.btn_contact.setObjectName("btn_contact")
|
||||
self.verticalLayout_2.addWidget(self.btn_contact)
|
||||
self.btn_myinfo = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
@ -62,10 +81,7 @@ class Ui_MainWindow(object):
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("微软雅黑")
|
||||
self.btn_myinfo.setFont(font)
|
||||
self.btn_myinfo.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
" ")
|
||||
self.btn_myinfo.setFlat(True)
|
||||
self.btn_myinfo.setFlat(False)
|
||||
self.btn_myinfo.setObjectName("btn_myinfo")
|
||||
self.verticalLayout_2.addWidget(self.btn_myinfo)
|
||||
self.btn_about = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
@ -76,7 +92,7 @@ class Ui_MainWindow(object):
|
||||
self.btn_about.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
" QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
" ")
|
||||
self.btn_about.setFlat(True)
|
||||
self.btn_about.setFlat(False)
|
||||
self.btn_about.setObjectName("btn_about")
|
||||
self.verticalLayout_2.addWidget(self.btn_about)
|
||||
self.verticalLayout_2.setStretch(0, 1)
|
||||
|
@ -13,6 +13,16 @@
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
background-color: rgb(240,240,240);
|
||||
border:none;
|
||||
}
|
||||
QPushButton:hover{
|
||||
background-color: rgb(209,209,209);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
@ -80,16 +90,25 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
<string notr="true">QPushButton {
|
||||
background-color: rgb(240,240,240);
|
||||
border:none;
|
||||
}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>聊天</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -106,16 +125,24 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}
|
||||
<string notr="true">QPushButton {
|
||||
background-color: rgb(240,240,240);
|
||||
border:none;
|
||||
}
|
||||
QPushButton:hover{
|
||||
background-color: rgb(209,209,209);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>好友</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -131,16 +158,11 @@
|
||||
<family>微软雅黑</family>
|
||||
</font>
|
||||
</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>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -166,7 +188,7 @@
|
||||
<string>关于</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -0,0 +1,2 @@
|
||||
version = '0.1.1'
|
||||
contact = '474379264'
|
@ -28,7 +28,7 @@
|
||||
|
||||
为了方便大家交流,我新建了一个QQ群💬:**474379264**
|
||||
|
||||
大家有任何诉求或bug可以群里反馈给我
|
||||
大家有任何想法、建议或bug可以群里反馈给我
|
||||
|
||||
<img src="doc/images/qq.jpg" height=480/>
|
||||
|
||||
@ -58,11 +58,11 @@
|
||||
- **上面这两个文件就可以**
|
||||
2. 安装依赖库
|
||||
|
||||
python版本3.10
|
||||
python版本>=3.10
|
||||
|
||||
**说明:用到了python3.10的match语法,不方便更换python版本的小伙伴可以把match(运行报错的地方)更改为if else**
|
||||
|
||||
命令行运行以下代码
|
||||
命令行运行以下代码(**建议使用Pycharm打开项目,Pycharm会自动配置好所有东西,直接运行main.py即可**)
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
@ -104,6 +104,6 @@ python main.py
|
||||
|
||||
---
|
||||
|
||||
> 说明:该项目仅可用于交流学习,禁止任何非法用途,本人不承担任何责任🙄
|
||||
> 说明:该项目仅可用于交流学习,禁止任何非法用途,创作者不承担任何责任🙄
|
||||
|
||||
[![Star History Chart](https://api.star-history.com/svg?repos=LC044/WeChatMsg&type=Date)](https://star-history.com/?utm_source=bestxtools.com#LC044/WeChatMsg&Date)
|
Loading…
Reference in New Issue
Block a user