Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-01-17 02:56:33 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-01-17 02:56:33 (GMT)
commit6e221da1d23ccc74260c8416f2f803e504fd518b (patch)
treee727c1696de12fb034dc37f476bfbc03dc3a02bf /activity.py
parent13f88d7f3ca4c4dc9172fa89455d3655b43b901c (diff)
store stories to journal instead of files
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/activity.py b/activity.py
index b478f70..670db6a 100644
--- a/activity.py
+++ b/activity.py
@@ -4,9 +4,11 @@ import gtk
import hippo
import os
from gettext import gettext as _
+import logging
from sugar.activity import activity
from olpcgames import PyGameActivity
+from olpcgames import eventwrap
class StoryBuilderActivity(PyGameActivity):
game_name = 'StoryBuilder:Game'
@@ -18,3 +20,14 @@ class StoryBuilderActivity(PyGameActivity):
"""Get into the right directory so we can find the artwork"""
super(StoryBuilderActivity, self).__init__(handle)
os.chdir(activity.get_bundle_path())
+
+ def write_file(self, file_path):
+ eventwrap.post(eventwrap.SaveEvent(file_path))
+ logging.debug('Save sent')
+ if eventwrap.wait(types = [eventwrap.Reply]) == None:
+ logging.error('Cannot save to journal')
+
+ def read_file(self, file_path):
+ eventwrap.post(eventwrap.LoadEvent(file_path))
+ logging.debug('Load sent')
+ return eventwrap.wait(types = [eventwrap.Reply]) != None