[OLPC-Games] Advisory: Require explicit imports of OLPCGames sub-modules

Mike C. Fletcher mcfletch at vrplumber.com
Thu Jan 31 11:59:23 EST 2008


Mike C. Fletcher wrote:
> Hi Everyone,
>
> I'm looking at how to clean up the OLPCGames code base so that it's
> easily maintained and more flexible.  I particularly want to get to the
> point where our functionality is not all tied to the embed-pygame-in-GTK
> approach and we don't pull in every major GTK/Pango/Cairo library for
> every single Pygame game (egads!).  At the moment it looks like we will
> be stuck with at least GObject to get activity-level interactions (e.g.
> notification of "activation" and the like) (a pain because GObject takes
> a very long time to load and isn't really doing much for us), but I'd
> like to make pretty much everything else optional.
>
> To that end, I'm planning on requiring explicit importing of OLPCGames
> sub-modules (and likely module.init() operations for a few of them). 
> That is, if you are currently just doing:
>
>     import olpcgames
>     olpcgames.pangofont.install()
>
> your code would need to become:
>
>     from olpcgames import pangofont
>     pangofont.install()
>
> or
>
>     import olpcgames.pangofont
>     olpcgames.pangofont.install()
>
> (same for mesh, activity, and camera).
>
> I'm guessing most activities have been using explicit imports anyway. 
> If you haven't, please update your code base to use them, as the next
> release of OLPCGames likely will require them.
>
> Don't get too excited about the elimination of the GTK wrapper.  At the
> moment I don't have a good plan for that.  Pippy is just forcing the
> screen to be full-size, which won't work for size-constrained games.  We
> also, AFAIK don't have any hardware support anyway, so we're not going
> to get a lot of benefit other than memory and load-time speed out of
> dropping the GTK wrapper (assuming it's even doable with Pygame (the
> X-windows stuff looks like it'll be a pain when we're working through
> Pygame)).
>
> Anyway, enjoy yourselves,
> Mike
>   
Reminder: this change is about to land in OLPCGames 1.5, the changes are 
already in GIT and the new release will likely be coming out sometime 
today.  I've cleaned up the spelling of PyGame to be Pygame everywhere.  
That means your activity class definitions should likely change to:

from olpcgames import activity
class MyActivity( activity.PygameActivity ):
    ...

I've updated most of the activities which are in the games-misc 
repository to have that import.  Please check that the changes are 
sufficient to let your activities launch.

Enjoy yourselves,
Mike


More information about the Games mailing list