From 20b4b913664da5f9eba4d2e7380a7d7a1d03ba92 Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Sun, 12 Nov 2023 13:15:47 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E8=88=AA=E6=8C=89?=
=?UTF-8?q?=E9=92=AE=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 27 ++++++++++++------
app/Ui/MyComponents/prompt_bar.py | 39 ++++++++++++++++++++++++++
app/Ui/mainview.py | 24 +++++++++++-----
app/Ui/mainwindow.py | 38 +++++++++++++++++--------
app/Ui/mainwindow.ui | 46 +++++++++++++++++++++++--------
app/config.py | 2 ++
readme.md | 8 +++---
7 files changed, 142 insertions(+), 42 deletions(-)
create mode 100644 app/Ui/MyComponents/prompt_bar.py
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ffeee82..55ddfbf 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,15 +4,14 @@
-
+
+
-
-
-
-
+
+
@@ -542,7 +541,14 @@
1699700323644
-
+
+ 1699702527136
+
+
+
+ 1699702527136
+
+
@@ -590,7 +596,6 @@
-
@@ -603,7 +608,8 @@
-
+
+
@@ -620,6 +626,11 @@
22
+
+ file://$PROJECT_DIR$/app/Ui/mainview.py
+ 10
+
+
diff --git a/app/Ui/MyComponents/prompt_bar.py b/app/Ui/MyComponents/prompt_bar.py
new file mode 100644
index 0000000..df99b1f
--- /dev/null
+++ b/app/Ui/MyComponents/prompt_bar.py
@@ -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)
diff --git a/app/Ui/mainview.py b/app/Ui/mainview.py
index 10890c2..2b37d90 100644
--- a/app/Ui/mainview.py
+++ b/app/Ui/mainview.py
@@ -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"
)
diff --git a/app/Ui/mainwindow.py b/app/Ui/mainwindow.py
index f3b9f60..b335a05 100644
--- a/app/Ui/mainwindow.py
+++ b/app/Ui/mainwindow.py
@@ -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)
diff --git a/app/Ui/mainwindow.ui b/app/Ui/mainwindow.ui
index 3bd55a6..208e7db 100644
--- a/app/Ui/mainwindow.ui
+++ b/app/Ui/mainwindow.ui
@@ -13,6 +13,16 @@
MainWindow
+
+ QPushButton {
+ background-color: rgb(240,240,240);
+ border:none;
+ }
+ QPushButton:hover{
+ background-color: rgb(209,209,209);
+ }
+
+
@@ -80,16 +90,25 @@
- QPushButton {background-color: rgb(240,240,240);}
+ QPushButton {
+ background-color: rgb(240,240,240);
+ border:none;
+ }
QPushButton:hover{background-color: rgb(209,209,209);}
聊天
-
+
true
+
+ false
+
+
+ false
+
-
@@ -106,16 +125,24 @@
- QPushButton {background-color: rgb(240,240,240);}
- QPushButton:hover{background-color: rgb(209,209,209);}
+ QPushButton {
+ background-color: rgb(240,240,240);
+ border:none;
+ }
+ QPushButton:hover{
+ background-color: rgb(209,209,209);
+ }
好友
-
+
true
+
+ false
+
-
@@ -131,16 +158,11 @@
微软雅黑
-
- QPushButton {background-color: rgb(240,240,240);}
- QPushButton:hover{background-color: rgb(209,209,209);}
-
-
我的
- true
+ false
@@ -166,7 +188,7 @@
关于
- true
+ false
diff --git a/app/config.py b/app/config.py
index e69de29..4505531 100644
--- a/app/config.py
+++ b/app/config.py
@@ -0,0 +1,2 @@
+version = '0.1.1'
+contact = '474379264'
diff --git a/readme.md b/readme.md
index 7e6deb7..3069bc7 100644
--- a/readme.md
+++ b/readme.md
@@ -28,7 +28,7 @@
为了方便大家交流,我新建了一个QQ群💬:**474379264**
-大家有任何诉求或bug可以群里反馈给我
+大家有任何想法、建议或bug可以群里反馈给我
@@ -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)
\ No newline at end of file