diff --git a/IMG/1920XCDK1893.jpeg b/IMG/1920XCDK1893.jpeg deleted file mode 100644 index fdc4a8d..0000000 Binary files a/IMG/1920XCDK1893.jpeg and /dev/null differ diff --git a/IMG/5kXCDK1893.jpeg b/IMG/5kXCDK1893.jpeg deleted file mode 100644 index 3284c4a..0000000 Binary files a/IMG/5kXCDK1893.jpeg and /dev/null differ diff --git a/IMG/BG/bg1.jpg b/IMG/BG/bg1.jpg index c4deecb..9dbe5b5 100755 Binary files a/IMG/BG/bg1.jpg and b/IMG/BG/bg1.jpg differ diff --git a/IMG/BG/bg3.jpg b/IMG/BG/bg3.jpg new file mode 100644 index 0000000..2acb228 Binary files /dev/null and b/IMG/BG/bg3.jpg differ diff --git a/IMG/BG/bg4.jpg b/IMG/BG/bg4.jpg new file mode 100644 index 0000000..dbed973 Binary files /dev/null and b/IMG/BG/bg4.jpg differ diff --git a/IMG/BG/menubg.jpg b/IMG/BG/menubg.jpg new file mode 100644 index 0000000..9cde541 Binary files /dev/null and b/IMG/BG/menubg.jpg differ diff --git a/IMG/BTH/exit.bmp b/IMG/BTH/exit.bmp new file mode 100644 index 0000000..93303e3 Binary files /dev/null and b/IMG/BTH/exit.bmp differ diff --git a/IMG/BTH/start_install.bmp b/IMG/BTH/start_install.bmp new file mode 100644 index 0000000..b9b7404 Binary files /dev/null and b/IMG/BTH/start_install.bmp differ diff --git a/Ui_install.py b/Ui_install.py index e26be64..6ac53b5 100644 --- a/Ui_install.py +++ b/Ui_install.py @@ -17,7 +17,7 @@ from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient, QPainter, QPalette, QPixmap, QRadialGradient, QTransform) from PySide6.QtWidgets import (QApplication, QLabel, QMainWindow, QMenu, - QMenuBar, QSizePolicy, QWidget) + QMenuBar, QPushButton, QSizePolicy, QWidget) class Ui_MainWindows(object): def setupUi(self, MainWindows): @@ -40,37 +40,81 @@ class Ui_MainWindows(object): self.centralwidget = QWidget(MainWindows) self.centralwidget.setObjectName(u"centralwidget") self.centralwidget.setAutoFillBackground(True) - self.MainBg = QLabel(self.centralwidget) - self.MainBg.setObjectName(u"MainBg") - self.MainBg.setGeometry(QRect(0, 0, 1031, 561)) - self.MainBg.setPixmap(QPixmap(u"IMG/BG/bg2.jpg")) - self.MainBg.setScaledContents(True) + self.loadbg = QLabel(self.centralwidget) + self.loadbg.setObjectName(u"loadbg") + self.loadbg.setGeometry(QRect(0, 0, 1031, 561)) + self.loadbg.setPixmap(QPixmap(u"IMG/BG/bg2.jpg")) + self.loadbg.setScaledContents(True) self.vol1bg = QLabel(self.centralwidget) self.vol1bg.setObjectName(u"vol1bg") - self.vol1bg.setGeometry(QRect(0, 250, 93, 64)) + self.vol1bg.setGeometry(QRect(0, 120, 93, 64)) self.vol1bg.setPixmap(QPixmap(u"IMG/LOGO/vo01_logo.png")) self.vol1bg.setScaledContents(True) self.vol2bg = QLabel(self.centralwidget) self.vol2bg.setObjectName(u"vol2bg") - self.vol2bg.setGeometry(QRect(0, 310, 93, 64)) + self.vol2bg.setGeometry(QRect(0, 180, 93, 64)) self.vol2bg.setPixmap(QPixmap(u"IMG/LOGO/vo02_logo.png")) self.vol2bg.setScaledContents(True) self.vol3bg = QLabel(self.centralwidget) self.vol3bg.setObjectName(u"vol3bg") - self.vol3bg.setGeometry(QRect(0, 370, 93, 64)) + self.vol3bg.setGeometry(QRect(0, 240, 93, 64)) self.vol3bg.setPixmap(QPixmap(u"IMG/LOGO/vo03_logo.png")) self.vol3bg.setScaledContents(True) self.vol4bg = QLabel(self.centralwidget) self.vol4bg.setObjectName(u"vol4bg") - self.vol4bg.setGeometry(QRect(0, 430, 93, 64)) + self.vol4bg.setGeometry(QRect(0, 300, 93, 64)) self.vol4bg.setPixmap(QPixmap(u"IMG/LOGO/vo04_logo.png")) self.vol4bg.setScaledContents(True) self.afterbg = QLabel(self.centralwidget) self.afterbg.setObjectName(u"afterbg") - self.afterbg.setGeometry(QRect(0, 490, 93, 64)) + self.afterbg.setGeometry(QRect(0, 360, 93, 64)) self.afterbg.setPixmap(QPixmap(u"IMG/LOGO/voaf_logo.png")) self.afterbg.setScaledContents(True) + self.Mainbg = QLabel(self.centralwidget) + self.Mainbg.setObjectName(u"Mainbg") + self.Mainbg.setGeometry(QRect(0, 0, 1031, 561)) + self.Mainbg.setPixmap(QPixmap(u"IMG/BG/bg3.jpg")) + self.Mainbg.setScaledContents(True) + self.pushButton = QPushButton(self.centralwidget) + self.pushButton.setObjectName(u"pushButton") + self.pushButton.setEnabled(True) + self.pushButton.setGeometry(QRect(780, 250, 191, 91)) + self.pushButton.setAutoFillBackground(False) + icon = QIcon() + icon.addFile(u"IMG/BTH/start_install.bmp", QSize(), QIcon.Mode.Normal, QIcon.State.Off) + self.pushButton.setIcon(icon) + self.pushButton.setIconSize(QSize(189, 110)) + self.pushButton.setCheckable(False) + self.pushButton.setAutoRepeat(False) + self.pushButton.setAutoDefault(False) + self.pushButton.setFlat(True) + self.pushButton_2 = QPushButton(self.centralwidget) + self.pushButton_2.setObjectName(u"pushButton_2") + self.pushButton_2.setEnabled(True) + self.pushButton_2.setGeometry(QRect(780, 340, 191, 91)) + self.pushButton_2.setAutoFillBackground(False) + icon1 = QIcon() + icon1.addFile(u"IMG/BTH/exit.bmp", QSize(), QIcon.Mode.Normal, QIcon.State.Off) + self.pushButton_2.setIcon(icon1) + self.pushButton_2.setIconSize(QSize(189, 110)) + self.pushButton_2.setCheckable(False) + self.pushButton_2.setFlat(True) + self.menubg = QLabel(self.centralwidget) + self.menubg.setObjectName(u"menubg") + self.menubg.setGeometry(QRect(710, 0, 321, 561)) + self.menubg.setPixmap(QPixmap(u"IMG/BG/menubg.jpg")) + self.menubg.setScaledContents(True) MainWindows.setCentralWidget(self.centralwidget) + self.loadbg.raise_() + self.vol1bg.raise_() + self.vol2bg.raise_() + self.vol3bg.raise_() + self.vol4bg.raise_() + self.afterbg.raise_() + self.Mainbg.raise_() + self.menubg.raise_() + self.pushButton.raise_() + self.pushButton_2.raise_() self.menubar = QMenuBar(MainWindows) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 1024, 21)) @@ -93,12 +137,19 @@ class Ui_MainWindows(object): def retranslateUi(self, MainWindows): MainWindows.setWindowTitle(QCoreApplication.translate("MainWindows", u" UI Test", None)) self.action_2.setText(QCoreApplication.translate("MainWindows", u"update - sd", None)) - self.MainBg.setText("") + self.loadbg.setText("") self.vol1bg.setText("") self.vol2bg.setText("") self.vol3bg.setText("") self.vol4bg.setText("") self.afterbg.setText("") + self.Mainbg.setText("") +#if QT_CONFIG(accessibility) + self.pushButton.setAccessibleDescription("") +#endif // QT_CONFIG(accessibility) + self.pushButton.setText("") + self.pushButton_2.setText("") + self.menubg.setText("") self.menu.setTitle(QCoreApplication.translate("MainWindows", u"\u8bbe\u7f6e", None)) self.menu_2.setTitle(QCoreApplication.translate("MainWindows", u"\u5173\u4e8e", None)) # retranslateUi diff --git a/__pycache__/Ui_install.cpython-310.pyc b/__pycache__/Ui_install.cpython-310.pyc index 850a345..2dec22e 100644 Binary files a/__pycache__/Ui_install.cpython-310.pyc and b/__pycache__/Ui_install.cpython-310.pyc differ diff --git a/__pycache__/animations.cpython-310.pyc b/__pycache__/animations.cpython-310.pyc index 6574186..e07e120 100644 Binary files a/__pycache__/animations.cpython-310.pyc and b/__pycache__/animations.cpython-310.pyc differ diff --git a/__pycache__/main_window.cpython-310.pyc b/__pycache__/main_window.cpython-310.pyc index 015d197..871fcd3 100644 Binary files a/__pycache__/main_window.cpython-310.pyc and b/__pycache__/main_window.cpython-310.pyc differ diff --git a/animations.py b/animations.py index 64255b2..b7142fc 100644 --- a/animations.py +++ b/animations.py @@ -1,72 +1,167 @@ -from PySide6.QtCore import (QPropertyAnimation, QSequentialAnimationGroup, - QParallelAnimationGroup, QPoint, QEasingCurve) +from PySide6.QtCore import (QPropertyAnimation, QParallelAnimationGroup, + QPoint, QEasingCurve, QTimer) from PySide6.QtWidgets import QGraphicsOpacityEffect -class LogoAnimations: +class MultiStageAnimations: def __init__(self, ui): self.ui = ui - self.logos = [ - ui.vol1bg, ui.vol2bg, ui.vol3bg, - ui.vol4bg, ui.afterbg + # 获取画布尺寸 + self.canvas_width = ui.centralwidget.width() + self.canvas_height = ui.centralwidget.height() + + # 动画时序配置 + self.animation_config = { + "logo": { + "delay_after": 800 # Logo动画完成后等待300ms + }, + "mainbg": { + "delay_after": 200 # 主背景淡入完成后等待200ms + } + } + + # 第一阶段:Logo动画配置 + self.logo_widgets = [ + {"widget": ui.vol1bg, "delay": 0, "duration": 500, "end_pos": QPoint(0, 120)}, + {"widget": ui.vol2bg, "delay": 80, "duration": 500, "end_pos": QPoint(0, 180)}, + {"widget": ui.vol3bg, "delay": 160, "duration": 500, "end_pos": QPoint(0, 240)}, + {"widget": ui.vol4bg, "delay": 240, "duration": 500, "end_pos": QPoint(0, 300)}, + {"widget": ui.afterbg, "delay": 320, "duration": 500, "end_pos": QPoint(0, 360)} ] - self.animation_group = None + # 第二阶段:菜单元素 + self.menu_widgets = [ + {"widget": ui.menubg, "end_pos": QPoint(710, 0), "duration": 600}, + {"widget": ui.pushButton, "end_pos": QPoint(780, 250), "duration": 600}, + {"widget": ui.pushButton_2, "end_pos": QPoint(780, 340), "duration": 600} + ] + + self.animations = [] + self.timers = [] def initialize(self): - """初始化所有logo的状态(透明且位于屏幕外)""" - for logo in self.logos: - # 保存原始位置 - logo.original_pos = logo.pos() - # 设置透明度效果 - opacity_effect = QGraphicsOpacityEffect(logo) - logo.setGraphicsEffect(opacity_effect) - opacity_effect.setOpacity(0) - # 移动到屏幕左侧外 - logo.move(-logo.width(), logo.y()) + """初始化所有组件状态""" + # 设置Mainbg初始状态 + effect = QGraphicsOpacityEffect(self.ui.Mainbg) + effect.setOpacity(0) + self.ui.Mainbg.setGraphicsEffect(effect) + + # 初始化Logo位置(移到左侧外) + for item in self.logo_widgets: + widget = item["widget"] + effect = QGraphicsOpacityEffect(widget) + effect.setOpacity(0) + widget.setGraphicsEffect(effect) + widget.move(-widget.width(), item["end_pos"].y()) + widget.show() + + # 初始化菜单元素(底部外) + for item in self.menu_widgets: + widget = item["widget"] + effect = QGraphicsOpacityEffect(widget) + effect.setOpacity(0) + widget.setGraphicsEffect(effect) + widget.move(widget.x(), self.canvas_height + 100) + widget.show() - def create_animation_sequence(self): - """创建顺序动画序列""" - self.animation_group = QSequentialAnimationGroup() + def start_logo_animations(self): + """启动Logo动画序列""" + for item in self.logo_widgets: + timer = QTimer() + timer.setSingleShot(True) + timer.timeout.connect( + lambda w=item["widget"], d=item["duration"], pos=item["end_pos"]: + self.animate_logo(w, pos, d) + ) + timer.start(item["delay"]) + self.timers.append(timer) + + def animate_logo(self, widget, end_pos, duration): + """执行单个Logo动画""" + anim_group = QParallelAnimationGroup() - # 为每个logo创建动画(延迟递增) - delays = [0, 50, 100, 150, 200] # 每个动画的延迟时间(ms) + # 位置动画 + pos_anim = QPropertyAnimation(widget, b"pos") + pos_anim.setDuration(duration) + pos_anim.setStartValue(QPoint(-widget.width(), end_pos.y())) + pos_anim.setEndValue(end_pos) + pos_anim.setEasingCurve(QEasingCurve.OutBack) - for i, logo in enumerate(self.logos): - # 创建并行动画组(位置+透明度) - parallel_group = QParallelAnimationGroup() + # 透明度动画 + opacity_anim = QPropertyAnimation(widget.graphicsEffect(), b"opacity") + opacity_anim.setDuration(duration) + opacity_anim.setStartValue(0) + opacity_anim.setEndValue(1) + + anim_group.addAnimation(pos_anim) + anim_group.addAnimation(opacity_anim) + + # 最后一个Logo动画完成后添加延迟 + if widget == self.logo_widgets[-1]["widget"]: + anim_group.finished.connect( + lambda: QTimer.singleShot( + self.animation_config["logo"]["delay_after"], + self.start_mainbg_animation + ) + ) + + anim_group.start() + self.animations.append(anim_group) + + def start_mainbg_animation(self): + """启动主背景淡入动画""" + main_anim = QPropertyAnimation(self.ui.Mainbg.graphicsEffect(), b"opacity") + main_anim.setDuration(800) + main_anim.setStartValue(0) + main_anim.setEndValue(1) + main_anim.finished.connect(self.start_menu_animations) + main_anim.start() + self.animations.append(main_anim) + + def start_mainbg_animation(self): + """启动主背景淡入动画(带延迟)""" + main_anim = QPropertyAnimation(self.ui.Mainbg.graphicsEffect(), b"opacity") + main_anim.setDuration(800) + main_anim.setStartValue(0) + main_anim.setEndValue(1) + main_anim.finished.connect( + lambda: QTimer.singleShot( + self.animation_config["mainbg"]["delay_after"], + self.start_menu_animations + ) + ) + main_anim.start() + self.animations.append(main_anim) + def start_menu_animations(self): + """启动菜单动画(从下往上)""" + for item in self.menu_widgets: + anim_group = QParallelAnimationGroup() - # 位置动画(从左侧滑入) - pos_anim = QPropertyAnimation(logo, b"pos") - pos_anim.setDuration(800) - pos_anim.setStartValue(QPoint(-logo.width(), logo.y())) - pos_anim.setEndValue(logo.original_pos) + # 位置动画(从下往上) + pos_anim = QPropertyAnimation(item["widget"], b"pos") + pos_anim.setDuration(item["duration"]) + pos_anim.setStartValue(QPoint(item["end_pos"].x(), self.canvas_height + 100)) + pos_anim.setEndValue(item["end_pos"]) pos_anim.setEasingCurve(QEasingCurve.OutBack) - # 透明度动画(淡入) - opacity_anim = QPropertyAnimation(logo.graphicsEffect(), b"opacity") - opacity_anim.setDuration(800) + # 透明度动画 + opacity_anim = QPropertyAnimation(item["widget"].graphicsEffect(), b"opacity") + opacity_anim.setDuration(item["duration"]) opacity_anim.setStartValue(0) opacity_anim.setEndValue(1) - parallel_group.addAnimation(pos_anim) - parallel_group.addAnimation(opacity_anim) - - # 添加延迟(使动画按顺序触发) - if delays[i] > 0: - delay_anim = QPropertyAnimation(logo, b"pos") - delay_anim.setDuration(delays[i]) - self.animation_group.addAnimation(delay_anim) - - self.animation_group.addAnimation(parallel_group) - - return self.animation_group + anim_group.addAnimation(pos_anim) + anim_group.addAnimation(opacity_anim) + anim_group.start() + self.animations.append(anim_group) + def start_animations(self): + """启动完整动画序列""" + self.clear_animations() + self.start_logo_animations() - def start_animation(self): - """启动动画序列""" - self.initialize() - self.create_animation_sequence() - self.animation_group.start() - - def stop_animation(self): - """停止动画""" - if self.animation_group: - self.animation_group.stop() \ No newline at end of file + def clear_animations(self): + """清理所有动画资源""" + for timer in self.timers: + timer.stop() + for anim in self.animations: + anim.stop() + self.timers.clear() + self.animations.clear() \ No newline at end of file diff --git a/install.ui b/install.ui index 584d751..bdfb08d 100644 --- a/install.ui +++ b/install.ui @@ -56,7 +56,7 @@ true - + 0 @@ -79,7 +79,7 @@ 0 - 250 + 120 93 64 @@ -98,7 +98,7 @@ 0 - 310 + 180 93 64 @@ -117,7 +117,7 @@ 0 - 370 + 240 93 64 @@ -136,7 +136,7 @@ 0 - 430 + 300 93 64 @@ -155,7 +155,7 @@ 0 - 490 + 360 93 64 @@ -170,6 +170,133 @@ true + + + + 0 + 0 + 1031 + 561 + + + + + + + IMG/BG/bg3.jpg + + + true + + + + + true + + + + 780 + 250 + 191 + 91 + + + + + + + false + + + + + + + IMG/BTH/start_install.bmpIMG/BTH/start_install.bmp + + + + 189 + 110 + + + + false + + + false + + + false + + + true + + + + + true + + + + 780 + 340 + 191 + 91 + + + + false + + + + + + + IMG/BTH/exit.bmpIMG/BTH/exit.bmp + + + + 189 + 110 + + + + false + + + true + + + + + + 710 + 0 + 321 + 561 + + + + + + + IMG/BG/menubg.jpg + + + true + + + loadbg + vol1bg + vol2bg + vol3bg + vol4bg + afterbg + Mainbg + menubg + start_install_btn + exit_btn diff --git a/main.py b/main.py index 6c15df3..747785e 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,5 @@ -# main.py import sys from PySide6.QtWidgets import QApplication -from Ui_install import Ui_MainWindows from main_window import MainWindow def main(): diff --git a/main_window.py b/main_window.py index 06e38b4..53825cc 100644 --- a/main_window.py +++ b/main_window.py @@ -1,26 +1,28 @@ from PySide6.QtWidgets import QMainWindow -from Ui_install import Ui_MainWindows # 导入你的UI文件 -from animations import LogoAnimations +from PySide6.QtCore import QTimer +from Ui_install import Ui_MainWindows +from animations import MultiStageAnimations class MainWindow(QMainWindow): def __init__(self): super().__init__() - # 设置UI + + # 先初始化UI self.ui = Ui_MainWindows() self.ui.setupUi(self) - # 初始化动画系统 - self.logo_animations = LogoAnimations(self.ui) + # 然后初始化动画系统 + self.animator = MultiStageAnimations(self.ui) - # 窗口显示时自动启动动画 - self.showEvent = self.on_show_event + # 在窗口显示前设置初始状态 + self.animator.initialize() - def on_show_event(self, event): - """窗口显示事件处理""" - self.logo_animations.start_animation() - super().showEvent(event) + # 窗口显示后延迟100ms启动动画 + QTimer.singleShot(100, self.start_animations) + + def start_animations(self): + self.animator.start_animations() def closeEvent(self, event): - """窗口关闭事件处理""" - self.logo_animations.stop_animation() + self.animator.clear_animations() super().closeEvent(event) \ No newline at end of file