diff options
author | Daniel Francis <francis@sugarlabs.org> | 2012-05-27 02:10:08 (GMT) |
---|---|---|
committer | Daniel Francis <francis@sugarlabs.org> | 2012-05-27 02:10:08 (GMT) |
commit | bd769f3d4c78177daeab4688db21b5c26dacc897 (patch) | |
tree | 665f963d07969d2fe8129298df497ae70fd05675 | |
parent | a2636b9772395cff8188b52d9c9ed0ecdf593fb4 (diff) |
Connecting treeview with treeselection
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | frames_list.py | 10 |
2 files changed, 9 insertions, 5 deletions
@@ -2,6 +2,6 @@ New functions: - Save data in journal Fixes: - Select the frame in the list when the animation is running - - Use the treeselection in the place of row-selected event in treeview + - Use the treeselection in the place of row-selected event in treeview (In progress) Bugs: - No reported. + - Show correctly indexed the selected image from the FramesList in the Animation. diff --git a/frames_list.py b/frames_list.py index d06f064..5bc0317 100644 --- a/frames_list.py +++ b/frames_list.py @@ -32,7 +32,8 @@ class FramesList(gtk.ScrolledWindow): 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) + selection = self.treeview.get_selection() + selection.connect("changed", self._selection_changed_cb) column = gtk.TreeViewColumn("Frame") self.treeview.append_column(column) num_cell = gtk.CellRendererText() @@ -54,5 +55,8 @@ class FramesList(gtk.ScrolledWindow): gtk.gdk.INTERP_TILES) self.store.append([self.frames, preview_pixbuf]) - def _row_activated_cb(self, treeview, treepath, column): - self._animation.set_pos(treepath[0]) + def _selection_changed_cb(self, selection): + model, _iter = selection.get_selected() + self._animation.images = [i[-1] for i in self.store] + #FIXME Index out of range in Animation + self._animation.set_pos(self.store[_iter][0]) |