Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
authorAsaf Paris Mandoki <asafpm@gmail.com>2009-07-12 08:37:26 (GMT)
committer Asaf Paris Mandoki <asafpm@gmail.com>2009-07-12 08:37:26 (GMT)
commitd05d1eef0f8093b2abe3c331027f8f32ee79c087 (patch)
tree8a2756f0bc21044c9a0618c471463268444cfef3 /tools.py
parent5284e89a7e0d3cf794d435bed6cfa4926e95d55a (diff)
Added functionality to save/load contraptions to/from the journal (Trac #1034)
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools.py b/tools.py
index 1b20da9..2aced3e 100644
--- a/tools.py
+++ b/tools.py
@@ -4,6 +4,7 @@
# By Alex Levenson
#==================================================================
import pygame
+import olpcgames
from pygame.locals import *
from helpers import *
from inspect import getmro
@@ -33,6 +34,13 @@ class Tool(object):
elif event.type == USEREVENT:
if hasattr(event,"action"):
if self.game.toolList.has_key(event.action): self.game.setTool(event.action)
+ if hasattr(event,"code"):
+ if event.code == olpcgames.FILE_WRITE_REQUEST:
+ #saving to journal
+ self.game.world.pickle_save(event.filename)
+ if event.code == olpcgames.FILE_READ_REQUEST:
+ #loading from journal
+ self.game.world.pickle_load(event.filename)
elif event.type == MOUSEBUTTONDOWN and event.button == 1:
self.game.canvas.grab_focus()
handled = False