Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/activity.py b/activity.py
index b61d732..764470b 100644
--- a/activity.py
+++ b/activity.py
@@ -37,6 +37,8 @@ except ImportError:
# <= 0.84 toolbars
pass
+import olpcgamesutil
+
class PhysicsActivity(activity.Activity):
def __init__(self, handle):
@@ -56,7 +58,20 @@ class PhysicsActivity(activity.Activity):
# Start the game running.
self._canvas.run_pygame(self.game.run)
-
+
+ def read_file(self, file_path):
+ event = pygame.event.Event(pygame.USEREVENT)
+ event.code = olpcgamesutil.FILE_READ_REQUEST
+ event.filename = file_path
+ event.metadata = self.metadata
+ self._canvas.translator._post(event)
+
+ def write_file(self, file_path):
+ event = pygame.event.Event(pygame.USEREVENT,
+ code = olpcgamesutil.FILE_WRITE_REQUEST,
+ filename = file_path,
+ metadata = self.metadata)
+ self.canvas.translator._post(event)
def get_preview(self):
"""Custom preview code to get image from pygame.
@@ -181,6 +196,7 @@ class PhysicsActivity(activity.Activity):
pygame.event.post(pygame.event.Event(pygame.USEREVENT,
action="focus_out"))
else:
+ self.game.show_fake_cursor = True
pygame.event.post(pygame.event.Event(pygame.USEREVENT,
action="focus_in"))