diff options
Diffstat (limited to 'caribou/ui/animation.py')
-rw-r--r-- | caribou/ui/animation.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/caribou/ui/animation.py b/caribou/ui/animation.py index 44a9dfd..c382929 100644 --- a/caribou/ui/animation.py +++ b/caribou/ui/animation.py @@ -18,16 +18,16 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -import clutter +from gi.repository import Clutter class AnimatedWindowBase(object): - def __init__(self, ease=clutter.EASE_IN_QUAD): + 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" + "must be subclassed with a Gtk.Window" - self._actor = clutter.Rectangle() + self._actor = Clutter.Rectangle() self.ease = ease def _on_new_frame(self, timeline, timing): @@ -37,25 +37,27 @@ class AnimatedWindowBase(object): def animated_move(self, x, y): orig_x, orig_y = self.get_position() self._actor.set_position(orig_x, orig_y) - self._actor.set_size(self.allocation.width, self.allocation.height) - animation = self._actor.animate( - self.ease, 250, "x", x, "y", 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 gtk - class AnimatedWindow(gtk.Window, AnimatedWindowBase): + import gobject + from gi.repository import Gtk + class AnimatedWindow(Gtk.Window, AnimatedWindowBase): def __init__(self): - gtk.Window.__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() + #aw.animated_move(200, 200) + Gtk.main() |