Recent Updates to Sugar Almanac

James Simmons jim.simmons at walgreens.com
Mon Jun 16 17:27:54 EDT 2008


Faisal,

/* You can download or save a file to a particular location and then 
change the self._jobject.file_path variable (as the Read activity does).

*/The Read activity only does the self.jobject.file_path variable when 
receiving a shared document.  I wish I had a really old version of Read 
Etexts to show you.  Unfortunately, by the time I got my git repository 
I already had the sharing code in there.  But basically you don't need 
to do anything special to do a write_file() that doesn't write a file.  
You just need a Journal entry that exists and has a MIME type.  Then you 
have an Activity that can resume any Journal entry with that MIME type.  
The core Read activity doesn't make PDFs.  It just reads them.  Then, 
when it closes down write_file() it saves the current page number as 
metadata.  No file is saved.

self._jobject has nothing to do with it.

Activities that only read Journal entries are a bit unusual.  I know a 
bit about them because I've written two (Read Etexts and View Slides).  
And there are occasions when you need to write a file.  You cannot 
create a Journmal entry without writing a file.  Even in the Read 
activity if you press the Save button on the Edit toolbar you'll get an 
error because Read is being asked to create a new Journal entry and it 
has no code to do this.

As for using a file to store meta data, I'm not pushing it as a best 
practice, but a practical expedient until metadata starts working 
better.  Several Activities already do this.  In your Music activity I 
would save an empty file and use metadata, as you suggest.  Eventually 
that file would be replaced with one that had music in it.  In an 
adventure game program I would save all the state information in a file, 
and could easily put other kinds of meta data in there too.

James Simmons
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080616/520fe25d/attachment.html>


More information about the Devel mailing list