[Sugar-devel] [PATCH] adapt pippy examples to screen dimensions, dev.laptop.org #9260

James Cameron quozl at laptop.org
Mon Jun 21 23:15:29 EDT 2010


On Sat, Jun 19, 2010 at 01:32:52PM +0000, Sascha Silbe wrote:
> Excerpts from James Cameron's message of Fri May 21 09:42:28 +0000 2010:
> 
> > +  # fill the screen with white
> > +  screen.fill((250, 250, 250))
> Might it be worth noting that it's just almost-white, with 255 being
> the maximum (the latter is mentioned in another example, though)?

Thanks, fixed.

> >  image = pygame.image.load("/tmp/pippypic.jpg")
> Shouldn't this use the activity tmp directory?

No, I don't think so, because it's not activity code.  /tmp is adequate
for the purpose.

> > +  # angle and scale the image
> s/angle/Rotate/ ?

Thanks, fixed.

> > +  # display the angled and scaled image
> dito

Ditto.

> > +    # (red, green, blue), where 0 <= value < 256
> "value <= 255" might be better - give the largest value that still
> works instead of the first one that doesn't.

Thanks, fixed.

> > +# FIXME: does not currently work, because no objects are returned by
> > +# the journal query.
> Ouch, Pippy bundles an ancient copy of Journal code. It should get rid
> of it and use sugar.datastore.datastore in the examples.

ENOPATCH.  No idea how to do this, sounds like a big job, I'd rather
remove the example as misleading, and that's what I propose first.
Raised new ticket SL #2054.

> >  while pippy.pygame.next_frame():
> > -  # chill until a key is pressed
> > +  # chill until escape key is pressed
> "the escape key"?

Thanks, fixed.

> >                  if (event.type == KEYDOWN and (event.key == K_UP or event.key == K_KP9)):
> At least on Debian, the rocker keys produce KP_Up/..., so it's worth
> checking for those. Either instead of or in addition to the number
> keys (event.key in [K_UP, K_KP9, KP_Up]). That way you can play in
> ebook mode.

Already works in ebook mode on XO-1.5; the rocker up key generates 264,
which is K_KP8.

Can't find pygame.KP_Up ... and haven't been able to get a Debian build
for XO-1.5, so can you please try this test program and report back the
numeric key codes for those keys on your environment?  How many units
are deployed with this build?

#!/usr/bin/python
import pygame, time
pygame.init()
screen = pygame.display.set_mode((200,200))
while True:
    screen.fill((255,255,255))
    pygame.display.flip()
    pygame.time.wait(100)
    screen.fill((0,0,0))
    pygame.display.flip()
    event = pygame.event.wait()
    print event
    if event.type == pygame.QUIT:
        break
pygame.display.quit()
pygame.quit()

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list