| 103 | | if symbol == key.D and hovering_over != None: |
|---|
| 104 | | assert images.has_key(hovering_over) |
|---|
| 105 | | del images[hovering_over] |
|---|
| 106 | | update_renderables() |
|---|
| 107 | | shutil.move(hovering_over, "%s/%s"%(config.trash_dir, os.path.basename(hovering_over))) |
|---|
| 108 | | last_deleted.append(hovering_over) |
|---|
| | 103 | if hovering_over != None: |
|---|
| | 104 | if symbol == key.D: |
|---|
| | 105 | assert images.has_key(hovering_over) |
|---|
| | 106 | del images[hovering_over] |
|---|
| | 107 | update_renderables() |
|---|
| | 108 | shutil.move(hovering_over, "%s/%s"%(config.trash_dir, os.path.basename(hovering_over))) |
|---|
| | 109 | last_deleted.append(hovering_over) |
|---|
| 174 | | wi.im.thumbnail((config.crop_size, config.crop_size), Image.ANTIALIAS) |
|---|
| 175 | | wi.im = wi.im.transpose(Image.FLIP_TOP_BOTTOM) |
|---|
| 176 | | psurf=pyglet_image.ImageData(wi.im.size[0],wi.im.size[1],"RGB",wi.im.tostring()) |
|---|
| 177 | | |
|---|
| | 174 | |
|---|
| | 175 | # resize the image so the smallest dimension is config.crop_size |
|---|
| | 176 | im = wi.im |
|---|
| | 177 | w,h = im.size |
|---|
| | 178 | s=0 |
|---|
| | 179 | if w > h: |
|---|
| | 180 | s = 1.0*config.crop_size/h |
|---|
| | 181 | else: |
|---|
| | 182 | s = 1.0*config.crop_size/w |
|---|
| | 183 | |
|---|
| | 184 | w = int(w*s) |
|---|
| | 185 | h = int(h*s) |
|---|
| | 186 | |
|---|
| | 187 | im.thumbnail((w, h), Image.ANTIALIAS) |
|---|
| | 188 | |
|---|
| | 189 | |
|---|
| | 190 | # crop out the centre crop_size square to use a thumbnail |
|---|
| | 191 | midx = w/2 |
|---|
| | 192 | midy = h/2 |
|---|
| | 193 | |
|---|
| | 194 | box = (midx-config.crop_size/2, midy-config.crop_size/2, midx+config.crop_size/2, midy+config.crop_size/2) |
|---|
| | 195 | im=im.crop(box) |
|---|
| | 196 | |
|---|
| | 197 | # make a pyglet image out of it |
|---|
| | 198 | im = im.transpose(Image.FLIP_TOP_BOTTOM) |
|---|
| | 199 | psurf=pyglet_image.ImageData(im.size[0],im.size[1],"RGB",im.tostring()) |
|---|
| | 200 | |
|---|
| | 201 | # add to our dictionary |
|---|