Line 12: |
Line 12: |
| #Resolve any existing pull requests before porting to avoid conflicts at a later stage. | | #Resolve any existing pull requests before porting to avoid conflicts at a later stage. |
| #Run this [http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh script] that will convert automatically things as much as it can. This is to avoid some stressful manually conversions that a "simple script" can do using ''sed'' :) | | #Run this [http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh script] that will convert automatically things as much as it can. This is to avoid some stressful manually conversions that a "simple script" can do using ''sed'' :) |
− | #Convert all the <code>from sugar.* import</code> to <code>from sugar</code>'''3'''<code>.* import</code> using [http://dev.laptop.org/~manuq/sugar-convert.sh this script]
| |
| #Follow the [[Development Team/Code guidelines|Code Guidelines]] during all the porting process | | #Follow the [[Development Team/Code guidelines|Code Guidelines]] during all the porting process |
| #Make the API changes in sugar-toolkit-gtk3 | | #Make the API changes in sugar-toolkit-gtk3 |
| #Write comments on the code, by adding '''# README:''', '''# TODO:''' and '''# FIXME:''' explaining what are the problems that you are having with that chunk of code. Put a link if it's necessary | | #Write comments on the code, by adding '''# README:''', '''# TODO:''' and '''# FIXME:''' explaining what are the problems that you are having with that chunk of code. Put a link if it's necessary |
− | Note: If you are considering to fix some ''pep8'' or ''pylint'' errors/warnings, please create two separate patch files (one for the port and one for the pylint/pep8 changes). If we follow this way it is easier to check the port patches, if not the information about the port itself it's difficult to follow
| |
| | | |
− | ==Cleanup, adopt to API changes in sugar-toolkit-gtk3 == | + | ==API changes in sugar-toolkit == |
− | * the keep button has been removed completely | + | * The keep button has been removed |
− | * the old-style toolbar has been removed | + | * The old-style toolbar has been removed |
− | * set_toolbar_box is used instead of set_toolbox (see in [http://git.sugarlabs.org/~walter/abacus/walter-cairo/commit/6871dd340a89ade3b5361457e1bd1d58276a8efc Abacus]) | + | *<code>set_toolbar_box</code> is used instead of <code>set_toolbox</code> (see in [http://git.sugarlabs.org/~walter/abacus/walter-cairo/commit/6871dd340a89ade3b5361457e1bd1d58276a8efc Abacus]) |
− | * remove import of deprecated ActivityToolbox (see [http://git.sugarlabs.org/hello-world/mainline/commit/22060a3063b2d6fd38d6b1cd8d44946170255af3 hello-world]) | + | * Remove import of deprecated ActivityToolbox (see [http://git.sugarlabs.org/hello-world/mainline/commit/22060a3063b2d6fd38d6b1cd8d44946170255af3 hello-world]) |
− | * support for 'service_name' and 'class' has been removed from the activity.info make sure you are using: 'bundle_id' instead of 'service_name' and 'exec' instead of 'class' (see in [http://git.sugarlabs.org/record/mainline/commit/6e8968c71e474e2d8d86886badf5cf7d70217dc5 Record]) | + | * Support for <code>service_name</code> and <code>class</code> tags in activity.info has been removed. Use <code>bundle_id</code> instead of <code>service_name</code> and <code>exec</code> instead of <code>class</code> (see in [http://git.sugarlabs.org/record/mainline/commit/6e8968c71e474e2d8d86886badf5cf7d70217dc5 Record]) |
− | * <code>sugar3.activity.Activity</code> doesn't have the ''window'' attribute. Use the <code>.get_window()</code> method instead. | + | * <code>sugar3.activity.Activity</code> does not have the ''window'' attribute. Use the <code>.get_window()</code> method instead. |
| | | |
| ==Port the activity from GTK2 to GTK3== | | ==Port the activity from GTK2 to GTK3== |
Line 34: |
Line 32: |
| from gi.repository import Gtk | | from gi.repository import Gtk |
| | | |
− | Note that require_version needs to called only the first time when Gtk is being imported. | + | Note that <code>require_version</code> needs to called only the first time when Gtk is being imported. |
| | | |
− | Here are some more examples of imports that may be used:
| + | Similar imports that may be used are: |
| <pre> | | <pre> |
| from gi.repository import Gdk, Pango, Gobject | | from gi.repository import Gdk, Pango, Gobject |
Line 65: |
Line 63: |
| from sugar3.activity import activity | | from sugar3.activity import activity |
| | | |
− | Make sure you change the setup.py in your activity to point to the new toolkit as well:
| + | The changes that were needed to port the hello-world activity can be seen in [https://github.com/sugarlabs/hello-world/commit/508e1c518b56cbde5508e560c8a2ff38a3518583 this commit.] |
− | from sugar3.activity import bundlebuilder
| |
− | | |
− | The changes that were needed to port the hello-world activity can be seen in [http://git.sugarlabs.org/hello-world/mainline/commit/508e1c518b56cbde5508e560c8a2ff38a3518583 this commit]. | |
− | | |
− | Ok, let's do these changes now for your activity. Make sure you are in your master branch using the 'git branch' command (the master branch should have a '*' before it). Make your changes, commit them ('git commit -a') and push them to the remote repository ('git push origin master').
| |
| | | |
| ====Simple example on creating a toolbar==== | | ====Simple example on creating a toolbar==== |