28 lines
838 B
Python
28 lines
838 B
Python
from PySide6.QtWidgets import QMainWindow
|
|
from PySide6.QtCore import QTimer
|
|
from Ui_install import Ui_MainWindows
|
|
from animations import MultiStageAnimations
|
|
|
|
class MainWindow(QMainWindow):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
# 先初始化UI
|
|
self.ui = Ui_MainWindows()
|
|
self.ui.setupUi(self)
|
|
|
|
# 然后初始化动画系统
|
|
self.animator = MultiStageAnimations(self.ui)
|
|
|
|
# 在窗口显示前设置初始状态
|
|
self.animator.initialize()
|
|
|
|
# 窗口显示后延迟100ms启动动画
|
|
QTimer.singleShot(100, self.start_animations)
|
|
|
|
def start_animations(self):
|
|
self.animator.start_animations()
|
|
|
|
def closeEvent(self, event):
|
|
self.animator.clear_animations()
|
|
super().closeEvent(event) |