diff options
Diffstat (limited to 'caribou/ui/animation.py')
-rw-r--r-- | caribou/ui/animation.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/caribou/ui/animation.py b/caribou/ui/animation.py deleted file mode 100644 index c382929..0000000 --- a/caribou/ui/animation.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Caribou - text entry and UI navigation application -# -# Copyright (C) 2009 Eitan Isaacson <eitan@monotonous.org> -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by the -# Free Software Foundation; either version 2.1 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -from gi.repository import Clutter - -class AnimatedWindowBase(object): - def __init__(self, ease=Clutter.AnimationMode.EASE_IN_QUAD): - if self.__class__ == AnimatedWindowBase: - raise TypeError, \ - "AnimatedWindowBase is an abstract class, " \ - "must be subclassed with a Gtk.Window" - - self._actor = Clutter.Rectangle() - self.ease = ease - - def _on_new_frame(self, timeline, timing): - x, y = self._actor.get_position() - self.move(int(x), int(y)) - - def animated_move(self, x, y): - orig_x, orig_y = self.get_position() - self._actor.set_position(orig_x, orig_y) - #allocation = self.get_allocation() - #print allocation.width, allocation.height - #self._actor.set_size(self.allocation.width, self.allocation.height) - animation = self._actor.animatev(self.ease, 250, ["x", "y"]) - timeline = animation.get_timeline() - timeline.connect('new-frame', self._on_new_frame) - - return animation - -if __name__ == "__main__": - import gobject - from gi.repository import Gtk - class AnimatedWindow(Gtk.Window, AnimatedWindowBase): - def __init__(self): - gobject.GObject.__init__(self) - AnimatedWindowBase.__init__(self) - - aw = AnimatedWindow() - aw.show_all() - aw.move(100, 100) - #aw.animated_move(200, 200) - Gtk.main() - - |