parogers / pgu

Automatically exported from code.google.com/p/pgu
GNU Lesser General Public License v2.1
89 stars 37 forks source link

Suggestions for improving FileDialog (filtering) #33

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if the FileDialog could provide a simple filtering mechanism.  
I have attached two patches to do this.

The first patch provides a very simple and crude filter mechanism (simply set 
path_filter to a function that returns a bool - True => file/dir is shown, 
False => it is hidden).

The second patch extends this to provide an file-extension filter by accepting 
a simple list as argument for the constructor.  Example being:

        ext_f = [
           ("Images", ("jpg", "jpeg", "png")),
           ("Audio", ("mp3", "wav")),
           ("Text files", "txt"),
           ]
        dialog = FileDialog(value="path/to/resources", ext_filter=ext_f)

The user can then choose the relevant filter from a "drop-down" box (a Select 
in pgu terms).

Original issue reported on code.google.com by NThykier@gmail.com on 7 Dec 2012 at 1:09

Attachments:

GoogleCodeExporter commented 9 years ago
Small test script for demonstrating the second patch.

Original comment by NThykier@gmail.com on 7 Dec 2012 at 1:14

Attachments: