From 7beb2b24aceaf82f41d35e2adcff1e954ea5e6c5 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Fri, 16 Mar 2007 13:29:39 +0000 Subject: Use Animation for popdown. --- (limited to 'sugar') diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 6108ece..3d5438f 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -41,6 +41,15 @@ class _PopupAnimation(animator.Animation): if current == 1.0: self._icon.show_popup() +class _PopdownAnimation(animator.Animation): + def __init__(self, icon): + animator.Animation.__init__(self, 0.0, 1.0) + self._icon = icon + + def next_frame(self, current): + if current == 1.0: + self._icon.hide_popup() + class _IconCacheIcon: def __init__(self, name, fill_color, stroke_color, now): self.data_size = None @@ -409,7 +418,10 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): self.prelight(enter=True) def _leave(self): - self.hide_popup() + self._popup_anim = animator.Animator(0.2, 10) + self._popup_anim.add(_PopdownAnimation(self)) + self._popup_anim.start() + self.prelight(enter=False) def _enter_or_leave_cb(self): -- cgit v0.9.1