Files
2024-07-31 15:14:09 +00:00

103 lines
3.6 KiB
Python

from nicegui import ui
import random
image_to_delete = ['image1']
print(image_to_delete)
def mark_image_as_to_delete(image_to_add_fullname,images_to_delete_list_input):
images_to_delete_list_input.append(image_to_add_fullname)
def add_number() -> None:
numbers.append(random.randint(0, 100))
number_ui.refresh()
numbers = []
@ui.refreshable
def number_ui() -> None:
ui.label(', '.join(str(n) for n in numbers))
def add_number() -> None:
numbers.append(random.randint(0, 100))
number_ui.refresh()
def add_name(name_input) -> None:
numbers.append(name_input)
number_ui.refresh()
@ui.refreshable
def image_to_delete_ui() -> None:
ui.label(', '.join(str(n) for n in image_to_delete)).classes('w-1/2 absolute-top-right')
def add_image_to_delete(image_to_add_fullname) -> None:
image_to_delete.append(image_to_add_fullname)
image_to_delete_ui.refresh()
"""
def clear_list_image_to_delete() -> None:
image_to_delete.clear()
image_to_delete_ui.refresh()
"""
mark_image_as_to_delete('image2',image_to_delete)
print(image_to_delete)
duplicate_list=[{
"source": 'duplicator/20150820_154915.jpg',
"destination": 'duplicator/IMG_1084.JPG'
}]
duplicate_list.append({
"source": 'duplicator/20150621_123524.jpg',
"destination": 'duplicator/20150820_154907.jpg'
})
print(duplicate_list)
for image in duplicate_list:
"""
with ui.splitter() as splitter:
with splitter.before:
#image_to_delete_ui()
#ui.button('Add delete button', on_click=add_image_to_delete(image['source']))
#ui.label(image_to_delete)
ui.label("path: "+image['source']).classes('mr-2')
ui.image(image['source'])
ui.button('mark as removed', on_click=mark_image_as_to_delete(image['source'],image_to_delete))
with splitter.after:
#image_to_delete_ui()
number_ui()
ui.button('Add random number', on_click=add_number)
ui.button('Add delete button', on_click=add_name(image['destination']))
ui.label(image['destination']).classes('ml-2')
ui.image(image['destination'])
ui.button('mark as removed', on_click=mark_image_as_to_delete(image['destination'],image_to_delete))
"""
with ui.splitter().classes('w-full h-96') \
.props('before-class=overflow-hidden after-class=overflow-hidden') as splitter:
with splitter.before:
# ui.skeleton().classes('w-1/2 absolute-top-right')
image_to_delete_ui()
ui.button('Add delete button', on_click=add_image_to_delete(image['source']))
#ui.button('clear button', on_click=clear_list_image_to_delete())
with ui.card().tight():
ui.image(image['source'])
with ui.card_section():
ui.label("path: "+image['source'])
# ui.label("path: "+image['source']).classes('w-1/2 absolute-top-right')
# ui.image(image['source']).classes('w-1/2 absolute-top-left')
with splitter.after:
number_ui()
ui.button('Add random number', on_click=add_number)
with ui.card().tight():
ui.image(image['destination'])
with ui.card_section():
ui.label("path: "+image['destination'])
# ui.label("path: "+image['destination']).classes('w-1/2 absolute-top-left')
# ui.image(image['destination']).classes('w-1/2 absolute-top-right')
ui.run()