Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-06-25 15:05:18 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-06-25 15:05:18 (GMT)
commit1fe61a73c33716ca5d5c3d9b178c621cbdb5047a (patch)
treea6960349fe7eb8357bc28e16f53ecbd5f30437ad
parentdd8217480af6d2298fd48f32100adabada4cef06 (diff)
Restart the timer when the user press prev/next button
This is needed to have the same time with every image Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--activity.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/activity.py b/activity.py
index 6d85d32..a4b7266 100644
--- a/activity.py
+++ b/activity.py
@@ -194,9 +194,6 @@ class ImageCollectionViewer(gtk.VBox):
self.show_all()
- self.timer_id = gobject.timeout_add(
- int(DEFAULT_CHANGE_IMAGE_TIME * 1000), self.auto_change_image)
-
# calculate space available for images
# (only to tell to the designers)
height_av = gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 2
@@ -219,13 +216,11 @@ class ImageCollectionViewer(gtk.VBox):
else:
self.image_order = 0
self._update_image()
-
- self.timer_id = gobject.timeout_add(
- int(DEFAULT_CHANGE_IMAGE_TIME * 1000), self.auto_change_image)
return False
def next_anim_clicked_cb(self, button, event):
if button is not None:
+ gobject.source_remove(self.timer_id)
self.auto_change_anim = False
self.image_order = 0
self.anim_order += 1
@@ -239,6 +234,7 @@ class ImageCollectionViewer(gtk.VBox):
def prev_anim_clicked_cb(self, button, event):
if button is not None:
+ gobject.source_remove(self.timer_id)
self.auto_change_anim = False
self.image_order = 0
self.anim_order -= 1
@@ -255,6 +251,8 @@ class ImageCollectionViewer(gtk.VBox):
self.animation_list[self.anim_order][self.image_order]
self.image.set_from_file(image_file_name)
self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
+ self.timer_id = gobject.timeout_add(
+ int(DEFAULT_CHANGE_IMAGE_TIME * 1000), self.auto_change_image)
def finish(self):
self._allow_suspend()