Refacto en sous fichiers pour la maintenabilité

This commit is contained in:
2026-03-13 13:55:45 +01:00
parent e1b32688b4
commit d0ede2acd5
7 changed files with 313 additions and 321 deletions

View File

@@ -0,0 +1,32 @@
from PySide6.QtCore import QPropertyAnimation, QEasingCurve
from PySide6.QtWidgets import QGraphicsDropShadowEffect
from src.constants import GLOW_COLOR, GLOW_BLUR_BASE, GLOW_BLUR_PEAK, GLOW_ANIM_DURATION
class GlowAnimator:
# Gère l'effet de lueur pulsée sur un widget.
def __init__(self, widget):
self._widget = widget
self._effect = QGraphicsDropShadowEffect(widget)
self._effect.setBlurRadius(GLOW_BLUR_BASE)
self._effect.setOffset(0, 0)
self._effect.setColor(GLOW_COLOR)
self._anim = QPropertyAnimation(self._effect, b"blurRadius")
self._anim.setDuration(GLOW_ANIM_DURATION)
self._anim.setStartValue(GLOW_BLUR_BASE)
self._anim.setKeyValueAt(0.5, GLOW_BLUR_PEAK)
self._anim.setEndValue(GLOW_BLUR_BASE)
self._anim.setEasingCurve(QEasingCurve.InOutQuad)
self._anim.setLoopCount(-1)
def start(self) -> None:
self._widget.setGraphicsEffect(self._effect)
self._anim.start()
def stop(self) -> None:
self._anim.stop()
self._widget.setGraphicsEffect(None)