GNOME Bugzilla – Bug 666916
Selecting unused clips doesn't work if the media library is in treeview mode
Last modified: 2012-01-14 22:57:35 UTC
If the clips are displayed as a listview in the media library, trying to use the "select unused clips" feature (in either pitivi 0.15 or pitivi GES) will select all the clips in the library and cause this traceback: TypeError: could not convert type long to (null) required for parameter 0 /home/jeff/dev/pitivi/pitivi/ui/sourcelist.py:776: GtkWarning: gtk_tree_model_filter_get_path: assertion `GTK_TREE_MODEL_FILTER (model)->priv->stamp == iter->stamp' failed selection.unselect_iter(row.iter) To be reevaluated with the port to GTK3.
try "model = self.treeview.get_model()" instead of "model = self.storemodel" in line 895
Wow... your suggested fix works. What I don't quite understand, however, is that elsewhere in that file (medialibrary.py), "model = self.storemodel" is used all over the place and it works. Do you have an idea why it would work in those cases but not this particular one? I'm left wondering if I should replace all those occurrences.
Line 863, 929, 1114, 1247, 1267 seem to be wrong too. The paths you get from selection are indexes for the attached model, a filter model in both icon/treeview setups, and not the base model. Is the search/filter entry actually used in the UI? Everything selection based shouldn't work right if something gets filtered in between.
Yeah, the filtering is used in the UI and (interestingly enough) it actually works fine (even preserving search results or selections when switching between icon and tree views)! That's the slightly strange thing: I could replace everything on all the lines you suggested (but *not* on line 796 for _sourceRemovedCb), but it would not seem to make any difference in terms of behavior.
Well, lets look at "_playButtonClickedCb" for example: your model includes [a, b, c], you enter a search term so that only [a, c] are shown in the list and select c. you call _playButtonClickedCb somehow, which will get the selected paths [(1,)], call the base model with model[(1,)] and get b instead of c. The two possible solutions are to pass the path to the filter model, which includes everything that is shown, or you convert the filter path to the original path using base_path = filter_model.convert_path_to_child_path(filter_path).
I pushed a fix based upon your suggestions. Hopefully I've done it right. I tested this from pretty much every angle trying to break it, and it seems to work no matter what, so I'll call it a day :) thanks for the help Christoph! commit afc79d65027721bbe63e7be2fc6609ebfaa06b46 Author: Jean-François Fortin Tam <nekohayo@gmail.com> Date: Thu Jan 12 15:51:27 2012 -0500 When possible, get the store model reference directly from GTK Fixes bug #666916 (selecting unused clips in treeview mode)