[Sugar-devel] Limiting Object Chooser to specified MIME types

Bert Freudenberg bert at freudenbergs.de
Fri May 8 11:35:38 EDT 2009


On 08.05.2009, at 17:03, James Simmons wrote:

> Aleksey,
>
> I was interested in your comment about wrapping Object Chooser for  
> backward compatibility.  Currently both of my Activities use Object  
> Chooser, but don't make any attempt to limit what Journal entries  
> can be chosen.  I would like to limit Read Etexts to the MIME types  
> text/plain and application/zip, and View Slides to just application/ 
> zip.  In Sayamindu's code he is using mime.GENERIC_TYPE_IMAGE.   
> There does not seem to be anything comparable that would select what  
> I want selected.  I'm looking at the code for sugar.mime here:
>
> http://api.sugarlabs.org/sugar.mime-pysrc.html
>
> I'm wondering if I could make my own filter in my own Activities  
> that would limit the Object Chooser to just plain text and Zip  
> files.  I would of course follow your suggestion for backward  
> compatibility.
>
> James Simmons

This was discussed several times, last I think in this thread:

http://lists.sugarlabs.org/archive/sugar-devel/2008-October/009118.html

IMHO it would be quite a bit more useful than the restricted interface  
we have now. You could build such a chooser yourself using the  
datastore.find(query) function. But adding a similar "query" parameter  
to the object chooser was deemed too powerful, possibly unsupportable  
once the datastore was rewrittten. Maybe a list of mime types would be  
acceptable to add, though?


- Bert -




More information about the Sugar-devel mailing list