@@ -18,6 +18,7 @@ def __init__(self, w_parent, board):
1818 self .timer = None
1919 self .activated = False
2020 self .value_objective = 0
21+ self .acercando = False
2122 self .aeval = AnalysisEval .AnalysisEval ()
2223 self .interval = Code .configuration .x_analyzer_mstime_refresh_ab
2324
@@ -27,8 +28,6 @@ def __init__(self, w_parent, board):
2728 self .progressbar .setValue (5000 )
2829 self .progressbar .setTextVisible (False )
2930
30- self .animation = QtCore .QPropertyAnimation (self .progressbar , b"value" )
31-
3231 self .lb_value_up = Controles .LB (self ).set_font_type (puntos = 7 ).align_center ()
3332 self .lb_value_down = Controles .LB (self ).set_font_type (puntos = 7 ).align_center ()
3433
@@ -178,29 +177,25 @@ def mousePressEvent(self, event):
178177 def update_value (self , value ):
179178 if not self .activated :
180179 return
181- self .value_objective = max (0 , min (value , 10000 ))
182- self .goto_objective ()
180+ if value > 10000 :
181+ value = 10000
182+ elif value < 0 :
183+ value = 0
184+ self .value_objective = value
185+ if not self .acercando :
186+ self .goto_objective ()
183187
184188 def goto_objective (self ):
185189 if not self .engine_manager or not self .activated :
186- self .animation . stop ()
190+ self .acercando = False
187191 return
188192 value = self .progressbar .value ()
189193 if value != self .value_objective :
190- delta = abs (self .value_objective - value )
191-
192- # entre 300ms (pequeños) y 2000ms (grandes)
193- duration = min (max (300 + delta * 0.1 , 300 ), 2000 )
194- if delta < 500 :
195- curve = QtCore .QEasingCurve .Type .OutQuad
196- elif delta < 2500 :
197- curve = QtCore .QEasingCurve .Type .OutCubic
198- else :
199- curve = QtCore .QEasingCurve .Type .OutQuint
200-
201- self .animation .stop ()
202- self .animation .setStartValue (value )
203- self .animation .setEndValue (self .value_objective )
204- self .animation .setDuration (int (duration ))
205- self .animation .setEasingCurve (curve )
206- self .animation .start ()
194+ velocidad = max (abs (self .value_objective - value ) // 50 , 1 )
195+ self .acercando = True
196+ add = + 1 if self .value_objective > value else - 1
197+ self .progressbar .setValue (value + add * velocidad )
198+ self .update ()
199+ QtCore .QTimer .singleShot (2 , self .goto_objective )
200+ else :
201+ self .acercando = False
0 commit comments