def StopSession(screen, capturedImages, event_dir): pygame.time.set_timer(EVT_PICTURE, 0) pygame.time.set_timer(EVT_COUNTDOWN, 0) # Compose final image filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S.jpg") (finalImg, dest_file) = ProcessImages(capturedImages, event_dir, filename) # Send photobooth picture to printer if config.PRINT_COPIES > 0: numCopies = min(config.PRINT_COPIES, 3) # just in case for i in range(numCopies): logger.info("PRINTING %d of %d..." % (i+1, numCopies)) config.PRINT_FUNC(config.PRINTER_NAME, dest_file) # Display final image pygame.time.wait(800) DisplayFinalPicture(screen, finalImg) pygame.time.wait(config.FINAL_IMG_SHOW_DELAY); # Reset event timers and GUI for next session gui.display_title_screen(screen, config.TITLE1, config.TITLE2, config.PRESS_BTN_TEXT) pygame.time.set_timer(EVT_BTN_BLINK, config.BTN_BLINK_RATE) pygame.event.clear() logger.info("EVENTS CLEARED")
def SetMaintenanceMode(maint_mode): global maintenance_mode maintenance_mode = maint_mode if maint_mode: # Put photobooth in maintenance mode pygame.time.set_timer(EVT_BTN_BLINK, 0) gui.init(screen) gui.display_brb_screen(screen, "Please wait...", "I need to be serviced") pygame.event.clear() logger.info("PHOTOBOOTH BRB") else: # Resume normal photobooth operation gui.init(screen) gui.display_title_screen(screen, config.TITLE1, config.TITLE2, config.PRESS_BTN_TEXT) pygame.time.set_timer(EVT_BTN_BLINK, config.BTN_BLINK_RATE) pygame.event.clear() logger.info("RESUME OPERATION")
pygame.display.set_caption( "Photobooth" ) screen = pygame.display.get_surface() # Initialize GUI gui.init(screen) # Initialize stats module stats.clear_all() # Start HTTP server cmdQ = Queue.Queue() http_server = server.http.HttpServer(event_dir, stats, cmdQ) http_server.start() # Display title screen and start press button text blink timer gui.display_title_screen(screen, config.TITLE1, config.TITLE2, config.PRESS_BTN_TEXT) pygame.time.set_timer(EVT_BTN_BLINK, config.BTN_BLINK_RATE) # Initialize variables capturedImages = [] filterFn = None on_exit = False maintenance_mode = False capture_in_progress = False countdown_timer = 0 # Main processing loop while not on_exit : events = pygame.event.get() for event in events: