[Sugar-devel] [ASLO] Release Sugar Commander-8

James Simmons nicestep at gmail.com
Tue Aug 9 15:55:42 EDT 2011


All,

In addition to updating this Activity I have modified the web version of
"Make Your Own Sugar Activities" in the chapter "Fun With The Journal" as
follows:
NOT Adding A Journal Entry

*Note: the technique described in this section is broken in some versions of
Sugar.  If you use this technique your Activity will not work on those
versions.  The technique is documented and should be supported in every
version of Sugar, but there is a certain risk in using it.*

*In addition to the risk, there is a school of thought that Activities
should always leave behind a Journal entry.  The idea is that the Journal is
not just a place for data, but is the equivalent of a personal journal that
a child might keep about his school work.  If you subscribe to that idea
then every thing the child does should have a Journal entry so the child can
enter notes about it.
*

Sugar Activities by default create a Journal entry using the
*write_file()*method.  There will be Activities that don't need to do
this.  For instance,
*Get Internet Archive Books* downloads e-books to the Journal, but has no
need for a Journal entry of its own.  The same thing is true of *Sugar
Commander*.  You might make a game that keeps track of high scores.  You
could keep those scores in a Journal entry, but that would require players
to resume the game from the Journal rather than just starting it up from the
Activity Ring.  For that reason you might prefer to store the high scores in
a file in the *data* directory rather than the Journal, and not leave a
Journal entry behind at all.

Sugar gives you a way to do that.  First you need to specify an extra
argument in your Activity's *__init__()* method like this:

class SugarCommander(activity.Activity):
    def __init__(self, handle, create_jobject=True):
        "The entry point to the Activity"
        activity.Activity.__init__(self, handle, False)

Second, you need to override the *close()* method like this:

    def close(self,  skip_save=False):
        "Override the close method so we don't try to
        create a Journal entry."
        activity.Activity.close(self,  True)

That's all there is to it.

Also, previously I had said the Journal interface extended Activity, but now
I point out that this used to be true but no longer is.

My plan for the book is to have the website have the most up to date and
correct information, but leave the e-books and Lulu version alone.  The
e-books mention the website being the best source of information.  If the
differences between the website and the published books becomes significant
I'll publish new editions of the books.

James Simmons


On Tue, Aug 9, 2011 at 2:33 PM, Sugar Labs Activities <
activities at sugarlabs.org> wrote:

> Activity Homepage:
> http://activities.sugarlabs.org/addon/4291
>
> Sugar Platform:
> 0.82 - 0.92
>
> Download Now:
> http://activities.sugarlabs.org/downloads/file/27506/sugar_commander-8.xo
>
> Release notes:
> This version modifies Sugar Commander so it leaves behind a Journal entry
> of its own.  Some versions of Sugar break Activities that don't do this.  I
> have attempted to make the Journal entry useful by keeping a log of all the
> tasks done with the Activity and putting it in both the Description metadata
> and in the Journal entry file itself, which has a MIME type of text/plain so
> you can load the log into Write, attach it to emails, etc.  The log has
> entries for copying files to the Journal, deleting Journal entries,
> modifying Journal metadata, and resizing images in the Journal.
>
>
> Sugar Labs Activities
> http://activities.sugarlabs.org
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110809/79ee379a/attachment.html>


More information about the Sugar-devel mailing list