✨ refactor(metrics, animatedcircularprogressbar): replace AnimatedCircularProgressBar with CircularProgressBar in Metrics component
This commit is contained in:
3 files changed
+1
-54
No files matched your search
@@ -10,7 +10,6 @@ from fabric.widgets.revealer import Revealer
|
|||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
import config.data as data
|
import config.data as data
|
||||||
from utils.animatedcircularprogressbar import AnimatedCircularProgressBar
|
|
||||||
import utils.icons as icons
|
import utils.icons as icons
|
||||||
|
|
||||||
|
|
||||||
@@ -156,7 +155,7 @@ class SingularMetric:
|
|||||||
self.icon_markup = icon
|
self.icon_markup = icon
|
||||||
|
|
||||||
self.icon = Label(name="metrics-icon", markup=icon)
|
self.icon = Label(name="metrics-icon", markup=icon)
|
||||||
self.circle = AnimatedCircularProgressBar(
|
self.circle = CircularProgressBar(
|
||||||
name="metrics-circle",
|
name="metrics-circle",
|
||||||
value=0,
|
value=0,
|
||||||
size=28,
|
size=28,
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
from fabric.widgets.circularprogressbar import CircularProgressBar
|
|
||||||
from utils.animator import Animator
|
|
||||||
|
|
||||||
class AnimatedCircularProgressBar(CircularProgressBar):
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
super().__init__(**kwargs)
|
|
||||||
self.animator = (
|
|
||||||
Animator(
|
|
||||||
bezier_curve=(0.15, 0.88, 0.68, 0.95),
|
|
||||||
duration=0.8,
|
|
||||||
min_value=self.min_value,
|
|
||||||
max_value=self.value,
|
|
||||||
tick_widget=self,
|
|
||||||
notify_value=lambda p, *_: self.set_value(p.value),
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
.play()
|
|
||||||
.unwrap()
|
|
||||||
)
|
|
||||||
|
|
||||||
def animate_value(self, value: float):
|
|
||||||
self.animator.pause()
|
|
||||||
self.animator.min_value = self.value
|
|
||||||
self.animator.max_value = value
|
|
||||||
self.animator.play()
|
|
||||||
return
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
from fabric.widgets.scale import Scale
|
|
||||||
from utils.animator import Animator
|
|
||||||
|
|
||||||
class AnimatedScale(Scale):
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
super().__init__(**kwargs)
|
|
||||||
self.animator = (
|
|
||||||
Animator(
|
|
||||||
bezier_curve=(0.15, 0.88, 0.68, 0.95),
|
|
||||||
duration=0.3,
|
|
||||||
min_value=self.min_value,
|
|
||||||
max_value=self.value,
|
|
||||||
tick_widget=self,
|
|
||||||
notify_value=lambda p, *_: self.set_value(p.value),
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
.play()
|
|
||||||
.unwrap()
|
|
||||||
)
|
|
||||||
|
|
||||||
def animate_value(self, value: float):
|
|
||||||
self.animator.pause()
|
|
||||||
self.animator.min_value = self.value
|
|
||||||
self.animator.max_value = value
|
|
||||||
self.animator.play()
|
|
||||||
return
|
|
||||||
Reference in new issue
Block a user