[Sugar-devel] Several chapters of "Make Your Own Sugar Activities!" ready for review, feedback

Jim Simmons nicestep at gmail.com
Tue Jan 5 16:20:15 EST 2010


Walter,

I've used the import exception method myself.  It looks like this will
be a bit more complicated than I had planned on, because it would seem
that I'd need a .86 environment to test in.  I have two development
boxes at home, one running Fedora 10 (which I plan to leave alone) and
another running 11, which I could update to 12 if that would give me
.86.  Unfortunately, Fedora's idea of upgrade seems to be a clean
install, which I'd like to put off.  Maybe I should finish the rest of
the chapters before I try making new style toolbars.

You've given me a good start though, and I think I can figure out the
rest.  I could probably figure out the PyGame stuff too.  It's the
"developing on a Mac" topic that has me stumped.

Thanks,

James Simmons


On Tue, Jan 5, 2010 at 2:42 PM, Walter Bender <walter.bender at gmail.com> wrote:
> On Tue, Jan 5, 2010 at 2:57 PM, Jim Simmons <nicestep at gmail.com> wrote:
>> I've been working on a Floss Manual that should be a beginner's guide
>> to creating Sugar Activities.  I've got 64 page's worth (in the PDF
>> version) written and I feel confident that I will finish this book
>> eventually.  What I have now may be good enough to criticize.  It
>> contains some pretty good code samples, some reasonable
>> recommendations, and a fair number of screen shots.  So far it covers
>> writing a basic Activity in Python, running it with sugar-emulator,
>> and getting the code in Git.  Future chapters will include doing i18n
>> with Pootle, distributing the Activity, doing text to speech with and
>> without highlighting, and collaboration features.  I may stick
>> something on Activity debugging techniques in somewhere too.
>>
>> Other stuff that *should* be included, but which I am not currently
>> qualified to write, would include:
>>
>> * Developing Activities on a Mac
>> * Creating an Activity using PyGame instead of PyGTK.
>> * Creating the new-styled toolbars
>> * etc., etc.
>>
>> If you want to check out what I have the URL is:
>>
>> http://en.flossmanuals.net/ActivitiesGuideSugar/Introduction
>>
>> Any help anyone can provide on this will be greatly appreciated.  If
>> you want to register as a writer and contribute stuff of your own or
>> edit my stuff you have my blessing.
>>
>
> Jim,
>
> This is a great start. I'll try to help out with some of the missing piece.
>
> Re how to handle the new toolbars, I have some examples from other
> programs, but I am happy to work with you on the ReadEtext example if
> you want. The only thing you need are some icons to represent the
> toolbar submenus. Your current activity icon will replace the
> "Activity" toolbar; there is a standard icon for the "Edit" toolbar
> ('toolbar-edit'); likewise, for the 'View" toolbar ('toolbar-view').
> You'll need to decide on an icon for the "Read" toolbar, perhaps the
> icon from the Read activity?
>
> The "trick" then is to figure out which version of Sugar you are
> running in order to decide which toolbars to use. I am lazy and just
> catch an ImportError:
>
> import sugar
> from sugar.activity import activity
> try: # 0.86+ toolbar widgets
>    from sugar.bundle.activitybundle import ActivityBundle
>    from sugar.activity.widgets import ActivityToolbarButton
>    from sugar.activity.widgets import StopButton
>    from sugar.graphics.toolbarbox import ToolbarBox
>    from sugar.graphics.toolbarbox import ToolbarButton
>    sugar86 = True
> except ImportError:
>    sugar86 = False
>    pass
> from sugar.graphics.toolbutton import ToolButton
> from sugar.graphics.menuitem import MenuItem
> from sugar.graphics.icon import Icon
>
> later...
>
> if sugar86 is True:
>    toolbar_box = ToolbarBox()
>    ...
>    self.set_toolbar_box(toolbar_box)
>    toolbar_box.show()
> else:
>    self.toolbox = activity.ActivityToolbox(self)
>    self.set_toolbox(self.toolbox)
>    ...
>    self.toolbox.show()
>    self.toolbox.set_current_toolbar(1)
>
> There are a few more details regarding sharing callbacks between the
> toolbars, etc. Maybe checkout
> http://git.sugarlabs.org/projects/visualmatch/repos/mainline/blobs/master/VisualMatchActivity.py
> for an example.
>
> -walter
>
>> Thanks,
>>
>> James Simmons
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>
>
>
> --
> Walter Bender
> Sugar Labs
> http://www.sugarlabs.org
>


More information about the Sugar-devel mailing list