wallpaper: only display really used files

This commit is contained in:
Vincent Bernat 2012-10-03 23:23:55 +02:00
parent 5cd8925efe
commit 3dd614555a

View file

@ -60,10 +60,11 @@ for root, _, files in os.walk(os.path.join(options.directory)):
images = random.sample(images,
len(screens) + \
random.randint(0, 3)) # Randomly favor larger images
print "Build new wallpaper with %s" % " + ".join(["`%s`" % x[(len(options.directory) + 1):] for x in images])
images = [Image.open(os.path.join(options.directory,
image)) for image in images]
images.sort(key=lambda image: -image.size[0]*image.size[1])
print "wallpaper: %s" % " + ".join(["`%s`" % x.filename[(len(options.directory) + 1):]
for x in images[:len(screens)]])
for index in range(len(screens)):
x, y, offsetx, offsety = screens[index]