From 2a4ab55fc59197c48e6cee12c961da0e31700fcb Mon Sep 17 00:00:00 2001 From: moyanj <1561515308@qq.com> Date: Sun, 8 Sep 2024 15:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E6=90=AD=E5=BB=BA=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pipfile | 13 +++++++++++++ interface/main.py | 11 +++++++++++ main.py | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 Pipfile create mode 100644 interface/main.py create mode 100644 main.py diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..ee75b64 --- /dev/null +++ b/Pipfile @@ -0,0 +1,13 @@ +[[source]] +url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +verify_ssl = true +name = "pip_conf_index_global" + +[packages] +pyqt5 = "*" +pyqt-fluent-widgets = {extras = ["full"], version = "*"} + +[dev-packages] + +[requires] +python_version = "3.11" diff --git a/interface/main.py b/interface/main.py new file mode 100644 index 0000000..cba95d2 --- /dev/null +++ b/interface/main.py @@ -0,0 +1,11 @@ +from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget + +class MainWidget(QWidget): + def __init__(self, title="主页"): + super().__init__() + self.name = "11" + layout = QVBoxLayout() + button = QPushButton(title) + layout.addWidget(button) + self.setLayout(layout) + self.setWindowTitle(title) \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..3400376 --- /dev/null +++ b/main.py @@ -0,0 +1,35 @@ +import sys +from PyQt5.QtWidgets import QApplication +from qfluentwidgets import FluentWindow, Theme, setTheme +from interface.main import MainWidget +from qfluentwidgets import FluentIcon as FIF + +class MainWindow(FluentWindow): + def __init__(self): + super().__init__() + self.setWindowTitle("HoYoCenter") + setTheme(Theme.DARK) + self.id2obj = {"main": MainWidget()} + self.init_ui() + + def init_ui(self): + self.init_menu() + + def init_menu(self): + self.navigationInterface.setExpandWidth(150) + for name, obj in self.id2obj.items(): + obj.setObjectName(name) + self.addSubInterface(obj, FIF.HOME, name) + +def create_app(): + app = QApplication(sys.argv) + window = MainWindow() + window.show() + return app + +def main(): + app = create_app() + sys.exit(app.exec_()) + +if __name__ == '__main__': + main() \ No newline at end of file