Ticket #3747: 0001-Collaboration-fixed-SL-3747.patch
File 0001-Collaboration-fixed-SL-3747.patch, 2.9 KB (added by humitos, 11 years ago) |
---|
-
activity.py
From a72b2829ef29ca7b51d50f7570545f2245a21ff6 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann <humitos@gmail.com> Date: Fri, 9 Nov 2012 17:10:14 -0300 Subject: [PATCH Maze] Collaboration fixed SL #3747 A bug regarding collaboration was intruced in this commit[1] when the toolbar was modified to show the correct icons. In the same commit the call to 'olpcgames.PygameActivity.build_toolbar' was removed and the collaboration setup was done there. I copied the code that setup the collaboration from 'olpcgames.PygameActivity.build_toolbar' to 'activity.MazeActivity.__init__'. [1] http://git.sugarlabs.org/maze/mainline/commit/87f832850ba242b1606acb0f1d60bc5631920f34 Signed-off-by: Manuel Kaufmann <humitos@gmail.com> --- activity.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/activity.py b/activity.py index 4afbf56..127e73f 100755
a b 1 1 # -*- coding: utf-8 -*- 2 2 3 import logging 3 4 import olpcgames 4 5 import pygame 5 6 import gtk 6 7 8 from olpcgames import mesh 9 from olpcgames import util 10 7 11 from sugar.activity.widgets import ActivityToolbarButton 8 12 from sugar.activity.widgets import StopButton 9 13 from sugar.graphics.toolbarbox import ToolbarBox … … class MazeActivity(olpcgames.PyGameActivity): 16 20 game_title = _('Maze') 17 21 game_size = None # Let olpcgames pick a nice size for us 18 22 23 def __init__(self, handle): 24 super(MazeActivity, self).__init__(handle) 25 26 # This code was copied from olpcgames.activity.PyGameActivity 27 def shared_cb(*args, **kwargs): 28 logging.info('shared: %s, %s', args, kwargs) 29 try: 30 mesh.activity_shared(self) 31 except Exception, err: 32 logging.error('Failure signaling activity sharing' 33 'to mesh module: %s', util.get_traceback(err)) 34 else: 35 logging.info('mesh activity shared message sent,' 36 ' trying to grab focus') 37 try: 38 self._pgc.grab_focus() 39 except Exception, err: 40 logging.warn('Focus failed: %s', err) 41 else: 42 logging.info('asserting focus') 43 assert self._pgc.is_focus(), \ 44 'Did not successfully set pygame canvas focus' 45 logging.info('callback finished') 46 47 def joined_cb(*args, **kwargs): 48 logging.info('joined: %s, %s', args, kwargs) 49 mesh.activity_joined(self) 50 self._pgc.grab_focus() 51 self.connect('shared', shared_cb) 52 self.connect('joined', joined_cb) 53 54 if self.get_shared(): 55 # if set at this point, it means we've already joined (i.e., 56 # launched from Neighborhood) 57 joined_cb() 58 19 59 def build_toolbar(self): 20 60 """Build our Activity toolbar for the Sugar system.""" 21 61