diff options
author | flavio <fdanesse@gmail.com> | 2012-07-01 16:07:58 (GMT) |
---|---|---|
committer | flavio <fdanesse@gmail.com> | 2012-07-01 16:07:58 (GMT) |
commit | 3de4f3b6d88b531d0c33bd9791250b4f81f55b11 (patch) | |
tree | 835f5b8c77365cc5853d1e76e07806bbbf645dcb | |
parent | 3e704db1378ce14701d3f8071326ff10b5192afd (diff) |
Verificando que no se utilice hippo
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | olpcgames/activity.py | 71 |
2 files changed, 41 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bb6a67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pyo +*.pyc +*.xo +*.bak diff --git a/olpcgames/activity.py b/olpcgames/activity.py index ddd9a85..0c1b219 100644 --- a/olpcgames/activity.py +++ b/olpcgames/activity.py @@ -3,14 +3,14 @@ """Embeds the Canvas widget into a Sugar-specific Activity environment The olpcgames.activity module encapsulates creation of a Pygame activity. -Your Activity should inherit from this class. Simply setting some class -attributes is all you need to do in a class inheriting from -olpcgames.activity.PygameActivity in order to get Pygame to work. +Your Activity should inherit from this class. Simply setting some class +attributes is all you need to do in a class inheriting from +olpcgames.activity.PygameActivity in order to get Pygame to work. (The skeleton builder script creates this file automatically for you). -Note: - You should not import pygame into your activity file, as the olpcgames +Note: + You should not import pygame into your activity file, as the olpcgames wrapper needs to be initialized before pygame is imported the first time. Example usage: @@ -50,8 +50,8 @@ class PygameActivity(activity.Activity): 'package.module:main' if no function name is provided, "main" is assumed. - game_handler -- DEPRECATED. alternate specification via direct - reference to a main-loop function. + game_handler -- DEPRECATED. alternate specification via direct + reference to a main-loop function. game_size -- two-value tuple specifying the size of the display in pixels, this is currently static, so once the window is created it cannot be @@ -82,8 +82,8 @@ class PygameActivity(activity.Activity): the __init__ method. We should allow for customising both the UI layout and the toolbar contents/layout/connection. - XXX Note that if you change the title of your activity in the toolbar you may - see the same focus issues as we have patched around in the build_toolbar + XXX Note that if you change the title of your activity in the toolbar you may + see the same focus issues as we have patched around in the build_toolbar method. If so, please report them to Mike Fletcher. """ game_name = None @@ -172,31 +172,34 @@ class PygameActivity(activity.Activity): gtk.gdk.threads_init() return self._pgc else: - import hippo - self._drawarea = gtk.DrawingArea() - canvas = hippo.Canvas() - canvas.grab_focus() - self.set_canvas(canvas) - self.show_all() - - import pygamecairo - pygamecairo.install() - - pygamecairo.display.init(canvas) - app = self.game_handler or self.game_name - if ':' not in app: - app += ':main' - mod_name, fn_name = app.split(':') - mod = __import__(mod_name, globals(), locals(), []) - fn = getattr(mod, fn_name) - fn() + # FIXME Es necesario quitar hippo de aquĆ + #import hippo + #self._drawarea = gtk.DrawingArea() + #canvas = hippo.Canvas() + #canvas.grab_focus() + #self.set_canvas(canvas) + #self.show_all() + + #import pygamecairo + #pygamecairo.install() + + #pygamecairo.display.init(canvas) + #app = self.game_handler or self.game_name + #if ':' not in app: + # app += ':main' + #mod_name, fn_name = app.split(':') + #mod = __import__(mod_name, globals(), locals(), []) + #fn = getattr(mod, fn_name) + #fn() + pass + def read_file(self, file_path): """Handle request to read the given file on the Pygame side This is complicated rather noticeably by the silly semantics of the Journal - where it unlinks the file as soon as this method returns. We either have to - handle the file-opening in PyGTK (not acceptable), block this thread until - the Pygame thread handles the event (which it may never do) or we have + where it unlinks the file as soon as this method returns. We either have to + handle the file-opening in PyGTK (not acceptable), block this thread until + the Pygame thread handles the event (which it may never do) or we have to make the silly thing use a non-standard file-opening interface. """ log.info( 'read_file: %s %s', file_path, self.metadata ) @@ -211,11 +214,11 @@ class PygameActivity(activity.Activity): eventwrap.post( event ) event.block() def write_file( self, file_path ): - """Handle request to write to the given file on the Pygame side + """Handle request to write to the given file on the Pygame side - This is rather complicated by the need to have the file complete by the - time the function returns. Very poor API, after all, if I have to write a - multi-hundred-megabyte file it might take many minutes to complete + This is rather complicated by the need to have the file complete by the + time the function returns. Very poor API, after all, if I have to write a + multi-hundred-megabyte file it might take many minutes to complete writing. """ log.info( 'write_file: %s %s', file_path, self.metadata ) |