Hi,
I'm using gtk.FileChooserDialog with a filter to display only "text/plain"
files and this works fine:

filter = gtk.FileFilter()
filter.add_mime_type("text/plain")
chooser.add_filter(filter)

But if I need to check if a file is of this mime type, using python module
mimetypes is not so good in detecting the proper mime type.

Is it possible somehow to use gtk.FileChooser engine to retrieve files with
a mime type in a directory without going through the dialog?

I tried to do it without running the dialog and just doing:

...
chooser.add_filter(filter)
chooser.set_current_folder(foldername)
chooser.select_all()
print chooser.get_filenames()

but I always get an empty list, it seems that without chooser.run() it
doesn't work, unfortunately I cannot instantiate just a gtk.FileChooser()

Cheers,
Giuseppe.
_______________________________________________
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