Skip to content

Commit

Permalink
Merge pull request #77 from XCWQW1/dev
Browse files Browse the repository at this point in the history
合并到主分支
  • Loading branch information
XCWQW1 authored Dec 16, 2024
2 parents d36e26e + 49caaf4 commit cb9c4c7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
pull_request:
branches:
- dev
- main

env:
PYTHON_VERSION: '3.11'
Expand Down
38 changes: 26 additions & 12 deletions app/view/main_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import os
import re

from PyQt5.QtCore import pyqtSignal, Qt
from PyQt5.QtCore import pyqtSignal, Qt, QSize
from PyQt5.QtGui import QColor, QIcon
from PyQt5.QtWidgets import QWidget, QHBoxLayout
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QApplication
from qfluentwidgets import Theme, qconfig, NavigationItemPosition, FluentWindow, SubtitleLabel, setFont, InfoBar, \
InfoBarPosition
InfoBarPosition, SplashScreen
from qfluentwidgets import FluentIcon as FIF

from app.config import cfg, base_path, config_path
Expand Down Expand Up @@ -39,24 +39,26 @@ class MainWindow(FluentWindow):
def __init__(self):
super().__init__()

self.initWindow()

self.file_list = GlobalsVal.ddnet_folder

# 加载配置文件
self.load_config_files()

# 初始化子界面
self.homeInterface = HomeInterface()
self.PlayerPointInterface = PlayerPointInterface()
self.CFGInterface = CFGInterface()
self.ResourceInterface = ResourceInterface()
self.ResourceDownloadInterface = ResourceDownloadInterface()
self.ServerListMirrorInterface = ServerListInterface()
self.ServerListPreviewInterface = None
self.settingInterface = SettingInterface(self.themeChane)
self.homeInterface = HomeInterface(self)
self.PlayerPointInterface = PlayerPointInterface(self)
self.CFGInterface = CFGInterface(self)
self.ResourceInterface = ResourceInterface(self)
self.ResourceDownloadInterface = ResourceDownloadInterface(self)
self.ServerListMirrorInterface = ServerListInterface(self)
# self.ServerListPreviewInterface = None
self.settingInterface = SettingInterface(self.themeChane, self)

self.initWindow()
self.initNavigation()
self.themeChane.connect(self.__theme_change)
self.splashScreen.finish()


def load_config_files(self):
Expand Down Expand Up @@ -155,6 +157,18 @@ def initWindow(self):
self.setWindowTitle('DDNetToolBox')
self.setMicaEffectEnabled(False) # 关闭win11的云母特效

# 显示加载窗口
self.splashScreen = SplashScreen(QIcon(base_path + f'/resource/logo.ico'), self)
self.splashScreen.setIconSize(QSize(106, 106))
self.splashScreen.raise_()

# 居中显示
desktop = QApplication.desktop().availableGeometry()
w, h = desktop.width(), desktop.height()
self.move(w//2 - self.width()//2, h//2 - self.height()//2)
self.show()
QApplication.processEvents()

def __theme_change(self, theme: Theme):
theme = qconfig.theme if theme == Theme.AUTO else theme
self.setWindowIcon(QIcon(base_path + f'/resource/{theme.value.lower()}/logo.png'))
4 changes: 2 additions & 2 deletions app/view/player_point_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def on_data_loaded(self, json_data: dict):


class PlayerPointInterface(QWidget):
def __init__(self):
super().__init__()
def __init__(self, parent=None):
super().__init__(parent=parent)
self.setObjectName('PlayerPointInterface')

self.vBoxLayout = QVBoxLayout(self)
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import time
import traceback

from qfluentwidgets import FluentTranslator
Expand Down Expand Up @@ -77,8 +78,8 @@ def init_window():
app.installTranslator(CrashTranslator)

GlobalsVal.main_window = MainWindow()

GlobalsVal.main_window.show()

app.exec_()


Expand Down

0 comments on commit cb9c4c7

Please sign in to comment.