man, 09 03 2009 kl. 18:33 +0100, skrev Timo:
> In my program, the user can enter a date in a entry (and some other data 
> too) and it'll append in a liststore/treeview.
> I'm having problems sorting this date column. Since notations of dates 
> are different around the world ( dd/mm/yyyy, mm/dd/yy, dd-mm/yy, etc.), 
> how can this be done?
> Do I have to replace the entry with 3 spinbuttons perhaps? But how can I 
> put them all in one column together, and to be sortable?

Add yet another column to your *liststore*, and use that model column
for sorting of the visible treeview column.

Depending on your application, using an integer containing seconds since
epoch[1] may be fitting, alternately you can use a string containing an
ISO date (YYYY-MM-DD, 2009-03-09 for today in my timezone), that works
very well for sorting. It doesn't really matter, as it won't be visible
for users.


[1]: As returned by time.time() from the time module for current UTC
     time.


Stefan

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

Reply via email to