[Sugar-devel] [PATCH v5 sugar] Pulsing icon delayed by 5 seconds or so SL#2080

Anurag Chowdhury anurag at seeta.in
Wed Oct 13 11:28:19 EDT 2010

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/src/jarabe/view/pulsingicon.py
+++ b/src/jarabe/view/pulsingicon.py
@@ -30,7 +30,7 @@ class Pulser(object):
         self._icon = icon
         self._level = 0
         self._phase = 0
+        self._count = 1
     def start(self, restart=False):
         if restart:
             self._phase = 0
@@ -79,8 +79,9 @@ class Pulser(object):
     def __pulse_cb(self):
         self._phase += _STEP
         self._level = (math.sin(self._phase) + 1) / 2
-        self.update()
+        if self._count > 2:
+           self.update()
+        self._count = self._count + 1
         return True
 class PulsingIcon(Icon):

More information about the Sugar-devel mailing list