Mercurial > libervia-web
comparison libervia/pages/photos/album/_browser/__init__.py @ 1308:7a4a92cf5b2b
browser (album): start slideshow on photo click
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 16 Jul 2020 09:08:50 +0200 |
parents | 6e110baa707f |
children | 39a87d9099c4 |
comparison
equal
deleted
inserted
replaced
1307:0a6698714557 | 1308:7a4a92cf5b2b |
---|---|
4 from javascript import JSON | 4 from javascript import JSON |
5 from interpreter import Inspector | 5 from interpreter import Inspector |
6 from bridge import Bridge | 6 from bridge import Bridge |
7 from template import Template | 7 from template import Template |
8 import dialog | 8 import dialog |
9 from slideshow import SlideShow | |
9 | 10 |
10 files_service = window.files_service | 11 files_service = window.files_service |
11 files_path = window.files_path | 12 files_path = window.files_path |
12 bridge = Bridge() | 13 bridge = Bridge() |
13 | 14 |
149 ok_cb=lambda evt, notif_elt: delete_ok(evt, notif_elt, item_elt, item), | 150 ok_cb=lambda evt, notif_elt: delete_ok(evt, notif_elt, item_elt, item), |
150 cancel_cb=lambda evt, notif_elt: delete_cancel(evt, notif_elt, item_elt, item), | 151 cancel_cb=lambda evt, notif_elt: delete_cancel(evt, notif_elt, item_elt, item), |
151 ) | 152 ) |
152 | 153 |
153 | 154 |
155 @bind(".photo_thumb_click", "click") | |
156 def photo_click(evt): | |
157 evt.stopPropagation() | |
158 evt.preventDefault() | |
159 slideshow = SlideShow() | |
160 target = evt.currentTarget | |
161 clicked_item_elt = DOMNode(target.elt.closest('.item')) | |
162 | |
163 select_idx = 0 | |
164 slideshow.attach() | |
165 for idx, item_elt in enumerate(document.select('.item')): | |
166 item = JSON.parse(item_elt.dataset.item) | |
167 slide = html.DIV(Class="swiper-slide") | |
168 img = html.IMG(src=item['url'], Class="slide_img") | |
169 slide <= img | |
170 slide._item = item | |
171 slideshow.add_slide(slide) | |
172 if item_elt == clicked_item_elt: | |
173 slideshow.index = idx | |
174 | |
175 | |
154 for elt in document.select('.action_delete'): | 176 for elt in document.select('.action_delete'): |
155 elt.bind("click", on_delete) | 177 elt.bind("click", on_delete) |