elukjanovica 2024-06-07 08:44:38 +03:00
parent 6d889686a7
commit 2ed0b17c52
1 changed files with 24 additions and 28 deletions

30
main.py
View File

@ -468,42 +468,40 @@ def handle_album_interaction(album_hover, album):
return None
def delete_albums_mode(album, y, album_rect, current_hovered_index, hover_index):
global checkbox_clicked
albums_to_delete = []
def delete_albums_mode(album, y, album_rect, current_hovered_index, hover_index):
global albums_to_delete
checkbox_rect = pygame.Rect(cons[2], y + cons[3], checkbox[1], checkbox[1])
checkbox_hover = checkbox_rect.collidepoint(pygame.mouse.get_pos())
if checkbox_hover and checkbox_clicked:
for event in event_list:
if checkbox_hover and event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pygame.time.wait(100)
cursor_pos = pygame.mouse.get_pos()
adjusted_pos = (cursor_pos[0] + 20, cursor_pos[1])
album_hover = album_rect.collidepoint(adjusted_pos)
index = update_hover_index(current_hovered_index, album_hover, hover_index)
album = list(storage["albums"].keys())[index]
print("Adjusted Pos:", adjusted_pos, current_hovered_index)
print("salakhsahhgfsdjf", album)
if album_rect.collidepoint(adjusted_pos):
#print(album)
album = list(storage["albums"].keys())[current_hovered_index]
#print("Checkbox Clicked for Album:", album)
if album not in albums_to_delete:
albums_to_delete.append(album)
#print(albums_to_delete, album)
else:
if album in albums_to_delete:
albums_to_delete.remove(album)
#print("Album removed from delete:", album)
checkbox_image = Image((checkbox[0] + checkbox[1] + 3, 0), (cons[2], y + cons[3]), (checkbox[1], checkbox[1]))
print(albums_to_delete)
elif album in albums_to_delete:
albums_to_delete.remove(album)
print(albums_to_delete)
#print(albums_to_delete, adjusted_pos)
return albums_to_delete
checkbox_image = Image((checkbox[0], 0), (cons[2], y + cons[3]), (checkbox[1], checkbox[1]))
if album in albums_to_delete:
checkbox_image = Image((checkbox[0] + checkbox[1] + 3, 0), (cons[2], y + cons[3]), (checkbox[1], checkbox[1]))
checkbox_image.draw(screen)
return albums_to_delete
def delete_albums(albums_to_delete):
@ -1233,9 +1231,7 @@ while run:
elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
if not non_movable_area.collidepoint(pygame.mouse.get_pos()):
can_move = True
if current_mode == "menu" and delete_mode:
checkbox_clicked = True
elif current_mode == "select":
if current_mode == "select":
clicked_image_rect = ImageRender.image_save(selected_album, current_img)
clicked_image = clicked_image_rect.collidepoint(event.pos)
if clicked_image: