[PyKDE] Little Python helpers for PyQt

Torsten Marek shlomme at gmx.net
Thu Jan 22 02:00:01 GMT 2004


Hello all,

I think I can safely presume that anybody of you who has been working 
extensively with PyQt has created his/her own set of little helper 
functions that proved very useful in several projects of yours, because 
I see exactly that happening with me.
For instance, I have several generator functions for walking listboxes 
and listviews (both shallow and deep) that I use very often.

My proposal and the reason I write this email would be that each of you 
who thinks that he/she has a function/class/whatever of general interest 
posts those to the list, with code and some comment.
Ongoing, we could create a small collection of pyqt-helpers which could 
then be downloaded from pykde.sf.net (or even included into PyQt, but 
that's completely up to Phil, who may forgive me my ambitions), to the 
benefit of us all.

Since it's very late I will fully post my code tomorrow, but here's one 
iterator:

def ListBoxIterator(listbox, selectedOnly = False):
     i = listbox.firstItem()
     while i:
         if selectedOnly and not i.isSelected():
             continue
         yield i
         i = i.next()
     return
It would also be possible to supply a filter function to the generator, 
what you could not do if QListBox would support the iterator protocol.



greets

Torsten
-- 
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
www.keyserver.net -- wwwkeys.eu.pgp.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 251 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20040122/2700f1f9/attachment.bin


More information about the PyQt mailing list