初步搭建框架

This commit is contained in:
moyanj 2024-09-08 15:25:21 +08:00
parent fa40032199
commit 2a4ab55fc5
3 changed files with 59 additions and 0 deletions

13
Pipfile Normal file
View File

@ -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"

11
interface/main.py Normal file
View File

@ -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)

35
main.py Normal file
View File

@ -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()