Activity Team/Compatibility Tips: Difference between revisions
| (2 intermediate revisions by the same user not shown) | |||
| Line 16: | Line 16: | ||
except: | except: | ||
# early versions of Sugar (656) didn't support get_activity_root() | # early versions of Sugar (656) didn't support get_activity_root() | ||
path = "/home/olpc/.sugar/default/ | path = "/home/olpc/.sugar/default/[your activity bundle id as specified in activity.info]" | ||
e.g., | |||
path = "/home/olpc/.sugar/default/org.laptop.TurtleArtActivity" | |||
=== SVG === | === SVG === | ||
| Line 76: | Line 79: | ||
Sugar toolbars changed in Sucrose v0.86. You can detect which version you are running by checking for an ImportError: | Sugar toolbars changed in Sucrose v0.86. You can detect which version you are running by checking for an ImportError: | ||
try: # 0.86 toolbar widgets | try: # 0.86 toolbar widgets | ||
from sugar.activity.widgets import ActivityToolbarButton, StopButton | |||
from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton | |||
has_toolbarbox = True | |||
except ImportError: | except ImportError: | ||
has_toolbarbox = False | |||
Use the flag to determine whether to create old-style or new toolbars: | Use the flag to determine whether to create old-style or new toolbars: | ||
if | if has_toolbarbox: | ||
# Use 0.86+ toolbar design | # Use 0.86+ toolbar design | ||
toolbar_box = ToolbarBox() | toolbar_box = ToolbarBox() | ||
| Line 120: | Line 121: | ||
See python.org for more information on incompatibilities between versions. | See python.org for more information on incompatibilities between versions. | ||
=== GNOME toolkit versions === | |||
In older versions of gtk, e.g., 2.16.0, the set_size_request method does not work properly for label. | |||
label = gtk.Label(string) | |||
label.set_line_wrap(True) | |||
label.set_size_request(width, -1) | |||
Works fine on 2.22.0 | |||
''I'll try to track down the relevant gtk patch.'' | |||