修改函数

This commit is contained in:
2025-06-05 01:00:17 +08:00
parent 4517a06eff
commit 2a7873549d
4 changed files with 9 additions and 10 deletions

View File

@@ -4,10 +4,10 @@ import module.resources
from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QApplication
from ui.main import MainWindow from ui.main import MainWindow
from utils.function import is_frozen from utils.function import DEVELOPMENT_ENV
if __name__ == '__main__': if __name__ == '__main__':
if is_frozen(): if DEVELOPMENT_ENV:
import pyi_splash import pyi_splash
pyi_splash.update_text('正在启动...') pyi_splash.update_text('正在启动...')

View File

@@ -7,7 +7,7 @@ from ui.pyui.achievement_ui import AchievementWidget
from ui.pyui.defense_ui import DefenseWidget from ui.pyui.defense_ui import DefenseWidget
from ui.pyui.picker_ui import PickerWidget from ui.pyui.picker_ui import PickerWidget
from ui.pyui.test_ui import TestWidget from ui.pyui.test_ui import TestWidget
from utils.function import is_frozen from utils.function import DEVELOPMENT_ENV
class MainWindow(MSFluentWindow): class MainWindow(MSFluentWindow):
@@ -20,7 +20,7 @@ class MainWindow(MSFluentWindow):
self.achievementInterface = AchievementWidget('Achievement Interface', self) self.achievementInterface = AchievementWidget('Achievement Interface', self)
self.defenseInterface = DefenseWidget('Defense Interface', self) self.defenseInterface = DefenseWidget('Defense Interface', self)
self.aboutInterface = AboutWidget('About Interface', self) self.aboutInterface = AboutWidget('About Interface', self)
if not is_frozen(): if not DEVELOPMENT_ENV:
self.pickerInterface = PickerWidget('Picker Interface', self) self.pickerInterface = PickerWidget('Picker Interface', self)
self.testInterface = TestWidget('Test Interface', self) self.testInterface = TestWidget('Test Interface', self)
@@ -33,7 +33,7 @@ class MainWindow(MSFluentWindow):
def initNavigation(self): def initNavigation(self):
self.addSubInterface(self.achievementInterface, FluentIcon.SPEED_HIGH, '达成度') self.addSubInterface(self.achievementInterface, FluentIcon.SPEED_HIGH, '达成度')
self.addSubInterface(self.defenseInterface, FluentIcon.FEEDBACK, '答辩') self.addSubInterface(self.defenseInterface, FluentIcon.FEEDBACK, '答辩')
if not is_frozen(): if not DEVELOPMENT_ENV:
self.addSubInterface(self.pickerInterface, FluentIcon.PEOPLE, '抽答') self.addSubInterface(self.pickerInterface, FluentIcon.PEOPLE, '抽答')
self.addSubInterface(self.testInterface, FluentIcon.VIEW, '测试') self.addSubInterface(self.testInterface, FluentIcon.VIEW, '测试')
@@ -49,7 +49,7 @@ class MainWindow(MSFluentWindow):
def showEvent(self, event: QShowEvent): def showEvent(self, event: QShowEvent):
super().showEvent(event) super().showEvent(event)
if is_frozen(): if DEVELOPMENT_ENV:
import pyi_splash import pyi_splash
pyi_splash.update_text('正在加载...') pyi_splash.update_text('正在加载...')
pyi_splash.close() pyi_splash.close()

View File

@@ -3,7 +3,7 @@ from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout
from qfluentwidgets import PrimaryPushSettingCard, FluentIcon, GroupHeaderCardWidget, PushButton, ImageLabel, TitleLabel from qfluentwidgets import PrimaryPushSettingCard, FluentIcon, GroupHeaderCardWidget, PushButton, ImageLabel, TitleLabel
from ui.components.widget import Widget from ui.components.widget import Widget
from utils.function import is_frozen from utils.function import DEVELOPMENT_ENV
class AboutWidget(Widget): class AboutWidget(Widget):
@@ -19,7 +19,7 @@ class AboutWidget(Widget):
self.hBox.addWidget(self.appNameLabel, 1, Qt.AlignLeft) self.hBox.addWidget(self.appNameLabel, 1, Qt.AlignLeft)
build_time_str = '' build_time_str = ''
if is_frozen(): if DEVELOPMENT_ENV:
from build_info import BUILD_TIME from build_info import BUILD_TIME
build_time_str = f",构建时间:{BUILD_TIME}" build_time_str = f",构建时间:{BUILD_TIME}"

View File

@@ -184,5 +184,4 @@ def resource_path(relative_path: str) -> str:
return os.path.join(base_path, relative_path) return os.path.join(base_path, relative_path)
def is_frozen() -> bool: DEVELOPMENT_ENV = getattr(sys, 'frozen', False)
return getattr(sys, 'frozen', False)