comparison libervia/pages/photos/album/_browser/__init__.py @ 1509:106bae41f5c8

massive refactoring from camelCase -> snake_case. See backend commit log for more details
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:44:11 +0200
parents b028a1256a09
children 5ea06e8b06ed
comparison
equal deleted inserted replaced
1508:ec3ad9abf9f9 1509:106bae41f5c8
1 from browser import document, window, bind, html, DOMNode, aio 1 from browser import document, window, bind, html, DOMNode, aio
2 from javascript import JSON 2 from javascript import JSON
3 from bridge import Bridge 3 from bridge import bridge
4 from aio_bridge import Bridge as AIOBridge 4 from aio_bridge import bridge as AIOBridge
5 from template import Template 5 from template import Template
6 import dialog 6 import dialog
7 from slideshow import SlideShow 7 from slideshow import SlideShow
8 from invitation import InvitationManager 8 from invitation import InvitationManager
9 import alt_media_player 9 import alt_media_player
17 files_path = window.files_path 17 files_path = window.files_path
18 try: 18 try:
19 affiliations = window.affiliations.to_dict() 19 affiliations = window.affiliations.to_dict()
20 except AttributeError: 20 except AttributeError:
21 pass 21 pass
22 bridge = Bridge() 22 bridge = bridge()
23 aio_bridge = AIOBridge() 23 aio_bridge = AIOBridge()
24 24
25 alt_media_player.install_if_needed() 25 alt_media_player.install_if_needed()
26 26
27 photo_tpl = Template('photo/item.html') 27 photo_tpl = Template('photo/item.html')
94 "uploading": True, 94 "uploading": True,
95 }) 95 })
96 photo_elt.classList.add("progress_started") 96 photo_elt.classList.add("progress_started")
97 album_items <= photo_elt 97 album_items <= photo_elt
98 98
99 bridge.fileHTTPUploadGetSlot( 99 bridge.file_http_upload_get_slot(
100 file_.name, 100 file_.name,
101 file_.size, 101 file_.size,
102 file_.type or '', 102 file_.type or '',
103 files_service, 103 files_service,
104 callback=lambda upload_slot, file_=file_, photo_elt=photo_elt: 104 callback=lambda upload_slot, file_=file_, photo_elt=photo_elt:
143 ) 143 )
144 144
145 145
146 def delete_ok(evt, notif_elt, item_elt, item): 146 def delete_ok(evt, notif_elt, item_elt, item):
147 file_path = f"{files_path.rstrip('/')}/{item['name']}" 147 file_path = f"{files_path.rstrip('/')}/{item['name']}"
148 bridge.fileSharingDelete( 148 bridge.file_sharing_delete(
149 files_service, 149 files_service,
150 file_path, 150 file_path,
151 "", 151 "",
152 callback=lambda : file_delete_cb(item_elt, item), 152 callback=lambda : file_delete_cb(item_elt, item),
153 errback=lambda failure: file_delete_eb(failure, item_elt, item), 153 errback=lambda failure: file_delete_eb(failure, item_elt, item),
190 img_blob = r.response 190 img_blob = r.response
191 # now we'll upload it via HTTP Upload, we need a slow 191 # now we'll upload it via HTTP Upload, we need a slow
192 img_name = img_elt.src.rsplit('/', 1)[-1] 192 img_name = img_elt.src.rsplit('/', 1)[-1]
193 img_size = img_blob.size 193 img_size = img_blob.size
194 194
195 slot = await aio_bridge.fileHTTPUploadGetSlot( 195 slot = await aio_bridge.file_http_upload_get_slot(
196 img_name, 196 img_name,
197 img_size, 197 img_size,
198 '', 198 '',
199 files_service 199 files_service
200 ) 200 )
207 level="error" 207 level="error"
208 ) 208 )
209 return 209 return
210 extra = {"thumb_url": get_url} 210 extra = {"thumb_url": get_url}
211 album_name = files_path.rsplit('/', 1)[-1] 211 album_name = files_path.rsplit('/', 1)[-1]
212 await aio_bridge.interestsRegisterFileSharing( 212 await aio_bridge.interests_file_sharing_register(
213 files_service, 213 files_service,
214 "photos", 214 "photos",
215 "", 215 "",
216 files_path, 216 files_path,
217 album_name, 217 album_name,