import os.path, sys, pgm, gobject, gtk.gdk
def getImages(imgDir):
if os.path.isdir (imgDir):
images = {}
i =0
for file in os.listdir(imgDir):
i +=1
images[i] = file
return images
imageDir = "/home/daxroc/Desktop/My_Documents/Video/Movies/.thumbs/"
# Update the viewport on an expose event
def on_expose(viewport, event):
viewport.update()
# Terminate the mainloop on a delete event
def on_delete(viewport, event):
pgm.main_quit()
def main(args):
# OpenGL viewport creation
gl = pgm.viewport_factory_make('opengl')
gl.title = 'Euphoria'
#gl.icon = gtk.gdk.pixbuf_new_from_file('pictures/fluendo.png')
# Canvas and image drawable creation
cvs = pgm.Canvas()
#img = pgm.Image()
# Bind the canvas to the OpenGL viewport
gl.set_canvas(cvs)
# itter all files and load the image for the file
files = getImages(imageDir)
img = {}
i
for k,file in files.iteritems():
img[k] = pgm.Image()
img[k].set_from_file(imageDir+file)
img[k].bg_color = (255,255,255,0)
img[k].position = (k+1.3,1.0,0.0)
# Load an image from a filename
img.set_from_file('pictures/fluendo.png')
img.bg_color = (255, 255, 255, 0)
# Center the image
img.position = (1.5, 1.0, 0.0)
# A drawable needs to be shown
img.show()
# Add it to the middle layer of the canvas
cvs.add(pgm.DRAWABLE_MIDDLE, img)
# Let's connect our callbacks and start the mainloop
gl.connect('expose-event', on_expose)
gl.connect('delete-event', on_delete)
gl.show()
gl.update()
pgm.main()
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))