comparison libervia/pages/photos/album/_browser/__init__.py @ 1510:5ea06e8b06ed

browser: make bridge API closer to the one use with other frontends: `bridge.AsyncBridge` is not used instead of `aio_bridge.Bridge`
author Goffi <goffi@goffi.org>
date Mon, 22 May 2023 11:57:44 +0200
parents 106bae41f5c8
children
comparison
equal deleted inserted replaced
1509:106bae41f5c8 1510:5ea06e8b06ed
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, AsyncBridge
4 from aio_bridge import bridge as AIOBridge
5 from template import Template 4 from template import Template
6 import dialog 5 import dialog
7 from slideshow import SlideShow 6 from slideshow import SlideShow
8 from invitation import InvitationManager 7 from invitation import InvitationManager
9 import alt_media_player 8 import alt_media_player
17 files_path = window.files_path 16 files_path = window.files_path
18 try: 17 try:
19 affiliations = window.affiliations.to_dict() 18 affiliations = window.affiliations.to_dict()
20 except AttributeError: 19 except AttributeError:
21 pass 20 pass
22 bridge = bridge() 21 bridge = Bridge()
23 aio_bridge = AIOBridge() 22 async_bridge = AsyncBridge()
24 23
25 alt_media_player.install_if_needed() 24 alt_media_player.install_if_needed()
26 25
27 photo_tpl = Template('photo/item.html') 26 photo_tpl = Template('photo/item.html')
28 player_tpl = Template('components/media_player.html') 27 player_tpl = Template('components/media_player.html')
190 img_blob = r.response 189 img_blob = r.response
191 # now we'll upload it via HTTP Upload, we need a slow 190 # now we'll upload it via HTTP Upload, we need a slow
192 img_name = img_elt.src.rsplit('/', 1)[-1] 191 img_name = img_elt.src.rsplit('/', 1)[-1]
193 img_size = img_blob.size 192 img_size = img_blob.size
194 193
195 slot = await aio_bridge.file_http_upload_get_slot( 194 slot = await async_bridge.file_http_upload_get_slot(
196 img_name, 195 img_name,
197 img_size, 196 img_size,
198 '', 197 '',
199 files_service 198 files_service
200 ) 199 )
207 level="error" 206 level="error"
208 ) 207 )
209 return 208 return
210 extra = {"thumb_url": get_url} 209 extra = {"thumb_url": get_url}
211 album_name = files_path.rsplit('/', 1)[-1] 210 album_name = files_path.rsplit('/', 1)[-1]
212 await aio_bridge.interests_file_sharing_register( 211 await async_bridge.interests_file_sharing_register(
213 files_service, 212 files_service,
214 "photos", 213 "photos",
215 "", 214 "",
216 files_path, 215 files_path,
217 album_name, 216 album_name,