Enhancements - Replace bare `except:` with `except Exception:` in multiple modules- Cast step calculation to `int` for consistent type - Simplify `get_battery_icon_file` to return a string directly - Use `get_todo_service()` instead of module-level `todo_service` throughout todo widget - Remove unused `"zen": "zen-browser"` mapping entry Bug Fixes - Prevent bare exception swallowing by catching `Exception` explicitly - Ensure proper cleanup of timer IDs and other resources - Delete unused modules/osdd components New Features - None
29 lines
875 B
Python
29 lines
875 B
Python
from functools import partial
|
|
from fabric.widgets.scale import Scale
|
|
from utils.animator import Animator, cubic_bezier
|
|
|
|
|
|
class AnimatedScale(Scale):
|
|
def __init__(self, **kwargs):
|
|
super().__init__(**kwargs)
|
|
self.animator = (
|
|
Animator(
|
|
duration=0.8,
|
|
timing_function=partial(cubic_bezier, 0.34, 1.56, 0.64, 1.0),
|
|
min_value=self.min_value,
|
|
max_value=self.value,
|
|
tick_widget=self,
|
|
notify_value=lambda anim: self.set_value(anim.value),
|
|
)
|
|
.build()
|
|
.play()
|
|
.unwrap()
|
|
)
|
|
|
|
def animate_value(self, value: float):
|
|
if self.animator:
|
|
self.animator.pause()
|
|
self.animator.min_value = self.value
|
|
self.animator.max_value = value
|
|
self.animator.play()
|