()
| 126 | |
| 127 | |
| 128 | def main(): |
| 129 | files = [os.path.join(ROOT_FOLDER, f) for f in os.listdir(ROOT_FOLDER) if True in [f.endswith(e) for e in EXTS]] |
| 130 | files.sort() |
| 131 | t_win = make_thumbnails(files) |
| 132 | offset, currently_displaying = display_images(t_win, 0, files) |
| 133 | # offset = THUMBNAILS_PER_PAGE[0] * THUMBNAILS_PER_PAGE[1] |
| 134 | # currently_displaying = {} |
| 135 | while True: |
| 136 | win, event, values = sg.read_all_windows() |
| 137 | print(event, values) |
| 138 | if win == sg.WIN_CLOSED: # if all windows are closed |
| 139 | break |
| 140 | |
| 141 | if event == sg.WIN_CLOSED or event == 'Exit': |
| 142 | break |
| 143 | |
| 144 | if isinstance(event, tuple): |
| 145 | display_image_window(currently_displaying.get(event)) |
| 146 | continue |
| 147 | elif event == '-SLIDER-': |
| 148 | offset = int(values['-SLIDER-']*len(files)/100) |
| 149 | event = '-NEXT-' |
| 150 | else: |
| 151 | t_win['-SLIDER-'].update(offset * 100 / len(files)) |
| 152 | |
| 153 | if event == '-NEXT-' or event.endswith('Down'): |
| 154 | offset, currently_displaying = display_images(t_win, offset, files) |
| 155 | elif event == '-PREV-' or event.endswith('Up'): |
| 156 | offset -= THUMBNAILS_PER_PAGE[0]*THUMBNAILS_PER_PAGE[1]*2 |
| 157 | if offset < 0: |
| 158 | offset = 0 |
| 159 | offset, currently_displaying = display_images(t_win, offset, files) |
| 160 | |
| 161 | |
| 162 |
no test coverage detected