Mercurial > libervia-web
changeset 1345:ce1217e3a9c0
browser (photos/album): use notifications to show error messages + use `ok_color` argument for delete confirmation
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Aug 2020 08:28:08 +0200 |
parents | 472267dcd4d8 |
children | cda5537c71d6 |
files | libervia/pages/photos/album/_browser/__init__.py |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/pages/photos/album/_browser/__init__.py Mon Aug 24 23:04:35 2020 +0200 +++ b/libervia/pages/photos/album/_browser/__init__.py Tue Aug 25 08:28:08 2020 +0200 @@ -32,8 +32,10 @@ def on_error(failure, file_, photo_elt): - # TODO: cleaner error notification - window.alert(f"can't upload {file_.name}: failure") + dialog.notification( + f"can't upload {file_.name}: failure", + level="error" + ) def update_progress(photo_elt, new_value): @@ -55,7 +57,10 @@ def on_slot_eb(file_, failure, photo_elt): - breakpoint() + dialog.notification( + f"Can't get upload slot: {failure}", + level="error" + ) def upload_files(files): @@ -120,8 +125,10 @@ def file_delete_eb(failure, item_elt, item): - # TODO: cleaner error notification - window.alert(f"error while deleting {item['name']}: failure") + dialog.notification( + f"error while deleting {item['name']}: failure", + level="error" + ) def delete_ok(evt, notif_elt, item_elt, item): @@ -149,6 +156,7 @@ dialog.Confirm( f"{item['name']!r} will be deleted, are you sure?", ok_label="delete", + ok_color="danger", ).show( ok_cb=lambda evt, notif_elt: delete_ok(evt, notif_elt, item_elt, item), cancel_cb=lambda evt, notif_elt: delete_cancel(evt, notif_elt, item_elt, item),