diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-05-26 17:34:23 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-05-26 17:34:23 (GMT) |
commit | afdcf8cbea2aca30193f83066f951acc0f032746 (patch) | |
tree | c5748befbaa3c66b33f01a27d19dd0bfa879287f /activity.py | |
parent | 341506dbcffded7581b6108105bc921d3ed3b955 (diff) |
Pause button added in Run button
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/activity.py b/activity.py index 330034b..204e82d 100644 --- a/activity.py +++ b/activity.py @@ -66,7 +66,7 @@ class AnimateActivity(activity.Activity): run_btn = ToolButton('media-playback-start') run_btn.set_tooltip(_('Run animation')) - run_btn.connect('clicked', self._run_animation) + run_btn.connect('clicked', self._run_pause_animation) toolbarbox.toolbar.insert(run_btn, -1) separator = gtk.SeparatorToolItem() @@ -104,9 +104,18 @@ class AnimateActivity(activity.Activity): else: return - def _run_animation(self, widget): - self._animation._images = [i[-1] for i in self._frames_list.store] - self._animation.run() + def _run_pause_animation(self, widget): + self._animation.images = [i[-1] for i in self._frames_list.store] + + if not self._animation._running: + self._animation.run() + widget.set_icon("media-playback-pause") + widget.set_tooltip(_("Pause animation")) + + elif self._animation._running: + self._animation.pause() + widget.set_icon("media-playback-pause") + widget.set_tooltip(_("Run animation")) def __canvas_expose_cb(self, canvas, event): canvas_allocation = canvas.get_allocation() |