Difference between revisions of "Activity Team/Resources"

From Sugar Labs
Jump to navigation Jump to search
Line 111: Line 111:
  
 
====Speech synthesizing====
 
====Speech synthesizing====
If you want to add a speech synthesizer for English and other languages, try the [[Activity_Team/gst-plugins-espeak|gst-plugins-espeak]] plugin for gstreamer.
+
If you want to add a speech synthesizer for English and other languages, use the sugar3.speech module, or try the [[Activity_Team/gst-plugins-espeak|gst-plugins-espeak]] plugin for gstreamer.
  
 
==Activity Development Resources==
 
==Activity Development Resources==

Revision as of 22:15, 16 January 2018

Team Home   ·   Join   ·   Contacts   ·   Resources   ·   FAQ   ·   Roadmap   ·   To Do   ·   Meetings

Getting started in Activity development

If you have no experience developing Sugar activities, these resources will help get you started.

Activity development tutorials

Sugarlabs mainpage 07.png The official introduction to writing Sugar activities is the Flossmanuals book Make Your Own Sugar Activities! by James Simmons.

Setting up a Sugar environment

Please see Get Sugar for details on how to best get Sugar running.

If you decide to use a Virtual Machine (VM) or a secondary machine (such as an OLPC XO) for testing your activities, an editor with support for editing files over an SSH or SFTP connection can come in handy. Komodo Edit with the Remote Drive Tree extension, emacs with tramp and magit, and Eclipse with the SFTP Plugin are examples.

Python Reference & Tutorials

Python is the language Sugar is written in and is also used by most activities. If you don't already know Python well, you should familiarize yourself with it before continuing.

PyGTK Reference & Tutorials

PyGTK is the user interface toolkit used by Sugar activities. Bookmark these two links as you will reference them frequently during development.

The following sections of the PyGTK tutorial are most relevant to activity development.

1. Introduction
2. Getting Started
3. Moving On
4. Packing Widgets
5. Widget Overview
6. The Button Widget
7. Adjustments
8. Range Widgets
9. Miscellaneous Widgets
10. Container Widgets
12. Drawing Area

Also see:

Sugar Activities

The Sugar Almanac contains all the information you need to start writing Sugar activities, ranging from directory structure to bundle format to API reference. It also contains answers to common questions and examples of common tasks.

This automatically updated site contains the official API documentation for Sugar. Though it is currently quite sparse, the source code is included with the documentation and it's useful to have that at your fingertips.

Activities can be written in any programming language, as long as it can connect to D-Bus and provide an X11 interface. This documents Sugar's low-level API, in particular for use by activities written in languages other than Python.

Cairo Graphics

Cairo is the graphics library used in Sugar. The tutorial is a good introduction to the API as well as vector graphics programming in general.

Pygame

Pygame is a library for developing 2D sprite-based games using Python. Sugargame is a package which makes it possible to embed Pygame into a Sugar activity.

Sugar Human Interface Guidelines (HIG)

Required reading before planning the user interface for your activity. These pages give a good introduction to the thought process behind the Sugar environment and will help a lot when designing your activity.

i18n (Localisation) Best Practices

Once you have strings in your Activity, here are some general tips which will make your translators happy :-)

JSON introduction

JSON is a data format commonly used to store activity data in the Journal.

Currently, the recommended JSON library is simplejson. It has also become the standard JSON library in Python 2.6+.

NOTE: There is an odd thing about simplejson - in python25 it lives in simplejson module, but in python26 it uses json module. So, use something like this to wrap it.

Git introduction

Git is the version control software used by Sugar Labs. It is a distributed version control system and is quite powerful, but may require a lot of command line use.

XML routines

There are dozens Python classes to satisfy the XML standard, but if you want just save/load parameters use "Zen of XML" in Python - ElementTree library. It's supported out of the box in Python 2.5 (xml.etree.ElementTree module). In previous versions you'll have to install library by yourself.

But if you just need a simple configuration format to read/write Python objects, check out JSON instead.

Speech synthesizing

If you want to add a speech synthesizer for English and other languages, use the sugar3.speech module, or try the gst-plugins-espeak plugin for gstreamer.

Activity Development Resources

This is an open area for posting links related to activity development.

Hosting

http://git.sugarlabs.org/ will host your Sugar related code.

Sample code

  • Hello World activity.
  • An example of a simple activity that uses Cairo graphics
  • An OpenOffice presentation that touches on many of the issues encountered by first-time Sugar developers. Some items covered are: What is Sugar and Sugar Labs; What are some development environments; Some Sugar specific python statements for a PyGTK activity; Activity distribution. You can also listen to the creator (ossfm) give the presentation at a LUG meeting (starting at 9 minutes and 55 seconds).

Profiling in Python

       import os
       import cProfile
       import lsprofcalltree
       profiler = cProfile.Profile()
       profiler.enable()
       # code to profile goes here
       profiler.disable()
       profiler.dump_stats('/tmp/profile')

Use kcachegrind to view the results.

References

Tutorials and Whitepapers

Old tutorials

Community resources

Non-English resources

Stuck?

If you have a question, don't hesitate to ask the activity team. We are happy to help and can often save you a lot of hunting for answers.

We hang out in #sugar on irc.freenode.net, and you can always subscribe and post questions to sugar-devel@lists.sugarlabs.org.