Disable animation when doing config.
authorStefanos Harhalakis <v13@v13.gr>
Sun, 8 Aug 2010 10:56:52 +0000 (10:56 +0000)
committerStefanos Harhalakis <v13@v13.gr>
Sun, 8 Aug 2010 10:56:52 +0000 (10:56 +0000)
src/config.py
src/icongrid.py
src/win_config.py

index 3234967..ff8cf1a 100755 (executable)
@@ -25,7 +25,7 @@ __version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
 import os
 import pickle
 
-version = "0.6"
+version = "0.7"
 
 try:
     from glib import get_user_config_dir
index be097d0..ed592e6 100755 (executable)
@@ -64,6 +64,9 @@ class IconGrid(object):       #(gobject.GObject):
 
        self.mode=None
 
+       # If this is False then animations are forcefully disabled
+       self.do_animations=True
+
     def do_realize(self, config):
        self.config=config
 
@@ -106,7 +109,7 @@ class IconGrid(object):     #(gobject.GObject):
        except TypeError:
            do_draw=True
 
-       if do_draw and self.config.getAnimate():
+       if do_draw and self.config.getAnimate() and self.do_animations:
            #self.queue_draw()
            self.angle_timer_start=time.time()
            gobject.timeout_add(20, self.timerAngle)
@@ -118,7 +121,19 @@ class IconGrid(object):    #(gobject.GObject):
 
            if do_draw:
                self.queue_draw()
-                
+
+    def disableAnimation(self):
+       self.do_animations=False
+
+    def enableAnimation(self):
+       self.do_animations=True
+
+    def setAnimationEnable(self, value):
+       if value:
+           self.enableAnimation()
+       else
+           self.disableAnimation()
+
     def timerAngle(self):
        if self.angle_timer_start==0:
            self.angle_timer_start=time.time()-0.05
@@ -295,10 +310,13 @@ class IconGrid(object):   #(gobject.GObject):
 #      self.setMode(o)
 
 class IconGridWidget(IconGrid, gtk.Widget):
-    def __init__(self, isconfig, config):
+    def __init__(self, isconfig, config, animation=True):
        IconGrid.__init__(self, isconfig)
        gtk.Widget.__init__(self)
 
+       # This must be called before do_realize
+       self.setAnimationEnable(animation)
+
        self.config=config
 
        IconGrid.do_realize(self, self.config)
index 77526ee..a003723 100755 (executable)
@@ -133,7 +133,7 @@ class WinConfig(StackableWindow):
 
        # -----------------------------------------------
        # Add the icongrid
-       self.igw=IconGridWidget(True, self.config)
+       self.igw=IconGridWidget(True, self.config, False)
 #      self.igw.do_realize()
 #      self.igw.setSize(config.getSize())
        al=gtk.Alignment(xalign=0, xscale=0)