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

Tomeu Vizoso tomeu at sugarlabs.org
Fri May 8 11:41:02 EDT 2009


On Fri, May 8, 2009 at 17:35, Bert Freudenberg <bert at freudenbergs.de> wrote:
> 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?

A bigger problem than the DS support is the UI. You currently can only
pass programatically a generic type such as Image instead of
individual mime types because the UI has only a way to change the
generic type.

Ideas?

Thanks,

Tomeu


More information about the Sugar-devel mailing list