From 6d0cec7072b123e2f68bdb18160bb4c238ae7f41 Mon Sep 17 00:00:00 2001 From: wuyuesong <1377030423@qq.com> Date: Tue, 29 Oct 2024 00:09:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/share/aiassistant/SettingPage.py | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 usr/share/aiassistant/SettingPage.py diff --git a/usr/share/aiassistant/SettingPage.py b/usr/share/aiassistant/SettingPage.py new file mode 100644 index 00000000..63cda1cf --- /dev/null +++ b/usr/share/aiassistant/SettingPage.py @@ -0,0 +1,59 @@ +from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QFrame +from PyQt5.QtCore import Qt, QSize +from PyQt5.QtGui import QIcon + +from ApikeyConfigPage import ApiKeyConfigPage +from Config import Config + + +class SettingsPage(QWidget): + def __init__(self, parent=None): + super(SettingsPage, self).__init__(parent) + self.moving = False + self.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint) + self.resize(450, 330) + main_layout = QVBoxLayout(self) + + # 顶部栏 + top_bar = self.create_top_bar() + main_layout.addLayout(top_bar) + + #横线 + separator_line = QFrame() + separator_line.setFrameShape(QFrame.HLine) + separator_line.setFrameShadow(QFrame.Plain) + separator_line.setStyleSheet("color:lightgray;") + main_layout.addWidget(separator_line) + + def create_top_bar(self): + top_bar_layout = QHBoxLayout() + + title_label = QLabel("设置") + title_label.setStyleSheet("font-size: 18px; color: black;") + + close_btn = QPushButton() + close_btn.setFixedSize(24, 24) + close_btn.setStyleSheet( + ''' + QPushButton{background-color:transparent;border:none;color:white;} + ''' + ) + + close_btn.setIcon(QIcon('./data/close.png')) + close_btn.setIconSize(QSize(24, 24)); + close_btn.clicked.connect(self.close) + close_btn.setFixedSize(24, 24) + + top_bar_layout.addWidget(title_label) + top_bar_layout.addStretch(1) + top_bar_layout.addWidget(close_btn) + + return top_bar_layout + +if __name__ == "__main__": + import sys + from PyQt5.QtWidgets import QApplication + app = QApplication(sys.argv) + settings_page = SettingsPage() + settings_page.show() + sys.exit(app.exec_()) -- Gitee