diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2012-04-10 16:07:04 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2012-04-10 16:07:04 (GMT) |
commit | 43ad8fea2f92a2ebe248862b2cafd3cf8c69bbba (patch) | |
tree | 358a01ae36818eaf772965697b534fcdc2939fe7 /activity.py | |
parent | 0cbb96ec56dc0faf0d29428cfccf82788e5f7fb7 (diff) |
going back to v16 because a regretion.
Diffstat (limited to 'activity.py')
-rwxr-xr-x | activity.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/activity.py b/activity.py index f21efdd..fec3947 100755 --- a/activity.py +++ b/activity.py @@ -1,9 +1,43 @@ +import gtk import olpcgames -from gettext import gettext as _ +import pygame +from sugar.graphics.toolbutton import ToolButton +from gettext import gettext as _ class MazeActivity(olpcgames.PyGameActivity): game_name = 'game' game_title = _('Maze') game_size = None # let olpcgames pick a nice size for us + + def build_toolbar(self): + """Build our Activity toolbar for the Sugar system.""" + toolbar = super(MazeActivity, self).build_toolbar() + + separator = gtk.SeparatorToolItem() + separator.set_expand(True) + separator.set_draw(False) + toolbar.insert(separator, 0) + + harder_button = ToolButton('create-harder') + harder_button.set_tooltip(_('Harder level')) + harder_button.connect('clicked', self._harder_button_cb) + toolbar.insert(harder_button, 2) + harder_button.show() + + easier_button = ToolButton('create-easier') + easier_button.set_tooltip(_('Easier level')) + easier_button.connect('clicked', self._easier_button_cb) + toolbar.insert(easier_button, 2) + easier_button.show() + + return toolbar + + def _easier_button_cb(self, button): + pygame.event.post(olpcgames.eventwrap.Event( + pygame.USEREVENT, action='easier_button')) + + def _harder_button_cb(self, button): + pygame.event.post(olpcgames.eventwrap.Event( + pygame.USEREVENT, action='harder_button')) |