Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/olpcgames/video.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-03-27 13:15:10 (GMT)
committer Rafael Ortiz <rafael@activitycentral.com>2012-03-28 18:05:22 (GMT)
commit335ad73456ba3ec8f56811abddcaca4650199db1 (patch)
treedb788baba57c7656c9bdb73eb9003a70dc87d59a /olpcgames/video.py
parent6deeb3f569e6c9a1c02a32a011b7a96a58fa8443 (diff)
Save and restore state of the game
Ability to 'save' (when the user closes the Activity) and 'restore' (when the user launch it from the Journal or the Home without holding Alt) the state of the game. For this ability I had to upgrade 'olpcgames' to 1.6 because 'olpcgames.FILE_READ_REQUEST' and 'olpcgames.FILE_WRITE_REQUEST' events are added in that version and those events are needed for this. The data is saved (as JSON, with json module) in the 'event.metadata["state"]' and the timestamp state is saved in 'event.filename'. This commit solves ticket #2393: * http://bugs.sugarlabs.org/ticket/2393 Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Signed-off-by: Rafael Ortiz <rafael@activitycentral.com>
Diffstat (limited to 'olpcgames/video.py')
-rw-r--r--olpcgames/video.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/olpcgames/video.py b/olpcgames/video.py
index 0cf9ac9..032aa13 100644
--- a/olpcgames/video.py
+++ b/olpcgames/video.py
@@ -1,11 +1,18 @@
-"""Video widget for displaying a gstreamer pipe"""
+"""Video widget for displaying a gstreamer pipe
+
+Note: currently this module is not all that elegant or useful,
+we need a better recipe for using and working with Video
+under OLPCGames.
+"""
import logging
log = logging.getLogger( 'olpcgames.video' )
#log.setLevel( logging.INFO )
import os
import signal
import pygame
+import weakref
import olpcgames
+from olpcgames import _gtkmain
import pygtk
pygtk.require('2.0')
@@ -79,6 +86,7 @@ class PygameWidget( object ):
window_id = int(os.environ['SDL_WINDOWID'])
self.window_id = window_id
self._imagesink = None
+ #self._holder = _gtkmain.Holder()
def set_sink( self, sink ):
"""Set up our gst sink"""
log.info( 'Setting sink: %s', sink )
@@ -149,7 +157,7 @@ if __name__ == "__main__":
display.flip()
pgw = PygameWidget( )
- p = Player( pgw )
+ p = Player( pgw, pipe_desc=Player.test_pipe_desc )
p.play()
clock = pygame.time.Clock()