commit 82

This commit is contained in:
2025-08-09 01:50:41 +02:00
parent 7956d4e393
commit 497978ef95
2 changed files with 7 additions and 19 deletions

View File

@@ -230,6 +230,9 @@ class CustomFileDialog(tk.Toplevel):
self.style_manager = StyleManager(self)
self.widget_manager = WidgetManager(self, self.settings)
# Set a permanent binding for the Enter key in the filename entry to always execute a search
self.widget_manager.filename_entry.bind("<Return>", self.execute_search)
self.update_animation_settings() # Add this line
self._update_view_mode_buttons()
@@ -267,21 +270,13 @@ class CustomFileDialog(tk.Toplevel):
if self.widget_manager.search_animation.running:
# If animating, it means a search is active, so cancel it
if self.search_thread and self.search_thread.is_alive():
if self.search_process:
try:
os.killpg(os.getpgid(self.search_process.pid), 9) # Send SIGKILL to process group
except (ProcessLookupError, AttributeError):
pass # Process might have already finished or not started
# Set a flag to stop the os.walk loop
self.search_thread.cancelled = True
self.widget_manager.search_animation.stop() # Stop animation, show static frame
self.widget_manager.search_status_label.config(text="Suche abgebrochen.")
# Don't hide the search bar, just stop the process
else:
# If not animating, activate search entry
self.widget_manager.filename_entry.focus_set()
self.search_mode = True # Ensure search mode is active
self.widget_manager.search_animation.start(pulse=True)
self.widget_manager.filename_entry.bind("<Return>", self.execute_search)
self.widget_manager.filename_entry.bind("<Escape>", self.hide_search_bar)
# If not animating, execute the search directly
self.execute_search()
def show_search_bar(self, event=None):
if isinstance(event.widget, (ttk.Entry, tk.Entry)) or not event.char.strip():
@@ -290,20 +285,13 @@ class CustomFileDialog(tk.Toplevel):
self.widget_manager.filename_entry.focus_set()
self.widget_manager.filename_entry.delete(0, tk.END)
self.widget_manager.filename_entry.insert(0, event.char)
self.widget_manager.filename_entry.bind("<Return>", self.execute_search)
self.widget_manager.filename_entry.bind("<Escape>", self.hide_search_bar)
self.widget_manager.search_animation.show_full_circle()
def hide_search_bar(self, event=None):
self.search_mode = False
self.widget_manager.filename_entry.delete(0, tk.END)
self.widget_manager.search_status_label.config(text="")
self.widget_manager.filename_entry.unbind("<Return>")
self.widget_manager.filename_entry.unbind("<Escape>")
if self.dialog_mode == "save":
self.widget_manager.filename_entry.bind("<Return>", lambda e: self.on_save())
else:
self.widget_manager.filename_entry.bind("<Return>", self.execute_search)
self.populate_files()
self.widget_manager.search_animation.hide()