Changes

4,770 bytes added ,  22:18, 16 January 2018
Line 1: Line 1: −
<noinclude>{{ GoogleTrans-en | es =show | bg =show | zh-CN =show | zh-TW =show | hr =show | cs =show | da =show | nl =show | fi =show | fr =show | de =show | el =show | hi =show | it =show | ja =show | ko =show | no =show | pl =show | pt =show | ro =show | ru =show | sv =show }}
+
<noinclude>{{TeamHeader|Activity Team}}</noinclude>
{{TeamHeader|ActivityTeam}}</noinclude>
     −
=Getting started in Activity development=
+
==Getting started in Activity development==
 
If you have no experience developing Sugar activities, these resources will help get you started.
 
If you have no experience developing Sugar activities, these resources will help get you started.
 +
 +
=== Activity development tutorials ===
 +
{|
 +
|-
 +
|<span class="plainlinks">[[File:Sugarlabs_mainpage_07.png|link=http://en.flossmanuals.net/make-your-own-sugar-activities]]</span>
 +
|valign="center"|The official introduction to writing Sugar activities is the Flossmanuals book [http://en.flossmanuals.net/make-your-own-sugar-activities/ Make Your Own Sugar Activities!] by James Simmons.
 +
|}
    
====Setting up a Sugar environment====
 
====Setting up a Sugar environment====
If you use Linux, your best bet is to install [[DevelopmentTeam/Jhbuild|sugar-jhbuild]].  You will be able to develop in your native environment, treating Sugar as just another desktop application.
     −
If you run MacOS X or Windows, you will need to set up an emulator.  For Mac OS X, see [[Supported_systems/Mac]].  For Windows, see [[Supported_systems/Windows]].
+
Please see [[Downloads | Get Sugar]] for details on how to best get Sugar running.
   −
To develop efficiently using an emulator or a secondary machine running Sugar natively (such as an OLPC XO), find an editor which supports editing files over a SFTP connection. [http://www.openkomodo.com/ Komodo Edit] is a good example.
+
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. [http://www.activestate.com/komodo-edit/downloads Komodo Edit] with the Remote Drive Tree extension, emacs with tramp and magit, and [http://www.eclipse.org Eclipse] with the [http://www.jcraft.com/eclipse-sftp/ SFTP Plugin] are examples.
    
====Python Reference & Tutorials====
 
====Python Reference & Tutorials====
 +
* [http://greenteapress.com/thinkpython/thinkpython.html Think Python: How to Think Like a Computer Scientist]
 
* http://docs.python.org/
 
* http://docs.python.org/
 
* http://diveintopython.org/
 
* http://diveintopython.org/
 
+
* [http://pleac.sourceforge.net/pleac_python/index.html PLEAC - Programming Language Examples Alike Cookbook]
 +
* http://code.google.com/edu/languages/google-python-class/
 +
* [http://people.csail.mit.edu/pgbovine/python/ Online Python Tutor] - Online stepping & visualization of Python code
 +
* [http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/ 6.00SC Introduction to Computer Science and Programming]
 +
*http://www.babarehner.com/ewrench1011/Python/index.html
 
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.
 
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.
   Line 28: Line 38:  
The following sections of the PyGTK tutorial are most relevant to activity development.
 
The following sections of the PyGTK tutorial are most relevant to activity development.
   −
* 1. Introduction
+
: 1. Introduction
* 2. Getting Started
+
: 2. Getting Started
* 3. Moving On
+
: 3. Moving On
* 4. Packing Widgets
+
: 4. Packing Widgets
* 5. Widget Overview
+
: 5. Widget Overview
* 6. The Button Widget
+
: 6. The Button Widget
* 7. Adjustments
+
: 7. Adjustments
* 8. Range Widgets
+
: 8. Range Widgets
* 9. Miscellaneous Widgets
+
: 9. Miscellaneous Widgets
* 10. Container Widgets
+
: 10. Container Widgets
* 12. Drawing Area
+
: 12. Drawing Area
 +
 
 +
Also see:
   −
====Sugar Activities & API====
+
* http://www.majorsilence.com/PyGTK_Book
* http://wiki.laptop.org/go/Sugar_Activity_Tutorial
     −
This tutorial will introduce you to the basics of creating activities.
+
====Sugar Activities====
 +
* [[Development Team/Almanac|Sugar Almanac]]
   −
* http://api.sugarlabs.org/
+
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.
* http://wiki.laptop.org/go/Sugar_almanac
     −
Bookmark these two links. The first 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.  The second is a detailed module-by-module overview of the Sugar API with answers to common questions.
+
* https://developer.sugarlabs.org/sugar3
 +
 
 +
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.
 +
 
 +
* [[Development Team/Low-level Activity API|Low-Level Activity API]]
 +
 
 +
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 Graphics====
Line 55: Line 72:  
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.
 
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.
   −
====Sugar Human Interface Guidelines (HIG)====
+
====Pygame====
* http://wiki.laptop.org/go/OLPC_Human_Interface_Guidelines.
+
* http://www.pygame.org/
 +
* [[Development_Team/sugargame]]
   −
These pages give a good introduction to the thought process behind the Sugar environment and will help a lot when designing your activity.
+
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)====
 +
* [[Human Interface Guidelines]].
 +
 
 +
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====
 +
* [[Translation_Team/i18n_Best_Practices]].
 +
 
 +
Once you have strings in your Activity, here are some general tips which will make your translators happy :-)
    
====JSON introduction====
 
====JSON introduction====
Line 64: Line 92:     
JSON is a data format commonly used to store activity data in the Journal.
 
JSON is a data format commonly used to store activity data in the Journal.
 +
 +
* http://simplejson.googlecode.com/svn/tags/simplejson-2.0.8/docs/index.html
 +
 +
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 [http://git.sugarlabs.org/projects/sugar-port/repos/mainline/blobs/master/json.py this] to wrap it.
    
====Git introduction====
 
====Git introduction====
* http://wiki.laptop.org/go/Git
+
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.
 +
 
 +
* [[Activity Team/Git|Git]]
 +
* [https://github.com/ GitHub]
   −
Git is the version control software used by Sugar Labs. It is a distributed version control system and is quite powerful, but requires a lot of command line use.
+
====XML routines====
 +
There are [http://docs.python.org/library/markup.html dozens] Python classes to satisfy the XML standard, but if you want just save/load parameters use "Zen of XML" in Python - [http://effbot.org/zone/element.htm 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.
   −
====XML routine====
+
But if you just need a simple configuration format to read/write Python objects, check out JSON instead.
If you need to store activity configure files the best way is using XML (it's well supported in Python and still human readable/editable).
     −
There are [http://docs.python.org/library/markup.html dozens] Python classes to satisfy XML standard but if you want just save/load parameters use "Zen of XML" in Python - [http://effbot.org/zone/element.htm ElementTree] library. It's supported out of the box in Python 2.5(xml.etree.ElementTree module). In previous version you'll have to install library by yourself.
+
====Speech synthesizing====
 +
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==
 
This is an open area for posting links related to activity development.
 
This is an open area for posting links related to activity development.
 +
===Hosting===
 +
https://github.com/sugarlabs may host your Sugar related code.
 +
 +
===Sample code===
 +
 +
* [http://git.sugarlabs.org/projects/hello-world Hello World] activity.
 +
* An example of [[Activity Team/Sample code/Ruler|a simple activity that uses Cairo graphics]]
 +
* An [http://uclug.org/images/Sugar.odp 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 [http://media.libsyn.com/media/dsyates/101309uclug0020.ogg listen] to the creator ([http://wiki.sugarlabs.org/go/User:Ossfm 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===
 
===References===
Line 83: Line 145:  
* http://www.pygtk.org/docs/pygobject/index.html PyGObject API reference.  Contains a few important things missing from the PyGTK API such as timers and idle callbacks.
 
* http://www.pygtk.org/docs/pygobject/index.html PyGObject API reference.  Contains a few important things missing from the PyGTK API such as timers and idle callbacks.
 
* http://api.sugarlabs.org/ The official Sugar API documentation (quite sparse but includes all the source code).
 
* http://api.sugarlabs.org/ The official Sugar API documentation (quite sparse but includes all the source code).
* http://wiki.laptop.org/go/Sugar_almanac Detailed Sugar API overview.  Quite in depth and offers answers to common questions.
+
* [[Development Team/Almanac]] Detailed Sugar API overview.  Quite in depth and offers answers to common questions.
 
* http://pygstdocs.berlios.de/ Python GStreamer bindings.
 
* http://pygstdocs.berlios.de/ Python GStreamer bindings.
* http://wiki.laptop.org/go/OLPC_Human_Interface_Guidelines The design behind the Sugar interface.  Useful when planning your activity.
+
* [[Human Interface Guidelines]] The design behind the Sugar interface.  Very important to read and understand before planning your activity's user interface.
 
* http://cairographics.org/documentation/pycairo/ Cairo Python API reference.  Very sparse, use the tutorial instead.
 
* http://cairographics.org/documentation/pycairo/ Cairo Python API reference.  Very sparse, use the tutorial instead.
* http://wiki.laptop.org/go/Low-level_Activity_API Information on how activities interact with Sugar.
+
* [[Development Team/Low-level Activity API]] Information on how activities interact with Sugar independent of programming language.
 +
* http://www.pygame.org/ The Pygame game development library.
 +
* [[Development Team/sugargame]] Python package which makes it possible to embed Pygame in a Sugar activity.
    
===Tutorials and Whitepapers===
 
===Tutorials and Whitepapers===
Line 93: Line 157:  
* http://www.pygtk.org/pygtk2tutorial/index.html A very informative step-by-step introduction to PyGTK.
 
* http://www.pygtk.org/pygtk2tutorial/index.html A very informative step-by-step introduction to PyGTK.
 
* http://www.olpcaustria.org/mediawiki/index.php/Activity_handbook Introduction to activity development by OLPC Austria.
 
* http://www.olpcaustria.org/mediawiki/index.php/Activity_handbook Introduction to activity development by OLPC Austria.
* http://wiki.laptop.org/go/Sugar_Activity_Tutorial Another introduction to activity development.
+
* [[OLPC:Sugar Activity Tutorial]] Another introduction to activity development.
 
* http://www.tortall.net/mu/wiki/CairoTutorial A great introduction to Cairo in PyGTK and vector graphics drawing in general.
 
* http://www.tortall.net/mu/wiki/CairoTutorial A great introduction to Cairo in PyGTK and vector graphics drawing in general.
 
* http://www.json.org/fatfree.html An overview of the JSON data format.
 
* http://www.json.org/fatfree.html An overview of the JSON data format.
* http://wiki.laptop.org/go/Shared_Sugar_Activities High level overview of collaboration.
+
* http://simplejson.googlecode.com/svn/tags/simplejson-2.0.8/docs/index.html Documentation for the recommended JSON library.
* http://wiki.laptop.org/go/Collaboration_Tutorial Step by step tutorial on integrating collaboration into an activity.
+
* [[OLPC:Shared Sugar Activities]] High level overview of collaboration.
* http://sugarlabs.org/go/Modifying_Activities Information describing simple modifications that can be made to common Sugar activities.
+
* [[OLPC:Collaboration Tutorial]] Step by step tutorial on integrating collaboration into an activity.
 +
* [[Activity_Team/Modifing_an_Activity]] Information describing simple modifications that can be made to common Sugar activities.
 +
* [[Activity Team/Compatibility Tips]] Information on ensuring your activity is portable to the various distributions that run Sugar.
 +
 
 +
==== Old tutorials ====
 +
 
 +
* Porting a PyGTK game to Sugar, [http://www.redhatmagazine.com/2007/04/05/building-the-xo-porting-a-pygtk-game-to-sugar-part-one/ Part 1] and [http://www.redhatmagazine.com/2007/04/26/building-the-xo-porting-a-pygtk-game-to-sugar-part-two/ Part 2], Red Hat Magazine.
 +
* [http://wiki.laptop.org/go/Beyond_Hello_World Beyond Hello World], wiki.laptop.org
 +
 
 +
===Community resources===
 +
* http://bugs.sugarlabs.org/ Bug tracking for Sugar and activities.  Go here to report bugs in the Sugar toolkit.  Each activity should have its own component here.
 +
* http://git.sugarlabs.org/ Gitorious source code hosting.
 +
* http://git.sugarlabs.org/events.atom RSS feed of all Sugar development activity.  Great for keeping an eye on the project as a whole.
 +
 
 +
===Non-English resources===
 +
* http://sites.google.com/site/sugaractivities/ Spanish language activity development site in Uruguay.
   −
=Stuck?=
+
==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.
 
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 post questions to sugar-devel@lists.sugarlabs.org.
+
We hang out in #sugar on irc.freenode.net, and you can always [http://lists.sugarlabs.org/listinfo/sugar-devel subscribe] and post questions to sugar-devel@lists.sugarlabs.org.
   −
[[Category:Activity]]
+
[[Category:Activity Team]]
 +
[[Category:Resource]]