Re-hallo,
Ok, the case is now solved.

I made the model too complicated.
I need only to create gtk.ListStore() and that's it. There is no need to go via model_sort.

model_sort = gtk.TreeModelSort(model) self.set_model(model_sort)
This works really well:

       model = gtk.ListStore(gobject.TYPE_STRING, # Filename
                     gtk.gdk.Pixbuf,  # Icon image
                     gobject.TYPE_FLOAT, # File date
                     gobject.TYPE_INT) # File size

       self.set_tooltip_column(COL_THUMB_FILENAME)
       self.set_text_column(COL_THUMB_FILENAME)
       self.set_pixbuf_column(COL_THUMB_PIXBUF)

       self.set_model(model)

       # Make iconview sortable

# Compare function is not actually needed. The default (internal cmp) function is good enough. # model.set_sort_func(COL_THUMB_FILENAME, self.default_sort_compare_func) # model.set_sort_func(COL_THUMB_FILESIZE, self.default_sort_compare_func) # model.set_sort_func(COL_THUMB_FILEDATE, self.default_sort_compare_func)

       # Set default sort order
       model.set_sort_column_id(COL_THUMB_FILESIZE, gtk.SORT_ASCENDING)
----
Here is a fully functional test code: http://www.futuredesktop.com/tmp/Test6-good.tar.gz
It rocks!

Thanks,
  Osmo (Moma) Antero M
  Grønland, Norway


Osmo Maatta wrote:
Hello,

I have a small application that shows thumbnail-images in a gtk.IconView widget. The thumbnails are sortable on filename, file size and date. The sorting seems to work fine.

But the program crashes when I try to reload the thumbnails.

Here is a picture of the application.
http://bildr.no/view/595635
When I press the [Reload thumbnails] button 2'nd time, the program crashes with "Segmentation fault". No other error messages appear.

The crash happens at self.clear_display() function. It simply finds the model/ListStore and clears it.

model_sort = self.get_model()
model = model_sort.get_model()
model.clear()

Can you help me to spot the error.

The first version was un-sortable and it worked very well. But I really want to make it sortable.
Here is a test-code: http://www.futuredesktop.com/tmp/Test6.zip
My system is Ubuntu Linux 9.10, 64bit.
-----
Most kindly
  Moma Antero

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to