From 8563f8a7dadd31ae6f9a63d5bf4dcac1966d0342 Mon Sep 17 00:00:00 2001
Message-Id: <8563f8a7dadd31ae6f9a63d5bf4dcac1966d0342.1336489398.git.humitos@gmail.com>
From: Manuel Kaufmann <humitos@gmail.com>
Date: Tue, 8 May 2012 12:03:08 -0300
Subject: [PATCH Maze] Maze icon in the toolbar SL #3380
- Show the Maze icon in the toolbar.
- Don't use olpcgames.PygameActivity.build_toolbar anymore because it
doesn't do what we need. Used our own build_toolbar method instead.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
activity.py | 42 ++++++++++++++++++++++++++++++------------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/activity.py b/activity.py
index 46a942c..4afbf56 100755
a
|
b
|
import olpcgames |
4 | 4 | import pygame |
5 | 5 | import gtk |
6 | 6 | |
| 7 | from sugar.activity.widgets import ActivityToolbarButton |
| 8 | from sugar.activity.widgets import StopButton |
| 9 | from sugar.graphics.toolbarbox import ToolbarBox |
7 | 10 | from sugar.graphics.toolbutton import ToolButton |
8 | 11 | from gettext import gettext as _ |
9 | 12 | |
… |
… |
class MazeActivity(olpcgames.PyGameActivity): |
15 | 18 | |
16 | 19 | def build_toolbar(self): |
17 | 20 | """Build our Activity toolbar for the Sugar system.""" |
18 | | toolbar = super(MazeActivity, self).build_toolbar() |
| 21 | |
| 22 | toolbar_box = ToolbarBox() |
| 23 | activity_button = ActivityToolbarButton(self) |
| 24 | toolbar_box.toolbar.insert(activity_button, 0) |
| 25 | activity_button.show() |
19 | 26 | |
20 | 27 | separator = gtk.SeparatorToolItem() |
21 | | separator.set_expand(True) |
22 | | separator.set_draw(False) |
23 | | toolbar.insert(separator, 0) |
| 28 | toolbar_box.toolbar.insert(separator, -1) |
| 29 | separator.show() |
| 30 | |
| 31 | easier_button = ToolButton('create-easier') |
| 32 | easier_button.set_tooltip(_('Easier level')) |
| 33 | easier_button.connect('clicked', self._easier_button_cb) |
| 34 | toolbar_box.toolbar.insert(easier_button, -1) |
24 | 35 | |
25 | 36 | harder_button = ToolButton('create-harder') |
26 | 37 | harder_button.set_tooltip(_('Harder level')) |
27 | 38 | harder_button.connect('clicked', self._harder_button_cb) |
28 | | toolbar.insert(harder_button, 2) |
29 | | harder_button.show() |
| 39 | toolbar_box.toolbar.insert(harder_button, -1) |
30 | 40 | |
31 | | easier_button = ToolButton('create-easier') |
32 | | easier_button.set_tooltip(_('Easier level')) |
33 | | easier_button.connect('clicked', self._easier_button_cb) |
34 | | toolbar.insert(easier_button, 2) |
35 | | easier_button.show() |
| 41 | separator = gtk.SeparatorToolItem() |
| 42 | separator.props.draw = False |
| 43 | separator.set_size_request(0, -1) |
| 44 | separator.set_expand(True) |
| 45 | toolbar_box.toolbar.insert(separator, -1) |
| 46 | separator.show() |
| 47 | |
| 48 | stop_button = StopButton(self) |
| 49 | toolbar_box.toolbar.insert(stop_button, -1) |
| 50 | stop_button.show() |
| 51 | |
| 52 | self.set_toolbar_box(toolbar_box) |
| 53 | toolbar_box.show_all() |
36 | 54 | |
37 | | return toolbar |
| 55 | return toolbar_box |
38 | 56 | |
39 | 57 | def _easier_button_cb(self, button): |
40 | 58 | pygame.event.post(olpcgames.eventwrap.Event( |