How to create a new MIME type for a Sugar activity?
jim.simmons at walgreens.com
Wed Feb 6 10:39:21 EST 2008
The problem is that my application does not create the Zip files filled
with images, it only reads them. 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. 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. 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.
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.
Tomeu Vizoso wrote:
>On Mon, 2008-02-04 at 11:21 -0600, James Simmons wrote:
>>I am writing a Sugar activity in Python. This activity will enable the
>>user to navigate through a list of image files stored in a Zip file by
>>using the arrow keys, and might support a slideshow feature too. There
>>might be a hundred image files stored in the Zip file. Grouping the
>>images in one file makes it much easier to deal with them in the Journal.
>>The thing is, I want this Zip file to have its own MIME type, so that:
>>1). The Etoys activity does not try to open the file, at all, ever.
>>EToys takes a long time to start up and shut down and it is really
>>annoying when I open the file with EToys instead of my own activity.
>>2). My Activity *does* open the file.
>>3). The Zip files containing images show up in the Journal with my own
>>Activity's icon, which looks like a slide projector.
>>To accomplish this I have created my Zip files with the extension
>>".slides" and I'd like to be able to use the MIME type
>>"application/slides" for such files.
>>I'm also interested in creating a reader program for Gutenberg etexts.
>>I'd like these files to have their own MIME type too so they don't get
>>opened by the Write activity by mistake. I was thinking of using a file
>>suffix of ".book" and a MIME type of "text/book" for these.
>>I tried using a mimetypes.xml file in the bundle but that didn't work.
>>I couldn't find an example of an Activity that used such a file so I'm
>>not certain I'm doing it correctly.
>>I'd appreciate any information on MIME types or on alternative
>>approaches that would solve problems 1-3. Thanks much,
>I'm not sure what's exactly your problem. In principle, if the data from
>your activity can be reused in other activities, I would call that a
>If things work as they are supposed to, without doing anything about
>mime types your journal entries should be resumed by default in your
>activity and would use your activity's icon. This is not working?
>Can you provide a link to you activity source code?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel