Is there a way to filter the mime types of the objects presented with an object chooser (e.g., only png)? Here is some sample code I am using:<br><br><font size="1"><span style="font-family: courier new,monospace;">import gtk</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">import shutil</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">from sugar.graphics.objectchooser import ObjectChooser</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">class FilePicker:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def __init__(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> pass</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> def show(self):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> title = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> parent = None</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> file = None</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> chooser = ObjectChooser(title, parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> result = chooser.run()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if result == gtk.RESPONSE_ACCEPT:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> jobject = chooser.get_selected_object()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if jobject and jobject.file_path:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ext = os.path.splitext(jobject.file_path)[1]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> f, new_temp = tempfile.mkstemp(ext)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> del f</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> global _temp_files_to_clean</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> _temp_files_to_clean.append(new_temp)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> shutil.copy(jobject.file_path, new_temp)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> file = new_temp</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> finally:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> chooser.destroy()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> del chooser</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return file</span></font><br>