After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 666916 - Selecting unused clips doesn't work if the media library is in treeview mode
Selecting unused clips doesn't work if the media library is in treeview mode
Status: RESOLVED FIXED
Product: pitivi
Classification: Other
Component: Media library
Git
Other Linux
: Normal minor
: 0.91
Assigned To: Pitivi maintainers
Pitivi maintainers
Depends on:
Blocks:
 
 
Reported: 2011-12-27 17:40 UTC by Jean-François Fortin Tam
Modified: 2012-01-14 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jean-François Fortin Tam 2011-12-27 17:40:21 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.
Comment 1 Christoph Reiter (lazka) 2012-01-12 20:10:23 UTC
try "model = self.treeview.get_model()" instead of "model = self.storemodel" in line 895
Comment 2 Jean-François Fortin Tam 2012-01-12 20:36:55 UTC
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.
Comment 3 Christoph Reiter (lazka) 2012-01-12 21:23:25 UTC
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.
Comment 4 Jean-François Fortin Tam 2012-01-13 02:29:54 UTC
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.
Comment 5 Christoph Reiter (lazka) 2012-01-13 11:57:08 UTC
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).
Comment 6 Jean-François Fortin Tam 2012-01-14 22:57:35 UTC
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)