def METHOD_NAME(e):
    if gallery_window.selected_images:
        e.page.add_images_as_layers(gallery_window.selected_images)
        gallery_window.selected_images.clear()
        for tab in gallery_window.content.content.tabs:
            for image in tab.content.content.controls:
                image.border = None
                image.update()