From 02020a7886ce17b69b99414c854d8ba6bd880f4a Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Thu, 14 Dec 2023 22:24:35 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86ui=EF=BC=8C?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=BA=93=E9=94=99=E8=AF=AF?=
=?UTF-8?q?=E6=8F=90=E7=A4=BA=20#136?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/components/__init__.py | 1 +
app/components/bubble_message.py | 47 +-
app/components/contact_info_ui.py | 63 +-
app/components/scroll_bar.py | 48 +
app/resources/icons/annual_report.svg | 13 +-
app/resources/icons/chat.svg | 11 +-
app/resources/icons/contact.svg | 8 +-
app/resources/icons/decrypt.svg | 1 +
app/resources/icons/default_avatar.svg | 4 +-
app/resources/icons/folder.svg | 1 +
app/resources/icons/help.svg | 1 +
app/resources/icons/home.svg | 1 +
app/resources/icons/output.svg | 10 +-
app/resources/icons/resources_rc.py | 274 +-
app/resources/icons/start.svg | 1 +
app/resources/icons/tool.svg | 1 +
app/resources/icons/txt.svg | 1 +
app/resources/resource.qrc | 4 +
app/resources/resource_rc.py | 8652 +++++++++++++-----------
app/ui/Icon.py | 4 +
app/ui/chat/chat_window.py | 17 +-
app/ui/contact/contact_window.py | 14 +-
app/ui/mainview.py | 17 +-
app/ui/mainwindow.py | 5 +-
app/ui/tool/pc_decrypt/decryptUi.py | 18 +-
app/ui/tool/pc_decrypt/pc_decrypt.py | 7 +-
app/ui/tool/tool_window.py | 16 +-
27 files changed, 4955 insertions(+), 4285 deletions(-)
create mode 100644 app/components/scroll_bar.py
create mode 100644 app/resources/icons/decrypt.svg
create mode 100644 app/resources/icons/folder.svg
create mode 100644 app/resources/icons/help.svg
create mode 100644 app/resources/icons/home.svg
create mode 100644 app/resources/icons/start.svg
create mode 100644 app/resources/icons/tool.svg
create mode 100644 app/resources/icons/txt.svg
diff --git a/app/components/__init__.py b/app/components/__init__.py
index 00aed52..6d1eb7f 100644
--- a/app/components/__init__.py
+++ b/app/components/__init__.py
@@ -1 +1,2 @@
from .contact_info_ui import ContactQListWidgetItem
+from .scroll_bar import ScrollBar
diff --git a/app/components/bubble_message.py b/app/components/bubble_message.py
index 6dc3e75..b66ae3e 100644
--- a/app/components/bubble_message.py
+++ b/app/components/bubble_message.py
@@ -7,6 +7,8 @@ from PyQt5.QtGui import QPainter, QFont, QColor, QPixmap, QPolygon, QFontMetrics
from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QSizePolicy, QVBoxLayout, QSpacerItem, \
QScrollArea, QScrollBar
+from app.components.scroll_bar import ScrollBar
+
class MessageType:
Text = 1
@@ -204,51 +206,6 @@ class ScrollArea(QScrollArea):
)
-class ScrollBar(QScrollBar):
- def __init__(self):
- super().__init__()
- self.setStyleSheet(
- '''
- QScrollBar:vertical {
- border-width: 0px;
- border: none;
- background:rgba(64, 65, 79, 0);
- width:5px;
- margin: 0px 0px 0px 0px;
- }
- QScrollBar::handle:vertical {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
- stop: 0 #DDDDDD, stop: 0.5 #DDDDDD, stop:1 #aaaaff);
- min-height: 20px;
- max-height: 20px;
- margin: 0 0px 0 0px;
- border-radius: 2px;
- }
- QScrollBar::add-line:vertical {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
- stop: 0 rgba(64, 65, 79, 0), stop: 0.5 rgba(64, 65, 79, 0), stop:1 rgba(64, 65, 79, 0));
- height: 0px;
- border: none;
- subcontrol-position: bottom;
- subcontrol-origin: margin;
- }
- QScrollBar::sub-line:vertical {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
- stop: 0 rgba(64, 65, 79, 0), stop: 0.5 rgba(64, 65, 79, 0), stop:1 rgba(64, 65, 79, 0));
- height: 0 px;
- border: none;
- subcontrol-position: top;
- subcontrol-origin: margin;
- }
- QScrollBar::sub-page:vertical {
- background: rgba(64, 65, 79, 0);
- }
-
- QScrollBar::add-page:vertical {
- background: rgba(64, 65, 79, 0);
- }
- '''
- )
class ChatWidget(QWidget):
diff --git a/app/components/contact_info_ui.py b/app/components/contact_info_ui.py
index 681ed2a..ba73ea7 100644
--- a/app/components/contact_info_ui.py
+++ b/app/components/contact_info_ui.py
@@ -6,29 +6,76 @@ from PyQt5.QtWidgets import *
from .CAvatar import CAvatar
+Stylesheet = """
+QWidget{
+ background: rgb(238,244,249);
+}
+"""
+Stylesheet_hover = """
+QWidget,QLabel{
+ background: rgb(230, 235, 240);
+}
+"""
+Stylesheet_clicked = """
+QWidget,QLabel{
+ background: rgb(230, 235, 240);
+}
+"""
+
+
+class QListWidgetItemWidget(QWidget):
+ def __init__(self):
+ super().__init__()
+ self.is_selected = False
+
+ def leaveEvent(self, e): # 鼠标离开label
+ if self.is_selected:
+ return
+ self.setStyleSheet(Stylesheet)
+
+ def enterEvent(self, e): # 鼠标移入label
+ self.setStyleSheet(Stylesheet_hover)
+
# 自定义的item 继承自QListWidgetItem
class ContactQListWidgetItem(QListWidgetItem):
def __init__(self, name, url, img_bytes=None):
super().__init__()
# 自定义item中的widget 用来显示自定义的内容
- self.widget = QWidget()
+ self.widget = QListWidgetItemWidget()
# 用来显示name
- self.nameLabel = QLabel()
+ self.nameLabel = QLabel(self.widget)
self.nameLabel.setText(name)
# 用来显示avator(图像)
- self.avatorLabel = CAvatar(None, shape=CAvatar.Rectangle, size=QSize(60, 60),
+ self.avatorLabel = CAvatar(parent=self.widget, shape=CAvatar.Rectangle, size=QSize(60, 60),
url=url, img_bytes=img_bytes)
# 设置布局用来对nameLabel和avatorLabel进行布局
- self.hbox = QHBoxLayout()
- self.hbox.addWidget(self.avatorLabel)
- self.hbox.addWidget(self.nameLabel)
- self.hbox.addStretch(1)
+ hbox = QHBoxLayout()
+ hbox.addWidget(self.avatorLabel)
+ hbox.addWidget(self.nameLabel)
+ hbox.addStretch(1)
# 设置widget的布局
- self.widget.setLayout(self.hbox)
+ self.widget.setLayout(hbox)
+ self.widget.setStyleSheet(Stylesheet)
# 设置自定义的QListWidgetItem的sizeHint,不然无法显示
self.setSizeHint(self.widget.sizeHint())
+ def select(self):
+ """
+ 设置选择后的事件
+ @return:
+ """
+ self.widget.is_selected = True
+ self.widget.setStyleSheet(Stylesheet_clicked)
+
+ def dis_select(self):
+ """
+ 设置取消选择的事件
+ @return:
+ """
+ self.widget.is_selected = False
+ self.widget.setStyleSheet(Stylesheet)
+
if __name__ == "__main__":
app = QApplication(sys.argv)
diff --git a/app/components/scroll_bar.py b/app/components/scroll_bar.py
new file mode 100644
index 0000000..2994999
--- /dev/null
+++ b/app/components/scroll_bar.py
@@ -0,0 +1,48 @@
+from PyQt5.QtWidgets import QScrollBar
+
+
+class ScrollBar(QScrollBar):
+ def __init__(self):
+ super().__init__()
+ self.setStyleSheet(
+ '''
+ QScrollBar:vertical {
+ border-width: 0px;
+ border: none;
+ background:rgba(133, 135, 138, 0);
+ width:2px;
+ margin: 0px 0px 0px 0px;
+ }
+ QScrollBar::handle:vertical {
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop: 0 rgb(133, 135, 138), stop: 0.5 rgb(133, 135, 138), stop:1 rgb(133, 135, 138));
+ min-height: 20px;
+ max-height: 20px;
+ margin: 0 0px 0 0px;
+ border-radius: 2px;
+ }
+ QScrollBar::add-line:vertical {
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop: 0 rgba(133, 135, 138, 0), stop: 0.5 rgba(133, 135, 138, 0), stop:1 rgba(133, 135, 138, 0));
+ height: 0px;
+ border: none;
+ subcontrol-position: bottom;
+ subcontrol-origin: margin;
+ }
+ QScrollBar::sub-line:vertical {
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
+ stop: 0 rgba(133, 135, 138, 0), stop: 0.5 rgba(133, 135, 138, 0), stop:1 rgba(133, 135, 138, 0));
+ height: 0 px;
+ border: none;
+ subcontrol-position: top;
+ subcontrol-origin: margin;
+ }
+ QScrollBar::sub-page:vertical {
+ background: rgba(133, 135, 138, 0);
+ }
+
+ QScrollBar::add-page:vertical {
+ background: rgba(133, 135, 138, 0);
+ }
+ '''
+ )
\ No newline at end of file
diff --git a/app/resources/icons/annual_report.svg b/app/resources/icons/annual_report.svg
index ce23a10..aeaec95 100644
--- a/app/resources/icons/annual_report.svg
+++ b/app/resources/icons/annual_report.svg
@@ -1,12 +1 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/resources/icons/chat.svg b/app/resources/icons/chat.svg
index 7b78755..f319b84 100644
--- a/app/resources/icons/chat.svg
+++ b/app/resources/icons/chat.svg
@@ -1,10 +1 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/resources/icons/contact.svg b/app/resources/icons/contact.svg
index b5692c7..b8c993f 100644
--- a/app/resources/icons/contact.svg
+++ b/app/resources/icons/contact.svg
@@ -1,7 +1 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/resources/icons/decrypt.svg b/app/resources/icons/decrypt.svg
new file mode 100644
index 0000000..2b85321
--- /dev/null
+++ b/app/resources/icons/decrypt.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/resources/icons/default_avatar.svg b/app/resources/icons/default_avatar.svg
index eacfca5..5442c4e 100644
--- a/app/resources/icons/default_avatar.svg
+++ b/app/resources/icons/default_avatar.svg
@@ -1,7 +1,7 @@
-