commit 66

This commit is contained in:
2025-08-07 19:06:06 +02:00
parent e5d10dded6
commit 9c2b72345c
4 changed files with 31 additions and 52 deletions

View File

@@ -372,10 +372,7 @@ class WidgetManager:
self.center_container.grid_rowconfigure(0, weight=1)
self.filename_entry.grid(row=0, column=0, columnspan=2, sticky="ew")
if button_box_pos == 'left':
self._layout_save_buttons_left()
else:
self._layout_save_buttons_right()
self._layout_bottom_buttons(button_box_pos)
else: # Open mode
self.open_button = ttk.Button(self.action_status_frame, text="Öffnen", command=self.dialog.on_open)
self.cancel_button = ttk.Button(self.action_status_frame, text="Abbrechen", command=self.dialog.on_cancel)
@@ -386,60 +383,40 @@ class WidgetManager:
self.center_container.grid_rowconfigure(0, weight=1)
self.filename_entry.grid(row=0, column=0, columnspan=2, sticky="ew")
if button_box_pos == 'left':
self._layout_open_buttons_left()
else:
self._layout_open_buttons_right()
self._layout_bottom_buttons(button_box_pos)
def _layout_save_buttons_left(self):
def _layout_bottom_buttons(self, button_box_pos):
# Configure container weights
self.left_container.grid_rowconfigure(0, weight=1)
self.save_button.grid(in_=self.left_container, row=0, column=0, pady=(0, 5))
self.cancel_button.grid(in_=self.left_container, row=1, column=0)
self.center_container.grid_columnconfigure(0, weight=1)
self.filter_combobox.grid(in_=self.center_container, row=1, column=0, sticky="w", pady=(5, 0))
self.search_status_label.grid(row=0, column=0, sticky="w", pady=(5, 0), padx=(5, 0))
self.right_container.grid_rowconfigure(0, weight=1)
self.settings_button.grid(in_=self.right_container, row=0, column=0, sticky="se")
self.trash_button.grid(in_=self.right_container, row=1, column=0, sticky="se", padx=(5, 0))
# Determine action button and its container
action_button = self.save_button if self.dialog.dialog_mode == "save" else self.open_button
action_container = self.left_container if button_box_pos == 'left' else self.right_container
other_container = self.right_container if button_box_pos == 'left' else self.left_container
def _layout_save_buttons_right(self):
self.right_container.grid_rowconfigure(0, weight=1)
self.left_container.grid_rowconfigure(0, weight=1)
self.save_button.grid(in_=self.right_container, row=0, column=0, pady=(0, 5))
self.cancel_button.grid(in_=self.right_container, row=1, column=0)
self.settings_button.grid(in_=self.right_container, row=0, column=1, sticky="ne", padx=(5, 0))
# Place main action buttons
action_button.grid(in_=action_container, row=0, column=0, pady=(0, 5))
self.cancel_button.grid(in_=action_container, row=1, column=0)
self.left_container.grid_rowconfigure(0, weight=1)
self.trash_button.grid(in_=self.left_container, row=0, column=0, sticky="sw")
# Place settings and trash buttons
if button_box_pos == 'left':
self.settings_button.grid(in_=other_container, row=0, column=0, sticky="ne")
if self.dialog.dialog_mode == "save":
self.trash_button.grid(in_=other_container, row=1, column=0, sticky="se", padx=(5, 0))
else: # right
self.settings_button.grid(in_=action_container, row=0, column=1, sticky="ne", padx=(5, 0))
if self.dialog.dialog_mode == "save":
self.trash_button.grid(in_=other_container, row=0, column=0, sticky="sw")
self.center_container.grid_columnconfigure(1, weight=1)
self.filter_combobox.grid(in_=self.center_container, row=1, column=1, sticky="e", pady=(5, 0))
self.search_status_label.grid(row=0, column=0, sticky="w", pady=(5, 0), padx=(5, 0))
def _layout_open_buttons_left(self):
self.left_container.grid_rowconfigure(0, weight=1)
self.open_button.grid(in_=self.left_container, row=0, column=0, pady=(0, 5))
self.cancel_button.grid(in_=self.left_container, row=1, column=0)
self.center_container.grid_columnconfigure(0, weight=1)
self.filter_combobox.grid(in_=self.center_container, row=1, column=0, sticky="w", pady=(5, 0))
self.search_status_label.grid(row=0, column=0, sticky="w", pady=(5, 0), padx=(5, 0))
self.right_container.grid_rowconfigure(0, weight=1)
self.settings_button.grid(in_=self.right_container, row=0, column=0, sticky="ne")
def _layout_open_buttons_right(self):
self.right_container.grid_rowconfigure(0, weight=1)
self.open_button.grid(in_=self.right_container, row=0, column=0, pady=(0, 5))
self.cancel_button.grid(in_=self.right_container, row=1, column=0)
self.settings_button.grid(in_=self.right_container, row=0, column=1, sticky="ne", padx=(5, 0))
self.left_container.grid_rowconfigure(0, weight=1)
self.center_container.grid_columnconfigure(1, weight=1)
self.filter_combobox.grid(in_=self.center_container, row=1, column=1, sticky="e", pady=(5, 0))
# Layout for the center container (filename, filter, status)
if button_box_pos == 'left':
self.center_container.grid_columnconfigure(0, weight=1)
self.filter_combobox.grid(in_=self.center_container, row=1, column=0, sticky="w", pady=(5, 0))
else: # right
self.center_container.grid_columnconfigure(1, weight=1)
self.filter_combobox.grid(in_=self.center_container, row=1, column=1, sticky="e", pady=(5, 0))
self.search_status_label.grid(row=0, column=0, sticky="w", pady=(5, 0), padx=(5, 0))

View File

@@ -871,6 +871,7 @@ class CustomFileDialog(tk.Toplevel):
v_scrollbar = ttk.Scrollbar(
self.widget_manager.file_list_frame, orient="vertical", command=self.icon_canvas.yview)
self.icon_canvas.pack(side="left", fill="both", expand=True)
self.icon_canvas.focus_set()
v_scrollbar.pack(side="right", fill="y")
container_frame = ttk.Frame(self.icon_canvas, style="Content.TFrame")
self.icon_canvas.create_window(
@@ -1021,6 +1022,7 @@ class CustomFileDialog(tk.Toplevel):
xscrollcommand=h_scrollbar.set)
self.tree.grid(row=0, column=0, sticky='nsew')
self.tree.focus_set()
v_scrollbar.grid(row=0, column=1, sticky='ns')
h_scrollbar.grid(row=1, column=0, sticky='ew')