GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Jul 22, 2014 3:30 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: VBox + Widgets vs. gtk.Listview and custom CellRenderer
PostPosted: Thu Aug 27, 2009 2:56 pm 
Offline

Joined: Thu Apr 23, 2009 2:08 pm
Posts: 3
Hi!

I am writing a PIM-Viewing allpication with pyGTK desigend to give the user a fast overview of what there is upcoming (currently Events, Planned are ToDo's, feeds, etc.)

So my question is how to best store and with which widget to present the data to the user. I am currently using a custom widget (AgendaListView) which is in turn a VBox which again holds custom widgets for each day (DateWidget), which again is basically a VBox that hold the single events (EventWidget) (please check google-code and seach for "gnome-agenda". Sorry but I'm not allowed to post the link).
My question now is if I can/should use a gtk.ListView with a custom cell renderer instead. The reason is, that my code is gaining complexity as I want to insert new Events on the fly, and there is some overhead in keeping the ListView and DateView sorted if new events are added.

So far I have rebuild the whole AgendaListView on each redraw which is not a nice way to do it.

Since I have not really used gtk.ListViews I'm not sure if they support what I need and before I reimplement the whole stuff I wanted to get some ideas.

I would really appreciate any comments.

This is my first post here so excuse me if this has been covered before.

best,
flocki


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 27, 2009 3:23 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hello and welcome to the GTK+ forums.

This is certainly something that can be achieved by GtkTreeView and custom cell renderer. That is, if you're not afraid of doing a heart transplant on your application, since this move will require move of your event data into GtkListStore or GtkTreeStore.

I peeked at your code and I must say that using GtkTreeView might radically improve performance, since you no longer need a heap of widgets to display things.

Tadej


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 27, 2009 3:30 pm 
Offline

Joined: Thu Apr 23, 2009 2:08 pm
Posts: 3
Thanks for the quick answer! Do you have any good resources, howto's? The pyGTK tutorial does not really cover this...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 27, 2009 6:08 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

I don't know where to find Python related stuff, but I know my way around in C docs. I hope they will be of some value to you.

You should have quite solid knowledge about GtkTreeView and it's MVC design (mapping data in store to cell renderers, manipulating stored data, ...). You can get some good quality info here: http://scentric.net/tutorial. Tutorial also describes sorting, but if you find yourself in need of filtering, I wrote a tutorial on this topic: http://tadeboro.blogspot.com/2009/05/gtktreemodel-and-filtering.html (BTW, any input on this tutorial is greatly appreciated).

Tree view tutorial also contains instructions on writing custom cell renderer: http://scentric.net/tutorial/sec-custom-cell-renderers.html. But I found official GtkCellRendererPixbuf much better reference.

I hope this helps a bit. Of course you can always post again here and we'll try to help you. I'm not too proficient with Python, but if the need arises, I can put together a few PyGTK lines too;)

Tadej


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group