[Sugar-devel] Fw: #3013 UNSP: toolbar error

James Simmons nicestep at gmail.com
Wed Aug 3 11:27:22 EDT 2011


I just received this bug report and from the description it seems that the
problem is more a backward compatibility issue than anything my code is
doing.  The complaint is that the stop button on the Activity toolbar does
not shut down the Activity.  I have tested this both on Fedora 10 and Fedora
12 and it works fine.  The complaint seems to be that when you click Stop
the Activity tries to do something with the title and cannot find it.
However, I have suppressed the title (plus the ability to create a Journal
entry automatically) using the method I have documented in "Make Your Own
Sugar Activities!" as follows:
NOT Adding A Journal Entry

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.

So it looks like this behavior, which is quite useful to my Activities, is
broken in the version of Sugar that Tony is using.

James Simmons

---------- Forwarded message ----------
From: James Simmons <ja.simmons at sbcglobal.net>
Date: Wed, Aug 3, 2011 at 9:36 AM
Subject: Fw: #3013 UNSP: toolbar error
To: nicestep at gmail.com




--- On Wed, 8/3/11, Sugar Labs Bugs <bugtracker-noreply at sugarlabs.org>
wrote:

> From: Sugar Labs Bugs <bugtracker-noreply at sugarlabs.org>
> Subject: #3013 UNSP: toolbar error
> To:
> Cc: bugs at lists.sugarlabs.org
> Date: Wednesday, August 3, 2011, 12:18 AM
> #3013: toolbar error
>
------------------------------------------+---------------------------------
>     Reporter:  tonyforster
>             |
>       Owner:  jdsimmons
>
>         Type:  defect
>
>    |
>    Status:  new
>
>
>     Priority:  Unspecified by
> Maintainer  |      Milestone:
> Unspecified by Release Team
>    Component:  SugarCommander
>            |
>     Version:  Unspecified
>
>     Severity:  Unspecified
>             |
>    Keywords:
>
>
> Distribution:  Unspecified
>
> |   Status_field:  Unconfirmed
>
>
------------------------------------------+---------------------------------
>  os868au Sugar 0.84.31 XO1.5
>
>  Stop on toolbar does not work
>
>  line 183
>  Activitytoolbar has no attribute title
>
> --
> Ticket URL: <http://bugs.sugarlabs.org/ticket/3013>
> Sugar Labs <http://sugarlabs.org/>
> Sugar Labs bug tracking system
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110803/e31cda66/attachment.html>


More information about the Sugar-devel mailing list