hamster-applet r821 - trunk/hamster



Author: tbaugis
Date: Sat Feb 28 21:26:22 2009
New Revision: 821
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=821&view=rev

Log:
don't do anything on update if we have no target

Modified:
   trunk/hamster/charting.py

Modified: trunk/hamster/charting.py
==============================================================================
--- trunk/hamster/charting.py	(original)
+++ trunk/hamster/charting.py	Sat Feb 28 21:26:22 2009
@@ -111,6 +111,7 @@
         
     def target(self, value):
         """target next value"""
+        self.targeting = True
         self.target_value = value
         if type(value) == dt.datetime:
             self.target_value = int(time.mktime(value.timetuple()))
@@ -120,8 +121,10 @@
         if there is any action needed. returns velocity, which is synonym from
         delta. Use it to determine when animation is done (experiment to find
         value that fits you!"""
-        self.force += self.attraction * (self.target_value - self.current_value)
-    
+
+        if self.targeting:
+            self.force += self.attraction * (self.target_value - self.current_value)
+
         self.accel = self.force / self.mass
         self.vel = (self.vel + self.accel) * self.damping
         self.current_value += self.vel    



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]