Re: [pygtk] gtk.IconView random segfault

2008-07-10 Thread Felipe Reyes
El mié, 09-07-2008 a las 17:08 -0700, Mitko Haralanov escribió:
> On Wed, 09 Jul 2008 19:41:31 -0400
> I guess it is possible for the locking to add overhead since the entire
> gtk uses one master lock.
> Also, are you sure that it's the locks? Have you been able to load all
> 2500 images before without segfaults so you can measure the time?
> The alternative would be to not use a separate thread for loading the
> model.
yes, I could load the images without segfaults and without locks, but
just a few times, and now with the locks doesn't segfault.

I don't want to use the main thread to load the model, because it will
give the sensation of a hangup application, because there are to many
images, so I will have to live with the overhead produced by the
locks :)

thanks again.
regards,
-- 
Felipe Reyes Astorga
counter.li.org #316380


signature.asc
Description: Esta parte del mensaje está firmada	digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] gtk.IconView random segfault

2008-07-09 Thread Mitko Haralanov
On Wed, 09 Jul 2008 19:41:31 -0400
Felipe Reyes <[EMAIL PROTECTED]> wrote:

> Yes, with the locks everything works fine, but the locks added some
> overhead (about 10 secons when loading 2500 pictures), I suppose that
> this is normal, right?

I guess it is possible for the locking to add overhead since the entire
gtk uses one master lock.
Also, are you sure that it's the locks? Have you been able to load all
2500 images before without segfaults so you can measure the time?
The alternative would be to not use a separate thread for loading the
model.

-- 
Mitko Haralanov
==
Everybody needs a little love sometime; stop hacking and fall in love!
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] gtk.IconView random segfault

2008-07-09 Thread Felipe Reyes
El mié, 09-07-2008 a las 16:02 -0700, Mitko Haralanov escribió:
> On Tue, 08 Jul 2008 19:57:23 -0400
> Felipe Reyes <[EMAIL PROTECTED]> wrote:
> 
> > I added a test case that shows (at least on my system) my trouble.
> > 
> > somebody can give me a clue?
> 
> The issue is locking. Changing the code to this seems to have solved
> the problem:
> 
> class FillListStore(threading.Thread):
> def run(self):
> gtk.gdk.threads_enter ()
> model.clear()
> for i in range(600):
> a = random.randint(0, len(img)-1)
> model.append
> ([gtk.gdk.pixbuf_new_from_file_at_size(rootdir + img[a], 64, 64),
>str (i)])
> gtk.gdk.threads_leave ()
> 
> thread = FillListStore()
> thread.start()
> win.show_all()
> gtk.gdk.threads_enter ()
> gtk.main()
> gtk.gdk.threads_leave ()
> 
Yes, with the locks everything works fine, but the locks added some
overhead (about 10 secons when loading 2500 pictures), I suppose that
this is normal, right?

regards,
-- 
Felipe Reyes Astorga
counter.li.org #316380


signature.asc
Description: Esta parte del mensaje está firmada	digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] gtk.IconView random segfault

2008-07-09 Thread Mitko Haralanov
On Tue, 08 Jul 2008 19:57:23 -0400
Felipe Reyes <[EMAIL PROTECTED]> wrote:

> I added a test case that shows (at least on my system) my trouble.
> 
> somebody can give me a clue?

The issue is locking. Changing the code to this seems to have solved
the problem:

class FillListStore(threading.Thread):
def run(self):
gtk.gdk.threads_enter ()
model.clear()
for i in range(600):
a = random.randint(0, len(img)-1)
model.append ([gtk.gdk.pixbuf_new_from_file_at_size(rootdir + 
img[a], 64, 64),
   str (i)])
gtk.gdk.threads_leave ()

thread = FillListStore()
thread.start()
win.show_all()
gtk.gdk.threads_enter ()
gtk.main()
gtk.gdk.threads_leave ()


-- 
Mitko Haralanov
==
67. Well, _my_ files were backed up.

--Top 100 things you don't want the sysadmin to say
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] gtk.IconView random segfault

2008-07-08 Thread Felipe Reyes
hi folks,

I'm writing a software that uses gtk.IconView to show images (my photo
collection, so there are over 1000 pictures), and I'm experimenting
random segfaults with gtk.IconView and I can not figure it out the
reason, please if somebody has some tip on how to debug this.

I added a test case that shows (at least on my system) my trouble.

somebody can give me a clue?

thanks in advance
-- 
Felipe Reyes Astorga
counter.li.org #316380
import gtk
import threading
import os
import random

gtk.gdk.threads_init()

rootdir = "/usr/share/pixmaps/faces/"
img = os.listdir(rootdir)

win = gtk.Window()
win.set_size_request(300, 300)
scroll = gtk.ScrolledWindow()
iconview = gtk.IconView()
model = gtk.ListStore(gtk.gdk.Pixbuf, str)

win.add(scroll)
scroll.add_with_viewport(iconview)

iconview.set_model(model)
iconview.set_pixbuf_column(0)
iconview.set_text_column(1)

win.connect("delete-event", gtk.main_quit)

class FillListStore(threading.Thread):
def run(self):
model.clear()
for i in range(600):
print i
a = random.randint(0, len(img)-1)
model.append([gtk.gdk.pixbuf_new_from_file_at_size(rootdir + img[a], 64, 64),
  str(i)])


thread = FillListStore()
thread.start()
win.show_all()
gtk.main()


signature.asc
Description: Esta parte del mensaje está firmada	digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/