2024-09-08 15:25:21 +08:00
|
|
|
import sys
|
|
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from qfluentwidgets import FluentWindow, Theme, setTheme
|
|
|
|
from qfluentwidgets import FluentIcon as FIF
|
2024-09-08 15:48:25 +08:00
|
|
|
from interface.main import MainWidget
|
|
|
|
from interface.setting import SettingWidget
|
2024-09-08 15:25:21 +08:00
|
|
|
|
|
|
|
class MainWindow(FluentWindow):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
2024-09-08 15:48:25 +08:00
|
|
|
|
2024-09-08 15:25:21 +08:00
|
|
|
self.setWindowTitle("HoYoCenter")
|
|
|
|
setTheme(Theme.DARK)
|
2024-09-08 15:48:25 +08:00
|
|
|
self.id2obj = {
|
|
|
|
"主页": [MainWidget(), FIF.HOME],
|
|
|
|
"设置": [SettingWidget(), FIF.SETTING]
|
|
|
|
}
|
2024-09-08 15:25:21 +08:00
|
|
|
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():
|
2024-09-08 15:48:25 +08:00
|
|
|
obj[0].setObjectName(name)
|
|
|
|
self.addSubInterface(obj[0], obj[1], name)
|
2024-09-08 15:25:21 +08:00
|
|
|
|
|
|
|
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()
|