def show_fourslideshow_imgs(screen, file, speed): paint_screen(screen, gl.IMGV_COLOR) set_caption("Slideshow - imgv") (file, img_one_rect, img_one_name, img_one_file) = square_one(screen, file) (file, img_two_rect, img_two_name, img_two_file) = square_two(screen, file) (file, img_three_rect, img_three_name, img_three_file) = square_three(screen, file) (file, img_four_rect, img_four_name, img_four_file) = square_four(screen, file) if speed > 0: for i in range(speed): event = pygame.event.poll() pygame.time.wait(1) if event.type == KEYDOWN and event.key not in (K_LALT, K_RALT, K_LCTRL, K_RCTRL,\ K_p, K_PAUSE, K_TAB, K_SPACE, K_BACKSPACE): stopped_msg(screen) return (file, 1, img_one_file, img_two_file, img_three_file, img_four_file) if hit_key(event, K_p) or hit_key(event, K_PAUSE): pause(screen) pygame.time.delay(1000) return (file, 0, img_one_file, img_two_file, img_three_file, img_four_file)
def my_fourslideshow(screen, new_img, rect, filename, file, num_imgs, img_one_file, img_two_file, img_three_file, img_four_file, ns): if not gl.TOGGLE_FULLSCREEN_SET: screen = set_mode(screen.get_size()) set_caption("Slideshow Options - imgv") speed = get_speed(screen, new_img, rect, filename, file, num_imgs) if not speed == -1: # didn't hit Esc from get_speed: gl.SLIDE_SHOW_RUNNING = 1 disable_screensaver() dont_call = 0 while 1: event = pygame.event.poll() pygame.time.wait(1) check_quit(event) if event.type == KEYDOWN and event.key not in (K_LALT, K_RALT, K_LCTRL, K_RCTRL,\ K_p, K_PAUSE, K_TAB, K_SPACE, K_BACKSPACE): stopped_msg(screen) file = file - 1 (file, new_img, start) = four(screen, file, new_img, ns) # needed to repaint break if hit_key(event, K_p) or hit_key(event, K_PAUSE): pause(screen) if dont_call == 1: break if not gl.WRAP_SLIDESHOW: if file < num_imgs: (file, dont_call, img_one_file, img_two_file, img_three_file, img_four_file) =\ show_fourslideshow_imgs(screen, file, speed) if gl.WRAP_SLIDESHOW: if file >= num_imgs: file = 0 (file, dont_call, img_one_file, img_two_file, img_three_file, img_four_file) =\ show_fourslideshow_imgs(screen, file, speed) pygame.time.delay(5) else: # escaped file = file + 4 return (file, img_one_file, img_two_file, img_three_file, img_four_file) if not gl.TOGGLE_FULLSCREEN_SET: screen = set_mode(screen.get_size(), RESIZABLE) return (file, img_one_file, img_two_file, img_three_file, img_four_file)