diff --git a/photobox.py b/photobox.py index bb7f322..57ffd7c 100755 --- a/photobox.py +++ b/photobox.py @@ -215,15 +215,11 @@ def waitForBegin(): -def countdown(camera, pad, img, flash): +def countdown(camera, pad, img): sleep(PIC_INTERVAL) o = camera.add_overlay(pad.tostring(), size=img.size) o.alpha = OVERLAY_ALPHA o.layer = 3 -# if flash: -# GPIO.output(7, GPIO.HIGH) -# sleep(0.01) -# GPIO.output(7, GPIO.LOW) sleep(TEXT_INTERVAL) camera.remove_overlay(o) @@ -245,7 +241,7 @@ def makePhotos(): # COUNTDOWN GPIO.output(7, GPIO.HIGH) for i in range(0, COUNTDOWN): - countdown(camera, pad_cdn[i], img_cdn[i], True) + countdown(camera, pad_cdn[i], img_cdn[i]) GPIO.output(7, GPIO.LOW) # SHOTS @@ -300,7 +296,7 @@ def chooseImages(): cancel = False any_choice = False while not cancel and (not save or not any_choice): - # reset save (due to no choice made) + # reset save (if nothing selected) save = False # draw background @@ -336,6 +332,7 @@ def chooseImages(): i = int(floor((pos[0] - BORDER / 2) / (THUMB_WIDTH + BORDER))) if i >= 0 and i < SHOT_COUNT: choices[i] = (choices[i] + 1) % 2 + elif pos[1] < 100: # top menu buttons if pos[0] > 0 and pos[0] < 266: @@ -348,9 +345,6 @@ def chooseImages(): if choice > 0: any_choice = True break - - # END: choice - #~ print("# END: choice") return (choices, save) @@ -367,27 +361,25 @@ def saveImages(choices): filename = "%s-%s-session_age=%05d.jpg" % (local.strftime("%Y%m%dT%H:%M:%S.%f%z"), i, session_age) os.rename("tmp%s.jpg" % i, IMAGE_DIR + "/original/" + filename) copyfile(IMAGE_DIR + "/original/" + filename, IMAGE_DIR + "/todo/" + filename) - - # show message - screen.fill(COLOR_BACK) - screen.blit(saved, saved_rect) - pygame.display.flip() - sleep(2) while 1: waitForBegin() + makePhotos() (choices, save) = chooseImages() - if save: saveImages(choices); + screen.fill(COLOR_BACK) + screen.blit(saved, saved_rect) + pygame.display.flip() else: - # show message screen.fill(COLOR_BACK) screen.blit(canceled, canceled_rect) pygame.display.flip() - sleep(2) + + sleep(2) + pygame.quit()