[Sugar-devel] Sugar-devel Digest, Vol 10, Issue 16

Jim Simmons nicestep at gmail.com
Tue Aug 4 10:27:12 EDT 2009


Sumit,

I had a similar problem in Read Etexts and ended up solving it using a
similar approach to what you are proposing.  I wanted my Activity to
save and restore the current page number.  I ended up putting the page
number, preceded by a "P", at the end of my title.  I used the "P" so
that titles that ended in numbers could be distinguished from titles
that ended in a number (1984, for example).

I would not use either of the tags you are proposing to use, because
they *are* used by Sugar.  You might put a code at the end of the
title like I do, or you might put something in the "tags" or
"description" fields, which can be modified by the user but most of
the time probably are not.

.84 solves the problem you refer to.

James Simmons


> Date: Tue, 4 Aug 2009 06:39:25 +0530
> From: sumit singh <sumit.coder at gmail.com>
> Subject: [Sugar-devel] Can I use the keep or title_set_by_user key of
>        metadata to store info about my activity
> To: Tomeu Vizoso <tomeu at sugarlabs.org>,
>        sugar-devel at lists.sugarlabs.org,        devel at lists.laptop.org
> Cc: Manusheel Gupta <manu at laptop.org>
> Message-ID:
>        <b694aa9e0908031809n652b6c92h3e753b376e03a931 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Tomeu,
>
> This is in continuation with our chat yesterday. The write/report
> activity would be having 3 states , I mean whether the user is working
> on a blank document , designing a new template or using a previously
> designed template. So, what I wanted was to save this state as well
> while saving the activity using the write_file method, so that when I
> resume my activity from the journal , i should switch over directly to
> that state where the user closed the activity.
>
> The only idea I was getting to achieve that was to save the state as a
> number in the metadata file and then retrieving it from read_file fn ,
>  however as I cannot add new keys in 0.82 version as they are lost
> over restarts of xo, so I was planning to use the keep or the
> title_set_by_user key of the metadata as I didn't find them getting
> used anywhere. However, I am not sure whether these are used for some
> important work internally by sugar. What do you think would it be safe
> to use any of these 2 key values. Is there any other way to achieve
> this other than this on 0.82.
>
> I think I can use the hasattr fn to distinguish b/w 0.82 and 0.84 and
> do so only if it is a 0.82 version while adding a new key instead in
> 0.84 version. Kindly give your suggestions.
>
>
>
> Regards,
> sumit.


More information about the Sugar-devel mailing list