Skip to content

Commit

Permalink
fix(AnimationManager): enable/disable opacity effect only when necess…
Browse files Browse the repository at this point in the history
…ary, preventing unnecessary computation.

Previously, the opacity effect was always enabled even when not needed, causing unnecessary computation. This commit should fixed moving widget while opacity is running.
  • Loading branch information
amnweb committed Jan 27, 2025
1 parent 30a2276 commit 70b598a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/utils/widgets/animation_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def fadeInOut(self, widget):
widget._animation_timer.stop()

widget._opacity_effect = QGraphicsOpacityEffect()
widget._opacity_effect.setEnabled(True)
widget.setGraphicsEffect(widget._opacity_effect)
widget._opacity_effect.setOpacity(0.5)

Expand All @@ -48,6 +49,7 @@ def animate():
new_opacity = 1.0
widget._opacity_effect.setOpacity(new_opacity)
widget._animation_timer.stop()
widget._opacity_effect.setEnabled(False)
widget._opacity_effect = None
return
widget._opacity_effect.setOpacity(new_opacity)
Expand Down

0 comments on commit 70b598a

Please sign in to comment.