Search code examples
pythongtkpygtkgtktreeview

Is this possible to draw GtkTreeView listed like GtkIconView?


I am working on a GTK+ application written in python. I obviously use PyGtk. My application is about collections of videos. It's a kind of F-spot or Picasa, but for video.

As you can see in these two apps, you have a central area where you can see all of your photos with tag thumbnails under.

In my app, I want to implement the same kinf of view. For now I simply use this:

A gtk.Table containing a VBox, inside the VBox a Pixbuf (my video thumbnail) and a HBox, and inside the HBox, as many Pixbuf as tags.

It's working but it's ugly and It seems like It's not the better solution.

Looking deeply in the docs, I have found two widgets near my neeeds: IconView and TreeView. But IconView can only display one pixbuf per "row" and TreeView don't display as a grid like IconView.

My question: Is there a way to display a TreeView like an IconView (in a grid) ? How would you implement the F-spot way of arranging photos and tags under?


Solution

  • The best approach is either to stick with a table and reimplement selections or Use a custom version of IconView with a custom cellrenderer wich can take gtk.HBox().

    Some guidelines about custom cellrenderer are :

    http://faq.pygtk.org/index.py?req=show&file=faq13.045.htp

    http://faq.pygtk.org/index.py?req=show&file=faq13.056.htp

    a discuss occured on pygtk mailing list :

    htp://old.nabble.com/Drawing-widgets-in-a-custom-cellrenderer-td14207692.html

    WWWalter make a sample code : http://www.translate.org.za/blogs/walter/en/content/conquering-cellrendererwidget

    According to Ruben Vermeersch, f-pot use a modified version of IconView. Code can be found here : http://git.gnome.org/browse/f-spot/?h=icon-view-cleanup