How to create a new MIME type for a Sugar activity?

Tomeu Vizoso tomeu at tomeuvizoso.net
Wed Feb 6 11:03:02 EST 2008


On Wed, 2008-02-06 at 09:39 -0600, James Simmons wrote:
> Tomeu,
> 
> The problem is that my application does not create the Zip files
> filled with images, it only reads them.

Oh, now I see.

> I had noticed that when I put a flash drive containing hundreds of
> images into my XO that it thrashed for quite a bit and wouldn't let me
> open any apps until it was done.  I would guess that it was creating
> journal entries for each one.

Yup, we have some ticket about that.

> It seems to me that Sugar is better suited to dealing with individual
> files than collections of files, which is how I hit on the idea of
> putting the collections in Zip files. 

Yes, we don't have yet in the journal the concept of collection of
objects. This is planned to be added soon.

> I use a separate Linux box to make the files using this command:
> 
> zip filename.slides *.jpg
> 
> Then I copy filename.slides to my flash drive so I can browse the
> images on the XO.  I have a straight Python version of my app that I
> can run on the XO from the console, and an Activity version that works
> just fine from Xbuntu's Sugar Simulator when I use the MIME type of
> application/zip.  (No Etoys is installed there).  The problem is that
> it is all too easy to launch Etoys on my file on the XO, and that is a
> pain.  I was hoping for a way to have the *.slides files linked only
> to my app, even though my app did not create them.  I don't see how my
> app *could* create a Zip file containing a list of images.  It doesn't
> seem like something an Activity could do.

Ok, so what if your activity registers into the mime registry a new type
like application/x-slide-activity associated to the *.slide glob? That
can be done in the mimetypes.xml file. And then your activity should add
this mime to the activity.info.

In this way, the journal will recognize these files as that type, and
will open them with you activity.

> I'd be happy to share the code for my activity with you, but I don't
> think it would shed any light on anything.  Basically it uses pygtk to
> open a Zip file, navigate through the list of files in response to the
> arrow keys on the keyboard, extract the current file to a temp
> directory and display it resized to fit the current resolution of the
> screen.  Then it deletes the temporary file.  That way you can browse
> through the images in sequence.  I had thought of putting in a
> slideshow feature too.  The problem is getting the program to run by
> resuming the file from the Journal.
> 
> I'm using my work email account and the application is at home.  I can
> send it to you as an attachment later if you still think it would
> help.

No problem, I was just confused about what you wanted to do.

Regards,

Tomeu




More information about the Devel mailing list