[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] Little Python helpers for PyQt
From:       Torsten Marek <shlomme () gmx ! net>
Date:       2004-01-22 0:58:02
Message-ID: 400F201A.2060509 () gmx ! net
[Download RAW message or body]

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@gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
www.keyserver.net -- wwwkeys.eu.pgp.net


[Attachment #3 (application/pgp-signature)]
_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic