Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-05-27 20:13:33 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-05-27 20:13:33 (GMT)
commit32265a359884eb2354538bec39cd9f361cd8a931 (patch)
tree32af481c2ba80ea4d57b91e98140c5d2144fc893
parent76bebf384312c4f4b03ef5580e08c624e87f9498 (diff)
Fullscreen button, TODO file updated
-rw-r--r--TODO7
-rw-r--r--activity.py34
-rw-r--r--animation.py9
3 files changed, 43 insertions, 7 deletions
diff --git a/TODO b/TODO
index 2ef1ce3..fb3e07f 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,8 @@
New functions:
- Save data in journal
- Select time between frames
- - Check button for set return (In progress)
+ - Remove selected frame.
Fixes:
- - Select the frame in the list when the animation is running [DONE]
- - Use the treeselection in the place of row-selected event in treeview [DONE]
+ Void.
Bugs:
- - Show correctly indexed the selected image from the FramesList in the Animation.
+ Void.
diff --git a/activity.py b/activity.py
index 14a8c93..8c0108e 100644
--- a/activity.py
+++ b/activity.py
@@ -22,6 +22,7 @@
# MA 02110-1301, USA.
import gtk
+import gobject
from sugar.activity import activity
from sugar.activity.widgets import StopButton
@@ -101,6 +102,17 @@ class AnimateActivity(activity.Activity):
toolbarbox.toolbar.insert(options_button, -1)
separator = gtk.SeparatorToolItem()
+ separator.set_draw(True)
+ separator.set_expand(False)
+ toolbarbox.toolbar.insert(separator, -1)
+
+ fullscreen_btn = ToolButton('view-fullscreen')
+ fullscreen_btn.set_tooltip(_('Fullscreen'))
+ fullscreen_btn.connect("clicked", self._view_fullscreen)
+
+ toolbarbox.toolbar.insert(fullscreen_btn, -1)
+
+ separator = gtk.SeparatorToolItem()
separator.set_expand(True)
separator.set_draw(False)
toolbarbox.toolbar.insert(separator, -1)
@@ -158,16 +170,34 @@ class AnimateActivity(activity.Activity):
widget.set_icon("media-playback-start")
widget.set_tooltip(_("Run animation"))
- def __canvas_expose_cb(self, canvas, event):
- canvas_allocation = canvas.get_allocation()
+ def _get_animation_size(self):
+ canvas_allocation = self.get_canvas().get_allocation()
treeview_allocation = self._frames_list.get_allocation()
width = canvas_allocation[-2] - treeview_allocation[-2]
height = canvas_allocation[-1]
+ return width, height
+
+ def __canvas_expose_cb(self, canvas, event):
+ width, height = self._get_animation_size()
+
if not self._animation:
self._animation = Animation(width, height)
self._animation.show_all()
self._frames_list._animation = self._animation
canvas.pack_start(self._animation, True, True, 0)
+
+ def _view_fullscreen(self, widget):
+ self._frames_list.hide()
+ self._animation.set_size(gtk.gdk.screen_width(),
+ gtk.gdk.screen_height())
+ activity.Activity.fullscreen(self)
+
+ def unfullscreen(self):
+ self._frames_list.show()
+ width, height = self._get_animation_size()
+ self._animation.set_size(width, height)
+
+ gobject.idle_add(lambda: activity.Activity.unfullscreen(self))
diff --git a/animation.py b/animation.py
index 29b83ab..3568a6e 100644
--- a/animation.py
+++ b/animation.py
@@ -45,13 +45,20 @@ class Animation(gtk.Image):
self.images = []
self._size = width, height
- self._sleep_time = sleep_time * 1000
+ self._sleep_time = int(sleep_time * 1000)
def set_return(self, _return=True):
"""Defines if when get to the last image,
should return to the first"""
self._return = _return
+ def set_size(self, width, height):
+ """Defines animation size"""
+ self._size = width, height
+
+ # Redraw image:
+ self.set_pos(self._current_image)
+
def add_image(self, image_path):
"""Appends an image to the list"""
self.images.append(image_path)