diff --git a/clashroyalebuildabot/gui/animations.py b/clashroyalebuildabot/gui/animations.py new file mode 100644 index 0000000..1a7d187 --- /dev/null +++ b/clashroyalebuildabot/gui/animations.py @@ -0,0 +1,23 @@ +from PyQt6.QtCore import QEasingCurve, QPropertyAnimation, Qt +from PyQt6.QtWidgets import QGraphicsDropShadowEffect + + +def start_play_button_animation(self): + self.glow_effect = QGraphicsDropShadowEffect(self) + self.glow_effect.setBlurRadius(10) # Initial blur radius for the glow effect + self.glow_effect.setColor(Qt.GlobalColor.cyan) + self.glow_effect.setOffset(0, 0) # Center the shadow to create the glow effect + self.start_stop_button.setGraphicsEffect(self.glow_effect) + + _start_glow_animation(self) + + +def _start_glow_animation(self): + """Create a glow effect animation.""" + self.glow_animation = QPropertyAnimation(self.glow_effect, b"blurRadius") + self.glow_animation.setStartValue(0) + self.glow_animation.setEndValue(25) + self.glow_animation.setDuration(2000) + self.glow_animation.setEasingCurve(QEasingCurve.Type.SineCurve) + self.glow_animation.setLoopCount(-1) + self.glow_animation.start() \ No newline at end of file diff --git a/clashroyalebuildabot/gui/main_window.py b/clashroyalebuildabot/gui/main_window.py index 73d5f9b..4669fb6 100644 --- a/clashroyalebuildabot/gui/main_window.py +++ b/clashroyalebuildabot/gui/main_window.py @@ -1,13 +1,12 @@ from threading import Thread -from PyQt6.QtCore import Qt from PyQt6.QtWidgets import QMainWindow -from PyQt6.QtWidgets import QTabWidget from PyQt6.QtWidgets import QVBoxLayout from PyQt6.QtWidgets import QWidget from clashroyalebuildabot import Bot from clashroyalebuildabot.bot.bot import pause_event +from clashroyalebuildabot.gui.animations import start_play_button_animation from clashroyalebuildabot.gui.layout_setup import setup_tabs from clashroyalebuildabot.gui.layout_setup import setup_top_bar from clashroyalebuildabot.gui.styles import set_styles @@ -16,8 +15,6 @@ class MainWindow(QMainWindow): def __init__(self, config, actions): super().__init__() - - self.config = config self.actions = actions self.bot = None @@ -39,12 +36,15 @@ def __init__(self, config, actions): main_layout.addWidget(tab_widget) set_styles(self) + start_play_button_animation(self) def toggle_start_stop(self): if self.is_running: self.stop_bot() + self.glow_animation.start() else: self.start_bot() + self.glow_animation.stop() def toggle_pause_resume_and_display(self): if not self.bot: