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

Eben Eliason eben at laptop.org
Fri May 8 11:56:39 EDT 2009


PS. The upside-down Paint icon in that mockup is meant to indicate
that there is some other activity which handles the SVG type, and this
is a stand-in icon for that. Don't take it in  a literal sense.

Eben


On Fri, May 8, 2009 at 11:53 AM, Eben Eliason <eben at laptop.org> wrote:
> Actually, that's not entirely true.  This was considered in the design
> for the object chooser, as can be seen here:
> http://wiki.sugarlabs.org/go/Design_Team/Designs/Object_Chooser#03
>
> In addition to specifying the generic type, the intent was to also
> allow a boolean which determined whether or not the "kind" menu
> remained enabled, and the passing of an array of supported mime types.
> This slide illustrates how images of a non-supported type are shown in
> the list, but rendered inactive and therefore un-selectable.
>
> As a technical note, any mime types passed which are not a subset of
> the generic type will simply be ignored.
>
> Eben
>
>
> On Fri, May 8, 2009 at 11:41 AM, Tomeu Vizoso <tomeu at sugarlabs.org> wrote:
>> 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
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>


More information about the Sugar-devel mailing list