[Sugar-devel] Limiting Object Chooser to specified MIME types
James Simmons
jim.simmons at walgreens.com
Fri May 8 11:03:33 EDT 2009
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 Message: 3 Date:
Fri, 8 May 2009 02:39:41 +0000 From: Aleksey Lim
<alsroot at member.fsf.org> Subject: Re: [Sugar-devel] [RELEASE] [Sucrose
0.85] Imageviewer 10 To: sugar-devel at lists.sugarlabs.org Message-ID:
<20090508023940.GA17000 at antilopa-gnu> Content-Type: text/plain;
charset=us-ascii On Fri, May 08, 2009 at 12:37:00AM +0000, Aleksey Lim
wrote:
> > On Fri, May 08, 2009 at 01:50:44AM +0530, Sayamindu Dasgupta wrote:
>
>> > > Hello all,
>> > > I have released ImageViewer activity version 10.
>> > > This release has support for sharing file sharing.
>> > >
>> > > This is a major new functionality (feature freeze break) so I'm
>> > > releasing it as a part of 0.85. However, this works fine with 0.82
>> > > and above.
>>
> > it doesn't work with XO-767(sugar-0.82 can't use mime types in object
> > chooser), so I marked it "only 0.84" on ASLO
> >
> > you can wrap object chooser code into try..except
> > and make it runnable on 0.82(and upload new version to ASLO)
>
Just an option - you can use sugar-port[1] API for object chooser instead of
native from sugar.
In that case you should create "port" directory and place there chooser.py
file from sugar-port project and use it according to [2].
On 0.84 it will open ObjectChooser with preselected mime type, on 0.82
just open ObjectChooser w/o errors.
[1] http://wiki.sugarlabs.org/go/Development_Team/sugar-port
[2] http://people.sugarlabs.org/~alsroot/sugar-port/port.chooser-module.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20090508/36763b87/attachment.htm
More information about the Sugar-devel
mailing list