From d3a010ea0f4b0ff12f4e176f5be229e6579b62ee Mon Sep 17 00:00:00 2001 From: Agustin Zubiaga Date: Sun, 22 Jul 2012 21:54:14 +0000 Subject: False move buttons sensitive in animation running --- diff --git a/activity.py b/activity.py index 56f3af3..b30a01b 100644 --- a/activity.py +++ b/activity.py @@ -72,10 +72,10 @@ class AnimateActivity(activity.Activity): vbox = gtk.VBox() vbox.pack_start(self._frames_list, True, True, 0) - frames_toolbar = FramesToolbar() - frames_toolbar.connect('go-up', self._frames_list.move_up) - frames_toolbar.connect('go-down', self._frames_list.move_down) - vbox.pack_end(frames_toolbar, False, True, 0) + self._frames_toolbar = FramesToolbar() + self._frames_toolbar.connect('go-up', self._frames_list.move_up) + self._frames_toolbar.connect('go-down', self._frames_list.move_down) + vbox.pack_end(self._frames_toolbar, False, True, 0) canvas.pack_end(vbox, False, True, 0) canvas.connect("expose-event", self.__canvas_expose_cb) @@ -199,6 +199,8 @@ class AnimateActivity(activity.Activity): if not self._animation: self._animation = animation.Animation(width, height) self._animation.set_mode(self._animation_mode) + self._animation.connect('running', + self._frames_toolbar.set_buttons_sensitive) for pixbuf in self._animation_frames: self._animation.add_frame(pixbuf) self._frames_list.add_frame(pixbuf) diff --git a/animation.py b/animation.py index a91c559..cef171c 100644 --- a/animation.py +++ b/animation.py @@ -52,7 +52,11 @@ class Animation(gtk.Image): __gsignals__ = {"current-frame-updated": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_INT, - (gobject.TYPE_INT,))} + (gobject.TYPE_INT,)), + "running": (gobject.SIGNAL_RUN_LAST, + gobject.TYPE_NONE, + (gobject.TYPE_BOOLEAN,)), + } def __init__(self, width, height, fps=2): super(Animation, self).__init__() @@ -145,6 +149,7 @@ class Animation(gtk.Image): self.set_from_pixbuf(scaled_pixbuf) self._running = True + self.emit('running', True) self._timeout = gobject.timeout_add(self._sleep_time, self.next) _logger.info(" Running!") @@ -177,6 +182,7 @@ class Animation(gtk.Image): """Pause the animation""" gobject.source_remove(self._timeout) self._running = False + self.emit('running', False) def next(self): """Shows the next frame""" diff --git a/toolbars.py b/toolbars.py index 0c0b8cb..fb5406b 100644 --- a/toolbars.py +++ b/toolbars.py @@ -166,3 +166,7 @@ class FramesToolbar(gtk.Toolbar): move_down.set_tooltip(_('Move down')) move_down.connect('clicked', lambda w: self.emit('go-down')) self.insert(move_down, -1) + + def set_buttons_sensitive(self, widget, running): + for button in self.get_children(): + button.set_sensitive(not running) -- cgit v0.9.1