comparison libervia/pages/photos/_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 dbd573b0bc9c
children 5ea06e8b06ed
comparison
equal deleted inserted replaced
1508:ec3ad9abf9f9 1509:106bae41f5c8
1 from browser import window, bind, DOMNode 1 from browser import window, bind, DOMNode
2 from javascript import JSON 2 from javascript import JSON
3 from bridge import Bridge 3 from bridge import bridge
4 import dialog 4 import dialog
5 5
6 bridge = Bridge() 6 bridge = bridge()
7 7
8 8
9 def album_delete_cb(item_elt, item): 9 def album_delete_cb(item_elt, item):
10 print(f"deleted {item['name']}") 10 print(f"deleted {item['name']}")
11 11
17 17
18 def interest_retract_cb(item_elt, item): 18 def interest_retract_cb(item_elt, item):
19 print(f"{item['name']} removed successfuly from list of interests") 19 print(f"{item['name']} removed successfuly from list of interests")
20 item_elt.classList.add("state_deleted") 20 item_elt.classList.add("state_deleted")
21 item_elt.bind("transitionend", lambda evt: item_elt.remove()) 21 item_elt.bind("transitionend", lambda evt: item_elt.remove())
22 bridge.fileSharingDelete( 22 bridge.file_sharing_delete(
23 item['service'], 23 item['service'],
24 item.get('path', ''), 24 item.get('path', ''),
25 item.get('files_namespace', ''), 25 item.get('files_namespace', ''),
26 callback=lambda __: album_delete_cb(item_elt, item), 26 callback=lambda __: album_delete_cb(item_elt, item),
27 errback=lambda failure: album_delete_eb(failure, item_elt, item), 27 errback=lambda failure: album_delete_eb(failure, item_elt, item),
32 # TODO: cleaner error notification 32 # TODO: cleaner error notification
33 window.alert(f"Can't delete album {item['name']}: {failure_['message']}") 33 window.alert(f"Can't delete album {item['name']}: {failure_['message']}")
34 34
35 35
36 def delete_ok(evt, notif_elt, item_elt, item): 36 def delete_ok(evt, notif_elt, item_elt, item):
37 bridge.interestRetract( 37 bridge.interest_retract(
38 "", item['id'], 38 "", item['id'],
39 callback=lambda: interest_retract_cb(item_elt, item), 39 callback=lambda: interest_retract_cb(item_elt, item),
40 errback=lambda failure:interest_retract_eb(failure, item_elt, item)) 40 errback=lambda failure:interest_retract_eb(failure, item_elt, item))
41 41
42 42