Ticket #2080: 0001-Pulsing-icon-delayed-by-5-seconds-or-so-SL-2080.patch

File 0001-Pulsing-icon-delayed-by-5-seconds-or-so-SL-2080.patch, 2.1 KB (added by anurag_seeta, 10 years ago)
  • src/jarabe/view/pulsingicon.py

    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): 
    3030        self._icon = icon
    3131        self._level = 0
    3232        self._phase = 0
     33        self._count = 1
    3434    def start(self, restart=False):
    3535        if restart:
    3636            self._phase = 0
    class Pulser(object): 
    7979    def __pulse_cb(self):
    8080        self._phase += _STEP
    8181        self._level = (math.sin(self._phase) + 1) / 2
    82         self.update()
     82        if self._count > 2:
     83           self.update()
     84        self._count = self._count + 1
    8485        return True
    8687class PulsingIcon(Icon):