Difference between revisions of "Beginner"
Fionnziegler (talk | contribs) |
(→activity implementation) |
||
(15 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | == Getting started current branch | + | == Getting started current branch == |
Short guide to get started for newcomers to GCompris/Linux development. This is tested with ubuntu 9.10 and 10.04. It's from scratch to your first own activity. | Short guide to get started for newcomers to GCompris/Linux development. This is tested with ubuntu 9.10 and 10.04. It's from scratch to your first own activity. | ||
Line 5: | Line 5: | ||
Git download | Git download | ||
<pre>git clone git://git.gnome.org/gcompris | <pre>git clone git://git.gnome.org/gcompris | ||
− | |||
− | |||
cd gcompris</pre> | cd gcompris</pre> | ||
+ | If you want an update of the current repository (like svn update): | ||
+ | <pre>git pull</pre> | ||
build gcompris development dependencies: | build gcompris development dependencies: | ||
<pre>sudo apt-get build-dep gcompris</pre> | <pre>sudo apt-get build-dep gcompris</pre> | ||
− | make sure you have the package "gnome-common" installed | + | If you get the message 'E: You must put some 'source' URIs in your sources.list' you will need to put some deb-src lines in the sources.list so you can install these dependencies from source. To do so: |
+ | |||
+ | <code><pre> | ||
+ | sudo nano /etc/apt/sources.list | ||
+ | </pre></code> | ||
+ | |||
+ | Enter your password | ||
+ | |||
+ | This displays the text of the sources.list file in the terminal. You should see the following (or something similar), where YOUR_DISTRIB_CODENAME has been replaced with your appropriate ubuntu version (precise for example): | ||
+ | <code><pre> | ||
+ | # /etc/apt/sources.list | ||
+ | |||
+ | deb http://archive.ubuntu.com/ubuntu/ YOUR_DISTRIB_CODENAME main restricted universe multiverse | ||
+ | deb http://security.ubuntu.com/ubuntu/ YOUR_DISTRIB_CODENAME-security main restricted universe multiverse | ||
+ | deb http://archive.ubuntu.com/ubuntu/ YOUR_DISTRIB_CODENAME-updates main restricted universe multiverse | ||
+ | </pre></code> | ||
+ | |||
+ | Duplicate these lines, replacing 'deb' with 'deb-src'. Be sure that YOUR_DISTRIB_CODENAME is replaced with your actual ubuntu codename. Type cat /etc/lsb-release to see your codename if you don't know it. | ||
+ | |||
+ | Then, update and build dependencies. | ||
+ | <code><pre> | ||
+ | sudo apt-get update | ||
+ | apt-get build-dep gcompris | ||
+ | </pre></code> | ||
+ | |||
+ | make sure you have the package "gnome-common" installed: | ||
+ | <code><pre> | ||
+ | sudo apt-get install gnome-common | ||
+ | </pre></code> | ||
+ | |||
<pre>in gcompris folder: | <pre>in gcompris folder: | ||
sh autogen.sh && make | sh autogen.sh && make | ||
Line 43: | Line 72: | ||
=== Setting up the IDE === | === Setting up the IDE === | ||
− | + | When developing GCompris, it is important to maintain the standards of format established by other activities. Using an advanced editor with developmental features can aid in this process. Eclipse, for example, is an excellent open source IDE for Mac, Windos, and Linux platforms. Follow the steps below to configure GCompris with Eclipse. | |
− | |||
1) Download Eclipse C/C++: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliosr<br /> | 1) Download Eclipse C/C++: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliosr<br /> | ||
Line 52: | Line 80: | ||
Select the pydev plugin and follow the steps. After restarting you should be able to open and edit Python files.<br /> | Select the pydev plugin and follow the steps. After restarting you should be able to open and edit Python files.<br /> | ||
3) Import GCompris as an eclipse project:<br /> | 3) Import GCompris as an eclipse project:<br /> | ||
− | File->new->C/C++-->"Makefile project with existing code" -> choose GCompris source directory<br /> | + | File->new->Project->C/C++-->"Makefile project with existing code" -> choose GCompris source directory<br /> |
After restarting you should be able to open your created python file in src/basuracatcher-activity/basuracatcher.py<br /> | After restarting you should be able to open your created python file in src/basuracatcher-activity/basuracatcher.py<br /> | ||
4) Configure PyDev<br /> | 4) Configure PyDev<br /> | ||
Goto Window->Preferences->Interpreter Python and select your interpeter (e.g: /usr/bin/python)<br /> | Goto Window->Preferences->Interpreter Python and select your interpeter (e.g: /usr/bin/python)<br /> | ||
− | + | 5) Run your activity as an "External Tool" | |
− | 5) Run your activity as "External | + | If you prefer the Terminal to run and test your activity, this step is not necessary. But eclipse is an "Integrated Development Environment" so you will find it useful to take full advantage of its features. |
− | + | <li> Goto: "Run->External Tools->External Tools Config". Create new | |
− | Name: Your activity name | + | <li> Name: Your activity name |
− | Location: e.g. | + | <li> Location: (the location of runit.sh script in src directory): e.g. /home/USER_NAME/GCompis/src/runit.sh |
− | Working | + | <li> Working Directory: (locaiton of src directory): e.g. /home/USER_NAME/GCompris/src |
− | Arguments: ${selected_resource_name} or hardcoded "chat-activity" | + | <li>Arguments: ${selected_resource_name} or hardcoded "NAME_OF_ACTIVITY" ("chat-activity" for example) |
− | + | <li> click 'Build' tab, select 'The project containing the selected resources' which decreases the time it takes to run the project (only builds the specified activity rather than all activities) | |
+ | <li> Click close, then click the green run button (with red thingamajig) below the menu bar. Your activity window should appear | ||
+ | 6) Formatting: For any editor you're using to develop with GCompris, it is important to change the settings to "remove trailing whitespaces". These can cause issues when committing code. Also tell your editor to apply formatting upon saving, thus keeping your code formatted constantly as you save. Also remember to keep each code line no longer than 80 characters | ||
+ | <li> Window --> preferences --> expand the following tabs on left: PyDev --> Editor --> Code Style --> Code Formatter --> click on 'Right trim lines?' --> also click on 'Auto-Format editor contents before saving' --> Apply -->OK</li> | ||
+ | <li> Eclipse can help you keep you code within 80 characters by putting a line at 80 characters: Window --> preferences --> expand: General --> Editors --> TextEditors --> click 'Show print margin (set to 80) --> also click 'Show line numbers' (will help with debugging --> Apply --> OK </li> | ||
=== activity idea === | === activity idea === | ||
=== activity implementation === | === activity implementation === | ||
+ | |||
+ | [[Category: Developer]] | ||
+ | [[Category: English]] |
Latest revision as of 13:09, 27 January 2015
Contents
Getting started current branch
Short guide to get started for newcomers to GCompris/Linux development. This is tested with ubuntu 9.10 and 10.04. It's from scratch to your first own activity.
Git download
git clone git://git.gnome.org/gcompris cd gcompris
If you want an update of the current repository (like svn update):
git pull
build gcompris development dependencies:
sudo apt-get build-dep gcompris
If you get the message 'E: You must put some 'source' URIs in your sources.list' you will need to put some deb-src lines in the sources.list so you can install these dependencies from source. To do so:
sudo nano /etc/apt/sources.list
Enter your password
This displays the text of the sources.list file in the terminal. You should see the following (or something similar), where YOUR_DISTRIB_CODENAME has been replaced with your appropriate ubuntu version (precise for example):
# /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ YOUR_DISTRIB_CODENAME main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ YOUR_DISTRIB_CODENAME-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ YOUR_DISTRIB_CODENAME-updates main restricted universe multiverse
Duplicate these lines, replacing 'deb' with 'deb-src'. Be sure that YOUR_DISTRIB_CODENAME is replaced with your actual ubuntu codename. Type cat /etc/lsb-release to see your codename if you don't know it.
Then, update and build dependencies.
sudo apt-get update
apt-get build-dep gcompris
make sure you have the package "gnome-common" installed:
sudo apt-get install gnome-common
in gcompris folder: sh autogen.sh && make
if you want do a 'sudo make install' You should be able to test a GCompris-Activity by running the following command in the 'src' directory:
sh runit.sh connect4-activity
Create a new own activity
In the 'src' directory:
sh createit.sh basuracatcher make sh runit.sh basuracatcher-activity/
You are also able to try the installed version by running:
make clean sh autogen.sh make sudo make install gcompris --experimental --reread-menu
Then happy coding in 'src/basuracatcher-activity/basuracatcher.py'
You can continue reading here
Setting up the IDE
When developing GCompris, it is important to maintain the standards of format established by other activities. Using an advanced editor with developmental features can aid in this process. Eclipse, for example, is an excellent open source IDE for Mac, Windos, and Linux platforms. Follow the steps below to configure GCompris with Eclipse.
1) Download Eclipse C/C++: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliosr
2) Install the Python Plug-in:
Open eclipse and goto Help->Install new Software->Add Site:
http://pydev.org/updates
Select the pydev plugin and follow the steps. After restarting you should be able to open and edit Python files.
3) Import GCompris as an eclipse project:
File->new->Project->C/C++-->"Makefile project with existing code" -> choose GCompris source directory
After restarting you should be able to open your created python file in src/basuracatcher-activity/basuracatcher.py
4) Configure PyDev
Goto Window->Preferences->Interpreter Python and select your interpeter (e.g: /usr/bin/python)
5) Run your activity as an "External Tool"
If you prefer the Terminal to run and test your activity, this step is not necessary. But eclipse is an "Integrated Development Environment" so you will find it useful to take full advantage of its features.