From d0105a72cc2a4c6a48e0a34443c27a08beb199e5 Mon Sep 17 00:00:00 2001
From: Anurag Chowdhury <anurag@seeta.in>
Date: Wed, 13 Oct 2010 20:08:50 +0530
Subject: [PATCH v5 sugar] Pulsing icon delayed by 5 seconds or so SL#2080
When we click on the icon of an activity we see a pulsing icon of that
activity before the activity starts and usually there is a time delay between
the clicking of the icon and appearance of the pulsing icon , where tha amount
of delay differs by the complexity of the icon i.e. more complex the icon is
larger is the delay.
So In order to minimise the delay we replaced the animation with its raw svg
image for the first frame of rendering only there by reducing the rendering
timeof the first frame and hence reducing the delay and from the second frame
onwards the svg image will be converted into the pulsing icon animation. To
stop the pulsing icon from animating for the first frame we stopped the call
to the update function for first two times only, as every frame has two update
calls associated with it, once the update that preceeds the frame and the
other that follows it.
---
src/jarabe/view/pulsingicon.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
v1->v2 corrected layout according to pep-8 format
v2->v3 removed increment operation of variable i in the for loop
v3->v4 added the concept of frame skipping
v4->v5 changed the first frame of the animation to static svg icon
diff --git a/src/jarabe/view/pulsingicon.py b/src/jarabe/view/pulsingicon.py
index 43ec358..70040a6 100644
a
|
b
|
class Pulser(object): |
30 | 30 | self._icon = icon |
31 | 31 | self._level = 0 |
32 | 32 | self._phase = 0 |
33 | | |
| 33 | self._count = 1 |
34 | 34 | def start(self, restart=False): |
35 | 35 | if restart: |
36 | 36 | self._phase = 0 |
… |
… |
class Pulser(object): |
79 | 79 | def __pulse_cb(self): |
80 | 80 | self._phase += _STEP |
81 | 81 | self._level = (math.sin(self._phase) + 1) / 2 |
82 | | self.update() |
83 | | |
| 82 | if self._count > 2: |
| 83 | self.update() |
| 84 | self._count = self._count + 1 |
84 | 85 | return True |
85 | 86 | |
86 | 87 | class PulsingIcon(Icon): |