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 00:58:15 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-05-27 00:58:15 (GMT)
commitf4eeb4218e0c3987f003f3cab5ec73b48e9bc275 (patch)
tree92a9d86c0c59d2a2a70f2a6ad5034d0bc5300ef1
parentafdcf8cbea2aca30193f83066f951acc0f032746 (diff)
Stupid bug fixed!
Changes: - FIXME 1, fixed - FIXME 2, fixed Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
-rw-r--r--TODO4
-rw-r--r--activity.py12
-rw-r--r--frames_list.py12
3 files changed, 12 insertions, 16 deletions
diff --git a/TODO b/TODO
index d66cdf9..d0f091c 100644
--- a/TODO
+++ b/TODO
@@ -2,7 +2,7 @@ New functions:
- Add and remove frames from the Treeview. (In progress)
- Connect the selected image in the FramesList to the animation canvas.
Fixes:
- - Don't sets the images when are just added
- - Can't pause the animation (source_remove doesn't works)
+ - Don't sets the images when are just added (Fixed)
+ - Can't pause the animation (Fixed)
Bugs:
- Don't shows the correct always when the List is clicked
diff --git a/activity.py b/activity.py
index 204e82d..ddb4d05 100644
--- a/activity.py
+++ b/activity.py
@@ -82,6 +82,8 @@ class AnimateActivity(activity.Activity):
canvas = gtk.HBox()
+ self._animation = None
+
self._frames_list = FramesList()
self._frames_list.show()
canvas.pack_end(self._frames_list, False, True, 0)
@@ -99,14 +101,13 @@ class AnimateActivity(activity.Activity):
if result == gtk.RESPONSE_ACCEPT:
jobject = chooser.get_selected_object()
pixbuf = gtk.gdk.pixbuf_new_from_file(jobject.get_file_path())
- self._frames_list.add_frame(pixbuf, jobject.get_file_path())
+ self._frames_list.add_frame(pixbuf)
+ self._animation.add_image(jobject.get_file_path())
else:
return
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")
@@ -124,8 +125,9 @@ class AnimateActivity(activity.Activity):
width = canvas_allocation[-2] - treeview_allocation[-2]
height = canvas_allocation[-1]
- self._animation = Animation(width, height)
- self._animation.show_all()
+ 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)
diff --git a/frames_list.py b/frames_list.py
index 10b715b..d06f064 100644
--- a/frames_list.py
+++ b/frames_list.py
@@ -29,7 +29,7 @@ class FramesList(gtk.ScrolledWindow):
super(FramesList, self).__init__()
self.set_size_request(225, -1)
self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- self.store = gtk.ListStore(int, gtk.gdk.Pixbuf, str)
+ self.store = gtk.ListStore(int, gtk.gdk.Pixbuf)
self.treeview = gtk.TreeView(self.store)
self.set_vadjustment(self.treeview.get_vadjustment())
self.treeview.connect("row-activated", self._row_activated_cb)
@@ -37,28 +37,22 @@ class FramesList(gtk.ScrolledWindow):
self.treeview.append_column(column)
num_cell = gtk.CellRendererText()
preview_cell = gtk.CellRendererPixbuf()
- path_cell = gtk.CellRendererText()
column.pack_start(num_cell)
column.pack_start(preview_cell)
- column.pack_start(path_cell)
column.add_attribute(num_cell, 'text', 0)
column.add_attribute(preview_cell, 'pixbuf', 1)
- column.add_attribute(path_cell, 'text', 2)
- path_cell.set_property('visible', False)
self.treeview.show()
self.add(self.treeview)
self.frames = 0
- def add_frame(self, pixbuf, imagepath):
+ def add_frame(self, pixbuf):
self.frames += 1
width = pixbuf.get_width()
height = pixbuf.get_height()
preview_pixbuf = pixbuf.scale_simple(200,
200 * height / width,
gtk.gdk.INTERP_TILES)
- self.store.append([self.frames, preview_pixbuf, imagepath])
+ self.store.append([self.frames, preview_pixbuf])
def _row_activated_cb(self, treeview, treepath, column):
- #FIXME: I don't show the correct image always
- self._animation.images = [i[-1] for i in self.store]
self._animation.set_pos(treepath[0])