Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@laptop.org>2007-12-27 07:55:47 (GMT)
committer C. Scott Ananian <cscott@laptop.org>2008-05-20 19:11:52 (GMT)
commit9092f208ba3af5cbc8103979068f5ec6449fe45d (patch)
tree8c9a81a502cb1b61557066d4424d5d46f56455a2 /data
parentd18279cec039b7d1c6fcbe381fda5f7093169d11 (diff)
Attempt to make a proper activity out of slideshow.
Diffstat (limited to 'data')
-rw-r--r--data/graphics/slideshow127
1 files changed, 64 insertions, 63 deletions
diff --git a/data/graphics/slideshow b/data/graphics/slideshow
index 186c731..0d38ab8 100644
--- a/data/graphics/slideshow
+++ b/data/graphics/slideshow
@@ -1,64 +1,65 @@
# slideshow: show datastore photos
-import gst, pippy, pygame, sys, time
-from random import *
-
-# XO screen is 1200 by 900
-size = width, height = 1200, 900
-
-# grey background
-bgcolor = (128,128,128)
-
-# Create a search dict
-search = {}
-search["mime_type"] = "image/jpeg"
-
-from pippy import query
-
-# Perform the search and retrieve the jobjects
-results = query.find(search)
-# XXX: Fix caching limit in query.py
-objects = results.read(15)
-
-if len(objects) == 0:
- print "No photos found."
- time.sleep(3)
- sys.exit()
-
-def get_image():
- for jobject in objects:
- yield jobject.get_file_path()
-
-next_image = get_image()
-
-# pygame always needs to be initialized as the first call
-pygame.init()
-
-# turn off cursor
-pygame.mouse.set_visible(False)
-
-# create the pygame window at the desired size and return a Surface object for
-# drawing in that window.
-screen = pygame.display.set_mode(size)
-
-# load in previously grabbed frame
-image = pygame.image.load(next_image.next())
-
-while pippy.pygame.next_frame():
- for event in pygame.event.get():
- if event.type == pygame.QUIT: sys.exit()
- elif event.type == pygame.KEYDOWN:
- try:
- image = pygame.image.load(next_image.next())
- except StopIteration:
- sys.exit()
-
- # Scale up from 640x480 -> 1280x960
- newImage = pygame.transform.rotozoom(image, 0, 2.0)
- newImageRect = newImage.get_rect()
- newImageRect.centerx = screen.get_rect().centerx
- newImageRect.centery = screen.get_rect().centery
-
- screen.fill(bgcolor)
- screen.blit(newImage, newImageRect)
- pygame.display.flip()
-
+def pippy_activity_class(): return 'activity.PyGameActivity'
+if __name__ == '__main__':
+ import gst, pippy, pygame, sys, time
+ from pippy import query
+
+ from random import *
+
+ # XO screen is 1200 by 900
+ size = width, height = 1200, 900
+
+ # grey background
+ bgcolor = (128,128,128)
+
+ # Create a search dict
+ search = {}
+ search["mime_type"] = "image/jpeg"
+
+ # Perform the search and retrieve the jobjects
+ results = query.find(search)
+ # XXX: Fix caching limit in query.py
+ objects = results.read(15)
+
+ if len(objects) == 0:
+ print "No photos found."
+ time.sleep(3)
+ sys.exit()
+
+ def get_image():
+ for jobject in objects:
+ yield jobject.get_file_path()
+
+ next_image = get_image()
+
+ # pygame always needs to be initialized as the first call
+ pygame.init()
+
+ # turn off cursor
+ pygame.mouse.set_visible(False)
+
+ # create the pygame window at the desired size and return a Surface object for
+ # drawing in that window.
+ screen = pygame.display.set_mode(size)
+
+ # load in previously grabbed frame
+ image = pygame.image.load(next_image.next())
+
+ while pippy.pygame.next_frame():
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT: sys.exit()
+ elif event.type == pygame.KEYDOWN:
+ try:
+ image = pygame.image.load(next_image.next())
+ except StopIteration:
+ sys.exit()
+
+ # Scale up from 640x480 -> 1280x960
+ newImage = pygame.transform.rotozoom(image, 0, 2.0)
+ newImageRect = newImage.get_rect()
+ newImageRect.centerx = screen.get_rect().centerx
+ newImageRect.centery = screen.get_rect().centery
+
+ screen.fill(bgcolor)
+ screen.blit(newImage, newImageRect)
+ pygame.display.flip()