feat(cfd): Implementiert Multi-Auswahl in der Icon-Ansicht

This commit is contained in:
2025-08-14 00:39:35 +02:00
parent d548b545e3
commit f565132074

View File

@@ -448,20 +448,45 @@ class ViewManager:
if self.dialog.dialog_mode == 'dir' and not os.path.isdir(path):
return # Do not allow file selection in dir mode
if hasattr(self.dialog, 'selected_item_frame') and self.dialog.selected_item_frame.winfo_exists():
self.dialog.selected_item_frame.state(['!selected'])
for child in self.dialog.selected_item_frame.winfo_children():
if self.dialog.dialog_mode == 'multi':
if item_frame in self.dialog.selected_item_frames:
# Deselect
item_frame.state(['!selected'])
for child in item_frame.winfo_children():
if isinstance(child, ttk.Label):
child.state(['!selected'])
self.dialog.selected_item_frames.remove(item_frame)
if isinstance(self.dialog.result, list):
self.dialog.result.remove(path)
else:
# Select
item_frame.state(['selected'])
for child in item_frame.winfo_children():
if isinstance(child, ttk.Label):
child.state(['selected'])
self.dialog.selected_item_frames.append(item_frame)
if self.dialog.result is None:
self.dialog.result = []
if isinstance(self.dialog.result, list):
self.dialog.result.append(path)
self.dialog.update_status_bar(
f"{len(self.dialog.selected_item_frames)} {LocaleStrings.CFD['items_selected']}")
else: # Single selection mode
if hasattr(self.dialog, 'selected_item_frame') and self.dialog.selected_item_frame.winfo_exists():
self.dialog.selected_item_frame.state(['!selected'])
for child in self.dialog.selected_item_frame.winfo_children():
if isinstance(child, ttk.Label):
child.state(['!selected'])
item_frame.state(['selected'])
for child in item_frame.winfo_children():
if isinstance(child, ttk.Label):
child.state(['!selected'])
item_frame.state(['selected'])
for child in item_frame.winfo_children():
if isinstance(child, ttk.Label):
child.state(['selected'])
self.dialog.selected_item_frame = item_frame
self.dialog.result = path
self.dialog.update_status_bar(path)
child.state(['selected'])
self.dialog.selected_item_frame = item_frame
self.dialog.result = path
self.dialog.update_status_bar(path)
self.dialog.search_manager.show_search_ready()
if not os.path.isdir(path):
if not os.path.isdir(path) and self.dialog.dialog_mode != 'multi':
self.dialog.widget_manager.filename_entry.delete(0, tk.END)
self.dialog.widget_manager.filename_entry.insert(
0, os.path.basename(path))