|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
problem with listStore append in a treeviewHello,
I have one more question on the use of the treeview with a listStore model. When I want to append a big amount of rows, for instance 100, the appeend method it is extremely slow inside a loop.. I tried to use this code: treeview.freeze_child_notify()from taken from this page: http://faq.pygtk.org/index.py?req=show&file=faq13.043.htp but it's still slow! Is there any other technique that may can help me? Another widget instead of treeview maybe? I just only want to have a list with rows that I can make some actions by double clicking on them. Thank you in advance, Thanasis _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewOn Wed, Oct 28, 2009 at 4:33 PM, Petsas Athanasios <petsas@...> wrote:
> Hello, > > I have one more question on the use of the treeview with a listStore model. > When I want to append a big amount of rows, for instance 100, the appeend > method it is extremely slow inside a loop.. > > I tried to use this code: > > treeview.freeze_child_notify() > treeview.set_model(None) > > # Add rows to the model > # ... > > treeview.set_model(model) > treeview.thaw_child_notify() > > from taken from this page: > http://faq.pygtk.org/index.py?req=show&file=faq13.043.htp > but it's still slow! Appendiing 100 rows should be fast. The only thing I can think of that would make this noticeably slow is if the ListStore is sorted, in which case you should disable sorting while doing the appends. -- Neil Muller drnlmuller@... I've got a gmail account. Why haven't I become cool? _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewI disabled sorting while doing the appends is happening, but it's still slow. Maybe some calls in my
code must be in a different order.. Have a look: # create a liststore with one string column to use as the model liststore = gtk.ListStore(str, int) liststore.set_default_sort_func(None) # create the TreeView using liststore treeview = gtk.TreeView(liststore) treeview.set_size_request(300, 200) treeview.set_reorderable(False) treeview.connect('row-activated', self.selectItem, object_list) # create a CellRenderer to render the data cell = gtk.CellRendererText() # create the TreeViewColumns to display the data column = gtk.TreeViewColumn('List of Objects (identifiers)', cell, text=0) # column.set_sort_column_id(0) treeview.append_column(column) # freeze the tree and detach the model to add some rows... treeview.freeze_child_notify() treeview.set_model(None) # Add the items to the liststore i=0 rows=[] for row in object_list)): liststore.append( [row.identifier, i]) i+=1 treeview.set_model(liststore) treeview.thaw_child_notify() treeview.show() # make a scrolled window container to pack th treeview, # so tha it supports scolling scrolledwindow = gtk.ScrolledWindow() scrolledwindow.add(treeview) hbox.pack_start(scrolledwindow, False, 5, 5) ------------------------------------------------------------------------------------------------------------- object_list is a list that contains some objects with some attributes.. Thank you, Thanasis On Wed, Oct 28, 2009 at 5:20 PM, Neil Muller <drnlmuller%2Bgtk@...> wrote:
_______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeview> > from taken from this page: > http://faq.pygtk.org/index.py?req=show&file=faq13.043.htp > but it's still slow! How slow? How are you measuring the speed? John _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewOn Wed, Oct 28, 2009 at 07:15:55PM +0200, Petsas Athanasios wrote:
> I disabled sorting while doing the appends is happening, but it's still slow. > Maybe some calls in my > code must be in a different order.. Have you atk enabled? It seems strange but when I enabled atk sqlkit loading was extremly slow. I even opened a ticket but I was unable to produce a short sample of code that chowed the problem. Do you have a simple working example? sandro -- Sandro Dentella *:-) http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewabout 2 minutes is required for a treeview of 83 rows! :(
On Wed, Oct 28, 2009 at 7:42 PM, John Stowers <john.stowers.lists@...> wrote:
_______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewhmm! What is atk? I don't know if it is enabled.. But surely I don't have the packet
python-atk if you mean this.. On Wed, Oct 28, 2009 at 7:52 PM, Alessandro Dentella <sandro@...> wrote:
_______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewOn Wed, 2009-10-28 at 20:12 +0200, Petsas Athanasios wrote:
> about 2 minutes is required for a treeview of 83 rows! :( The following took 0.0 seconds. I think you need to post more of your code. I would not be surprised if the slowdown was coming from elsewhere. John import gtk tv = gtk.TreeView() ls = gtk.ListStore(str, int) tv.append_column(gtk.TreeViewColumn('A', gtk.CellRendererText(), text=0)) tv.append_column(gtk.TreeViewColumn('B', gtk.CellRendererText(), text=1)) for i in range(100): ls.append( ("FOO%d" % i, i) ) tv.set_model(ls) w = gtk.Window() w.add(tv) w.show_all() gtk.main() > > On Wed, Oct 28, 2009 at 7:42 PM, John Stowers > <john.stowers.lists@...> wrote: > > > > > from taken from this page: > > http://faq.pygtk.org/index.py?req=show&file=faq13.043.htp > > but it's still slow! > > > How slow? How are you measuring the speed? > > John > > > _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewOn Wed, Oct 28, 2009 at 08:14:13PM +0200, Petsas Athanasios wrote:
> hmm! What is atk? the accessibility toolkit > I don't know if it is enabled.. But surely I don't have the > packet > python-atk if you mean this.. I don't have it eather. When I enabled it was throught gnome panel preferences/assistive technologies (I don't have an english desktop to say how it was exactly) Do you have the load of the machine going up in those 2 minutes? It *really* seems like the probelm I had. On which OS/environment are you working? Can you produce a simple code? sandro *:-) -- Sandro Dentella *:-) http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewYou are right! I try your code with my list and is is very slowly, and that's because the iteration of my list is slowly. The objects that the list has is SOAPpy objects I guess. I haven't done the implementation of the objects etc. What I have to do is the graphical interface for that application... So thank you all.. That was my fault. i will see what can I do... On Wed, Oct 28, 2009 at 8:20 PM, John Stowers <john.stowers.lists@...> wrote:
_______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
|
|
Re: problem with listStore append in a treeviewThank you all!! I solved the problem. the iteration of the object_list
was very slow, so, I create a string and I assigned to it the object_list.. Afterwards, with regular expressions I created a list with the identifiers of the objects ans I add them to the listStore! Thank you all for the help! The code of john Stowers made me to examine my code more carefully :)! Thanasis On Wed, Oct 28, 2009 at 8:34 PM, Alessandro Dentella <sandro@...> wrote: On Wed, Oct 28, 2009 at 08:14:13PM +0200, Petsas Athanasios wrote: _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ |
| Free embeddable forum powered by Nabble | Forum Help |