Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/PortfolioActivity.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-08-17 22:54:05 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-08-17 22:54:05 (GMT)
commitd17a13065dba945b25822a2c34cd2cdef2d32db9 (patch)
tree9c2e9437e4f56b7b13fbc1bcc45a166a98313205 /PortfolioActivity.py
parentd541a81e02d9deeed4365e5f4b5bb2bc663aaf6d (diff)
stop autoplay when going to thumbnail view
Diffstat (limited to 'PortfolioActivity.py')
-rw-r--r--PortfolioActivity.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/PortfolioActivity.py b/PortfolioActivity.py
index cc14f38..892b037 100644
--- a/PortfolioActivity.py
+++ b/PortfolioActivity.py
@@ -233,6 +233,12 @@ class PortfolioActivity(activity.Activity):
toolbox.set_current_toolbar(1)
self.toolbar = primary_toolbar
+ self._auto_button = button_factory(
+ 'media-playlist-repeat', _('Autoplay'), self._autoplay_cb,
+ self.toolbar)
+
+ separator_factory(self.toolbar)
+
self._prev_button = button_factory(
'go-previous-inactive', _('Prev slide'), self._prev_cb,
self.toolbar, accelerator='<Ctrl>P')
@@ -241,12 +247,6 @@ class PortfolioActivity(activity.Activity):
'go-next', _('Next slide'), self._next_cb,
self.toolbar, accelerator='<Ctrl>N')
- separator_factory(self.toolbar)
-
- self._auto_button = button_factory(
- 'media-playlist-repeat', _('Autoplay'), self._autoplay_cb,
- self.toolbar)
-
label = label_factory(_('Adjust playback speed'), adjust_toolbar)
label.show()
@@ -308,15 +308,18 @@ class PortfolioActivity(activity.Activity):
def _autoplay_cb(self, button=None):
''' The autoplay button has been clicked; step through slides. '''
if self._playing:
- self._playing = False
- self._auto_button.set_icon('media-playlist-repeat')
- if hasattr(self, '_timeout_id') and self._timeout_id is not None:
- gobject.source_remove(self._timeout_id)
+ self._stop_autoplay()
else:
self._playing = True
self._auto_button.set_icon('media-playback-pause')
self._loop()
+ def _stop_autoplay(self):
+ self._playing = False
+ self._auto_button.set_icon('media-playlist-repeat')
+ if hasattr(self, '_timeout_id') and self._timeout_id is not None:
+ gobject.source_remove(self._timeout_id)
+
def _loop(self):
''' Show a slide and then call oneself with a timeout. '''
self.i += 1
@@ -444,6 +447,7 @@ class PortfolioActivity(activity.Activity):
self._set_view_mode()
self._show_slide(self._current_slide)
else:
+ self._stop_autoplay()
self._current_slide = self.i
self._thumbnail_mode = True
self._clear_screen()