Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian <icarito@sugarlabs.org>2011-03-05 08:35:05 (GMT)
committer Sebastian <icarito@sugarlabs.org>2011-03-05 08:35:05 (GMT)
commit91383e59844e7e864a752395fd00e740def6f68b (patch)
tree8a4f0e4c9c67fee3ced549494de2aa8456eb3c16
parent044fece73333de247736aa5c4474cd4c0e34bd0e (diff)
parentee91c66b7b5408a1450202a5d689e6364f0b8d66 (diff)
Merge branch 'master' of git.sugarlabs.org:~icarito/maze/icaritos-mainline
Conflicts: Maze.activity/olpcgames/activity.py Provided fallback for old toolbar
-rw-r--r--Maze.activity/olpcgames/activity.py65
1 files changed, 34 insertions, 31 deletions
diff --git a/Maze.activity/olpcgames/activity.py b/Maze.activity/olpcgames/activity.py
index 40b1623..98fbf4c 100644
--- a/Maze.activity/olpcgames/activity.py
+++ b/Maze.activity/olpcgames/activity.py
@@ -5,8 +5,7 @@
import logging
logging.root.setLevel(logging.WARN)
log = logging.getLogger('olpcgames.activity')
-
-log.setLevel( logging.DEBUG )
+#log.setLevel( logging.INFO )
import pygtk
pygtk.require('2.0')
@@ -31,7 +30,8 @@ class PyGameActivity(activity.Activity):
format like so:
'package.module:main'
if not function name is provided, "main" is assumed.
- game_handler -- alternate specification via direct reference to a main-loop
+ game_handler -- alternate specification via direct
+ reference to a main-loop
function
game_size -- two-value tuple specifying the size of the display in pixels,
@@ -60,10 +60,11 @@ class PyGameActivity(activity.Activity):
this super-class, with no easy way of overriding without completely rewriting
the __init__ method. We should allow for customising both the UI layout and
the toolbar contents/layout/connection.
-
+
XXX Note that if you change the title of your activity in the toolbar you may
see the same focus issues as we have patched around in the build_toolbar
method. If so, please report them to Mike Fletcher.
+
"""
game_name = None
@@ -107,31 +108,34 @@ class PyGameActivity(activity.Activity):
provide custom toolbars when running under Sugar.
"""
- #toolbar = activity.ActivityToolbar(self)
- #toolbar.show()
- #self.set_toolbox(toolbar)
-
- from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
- from sugar.activity.widgets import ActivityToolbarButton, StopButton
-
- toolbar_box = ToolbarBox()
- activity_button = ActivityToolbarButton(self)
- toolbar_box.toolbar.insert(activity_button, 0)
- activity_button.show()
-
- separator = gtk.SeparatorToolItem()
- separator.props.draw = False
- separator.set_expand(True)
- toolbar_box.toolbar.insert(separator, -1)
- separator.show()
-
- stop_button = StopButton(self)
- stop_button.props.accelerator = '<Ctrl><Shift>Q'
- toolbar_box.toolbar.insert(stop_button, -1)
- stop_button.show()
-
- self.set_toolbar_box(toolbar_box)
- toolbar_box.show()
+ try:
+ from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
+ from sugar.activity.widgets import ActivityToolbarButton, StopButton
+
+ toolbar_box = ToolbarBox()
+ activity_button = ActivityToolbarButton(self)
+ toolbar_box.toolbar.insert(activity_button, 0)
+ activity_button.show()
+
+ separator = gtk.SeparatorToolItem()
+ separator.props.draw = False
+ separator.set_expand(True)
+ toolbar_box.toolbar.insert(separator, -1)
+ separator.show()
+
+ stop_button = StopButton(self)
+ stop_button.props.accelerator = '<Ctrl><Shift>Q'
+ toolbar_box.toolbar.insert(stop_button, -1)
+ stop_button.show()
+
+ self.set_toolbar_box(toolbar_box)
+ toolbar_box.show()
+ toolbar=toolbar_box.toolbar
+ except ImportError:
+ toolbar = activity.ActivityToolbar(self)
+ toolbar.show()
+ self.set_toolbox(toolbar)
+ toolbar.title.unset_flags(gtk.CAN_FOCUS)
def shared_cb(*args, **kwargs):
log.info('shared: %s, %s', args, kwargs)
@@ -168,8 +172,7 @@ class PyGameActivity(activity.Activity):
joined_cb()
- #toolbar.title.unset_flags(gtk.CAN_FOCUS)
- return toolbar_box.toolbar
+ return toolbar
PYGAME_CANVAS_CLASS = PyGameCanvas