diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-06-25 14:49:40 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-06-25 14:49:40 (GMT) |
commit | dd8217480af6d2298fd48f32100adabada4cef06 (patch) | |
tree | 39d9ef1348edc8251e668e8fd3322674295c0838 | |
parent | 82d546fcb9b6c649cb403bd610d322982d85e8eb (diff) |
Use 1.5 seconds between images, and show a watch cursor when change animation
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r-- | activity.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/activity.py b/activity.py index 8ef4f90..6d85d32 100644 --- a/activity.py +++ b/activity.py @@ -32,7 +32,7 @@ from sugar.graphics import style from sugar.graphics.toolbutton import ToolButton from sugar.graphics.icon import Icon -DEFAULT_CHANGE_IMAGE_TIME = 2 +DEFAULT_CHANGE_IMAGE_TIME = 1.5 POWERD_INHIBIT_DIR = '/var/run/powerd-inhibit-suspend' @@ -121,12 +121,12 @@ class ImageCollectionViewer(gtk.VBox): for fname in sorted(os.listdir(images_path)): if os.path.isdir(images_path + fname): anim_path = images_path + fname - logging.error('Animation dir file: %s', anim_path) + logging.debug('Animation dir file: %s', anim_path) animation_images_list = [] for imagefname in sorted(os.listdir(anim_path)): image_path = os.path.join(anim_path, imagefname) animation_images_list.append(image_path) - logging.error('Image file: %s', image_path) + logging.debug('Image file: %s', image_path) self.animation_list.append(animation_images_list) else: self.animation_list.append([images_path + fname]) @@ -194,8 +194,8 @@ class ImageCollectionViewer(gtk.VBox): self.show_all() - self.timer_id = gobject.timeout_add_seconds(DEFAULT_CHANGE_IMAGE_TIME, - self.auto_change_image) + 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) @@ -220,8 +220,8 @@ class ImageCollectionViewer(gtk.VBox): self.image_order = 0 self._update_image() - self.timer_id = gobject.timeout_add_seconds(DEFAULT_CHANGE_IMAGE_TIME, - self.auto_change_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): @@ -233,7 +233,9 @@ class ImageCollectionViewer(gtk.VBox): self.anim_order = 0 if self.sequence_view is not None: self.sequence_view.set_value(self.anim_order + 1) - self._update_image() + + self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) + gobject.idle_add(self._update_image) def prev_anim_clicked_cb(self, button, event): if button is not None: @@ -244,12 +246,15 @@ class ImageCollectionViewer(gtk.VBox): self.anim_order = len(self.animation_list) - 1 if self.sequence_view is not None: self.sequence_view.set_value(self.anim_order + 1) - self._update_image() + + self.get_root_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) + gobject.idle_add(self._update_image) def _update_image(self): image_file_name = \ 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)) def finish(self): self._allow_suspend() |