[Sugar-devel] New Chapter in Make Your Own Sugar Activities needs review

Bert Freudenberg bert at freudenbergs.de
Wed Mar 31 12:41:49 EDT 2010


On 31.03.2010, at 17:54, James Simmons wrote:
> 
> Bert,
> 
> Last night I fixed up Sugar Commander code by removing unneeded
> backslashes and adding logic to process Journal update callbacks.
> This code will be in Sugar Commander 3, which I will not release until
> I've lived with it for awhile.  Version 2 is usable and I wanted to
> get that out the door to make up for a bug in version 1.  87 people
> downloaded version 1 and I wanted to get a fix out before anyone else
> got it.
> 
> The new code is in Git and also in the revised "Fun With The Journal"
> chapter, available for viewing here:
> 
> http://en.flossmanuals.net/bin/view/ActivitiesGuideSugar/FunWithTheJournal
> 
> I don't have an example of moving a file into the Journal (vs.
> copying) but I should have one this weekend, after I get my Income
> Taxes figured.  What I have is a significant improvement and I'd
> appreciate feedback from you or anyone else.
> 
> Thanks again for your help on this.
> 
> James Simmons

Some more inaccuracies I didn't notice the last time:

You write "For that reason you might prefer to store the high scores in a file in the instance directory". You mean the "data" directory here. The "instance" directory is not persistent, see

http://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#Writable_Directories

Also, for guessing the mime-type you do not use the same mechanism as Sugar usually does (which uses GnomeVFS, Python's default is based on the portable but less powerful "file" magic). So e.g. you do not guess the type for Etoys projects correctly ("*.pr"). The right way is:

	from sugar import mime
	file_mimetype = mime.get_for_file(filename)

I hope that's all now ;)

- Bert -




More information about the Sugar-devel mailing list