Fix on save mode bottom entry autosize
This commit is contained in:
Binary file not shown.
@@ -381,12 +381,19 @@ class WidgetManager:
|
||||
bottom_controls_frame = ttk.Frame(
|
||||
content_frame, style="AccentBottom.TFrame")
|
||||
bottom_controls_frame.grid(row=1, column=0, sticky="ew", pady=(5, 0))
|
||||
bottom_controls_frame.grid_columnconfigure(1, weight=1)
|
||||
|
||||
button_box_pos = self.settings.get("button_box_pos", "left")
|
||||
action_buttons_col = 0 if button_box_pos == 'left' else 2
|
||||
action_buttons_sticky = "w" if button_box_pos == 'left' else "e"
|
||||
|
||||
if self.dialog.dialog_mode == "save":
|
||||
# Give most of the weight to the action buttons frame (which contains the entry)
|
||||
bottom_controls_frame.grid_columnconfigure(action_buttons_col, weight=10)
|
||||
bottom_controls_frame.grid_columnconfigure(1, weight=1) # status_bar is in col 1
|
||||
else:
|
||||
# Original behavior for open mode
|
||||
bottom_controls_frame.grid_columnconfigure(1, weight=1)
|
||||
|
||||
action_buttons_frame = ttk.Frame(
|
||||
bottom_controls_frame, style="AccentBottom.TFrame")
|
||||
action_buttons_frame.grid(
|
||||
@@ -406,8 +413,7 @@ class WidgetManager:
|
||||
Tooltip(self.settings_button, "Einstellungen")
|
||||
|
||||
if self.dialog.dialog_mode == "save":
|
||||
action_buttons_frame.grid_columnconfigure(0, weight=1)
|
||||
self.filename_entry = ttk.Entry(action_buttons_frame, width=75)
|
||||
self.filename_entry = ttk.Entry(action_buttons_frame)
|
||||
save_button = ttk.Button(
|
||||
action_buttons_frame, text="Speichern", command=self.dialog.on_save)
|
||||
cancel_button = ttk.Button(
|
||||
@@ -416,6 +422,7 @@ class WidgetManager:
|
||||
ft[0] for ft in self.dialog.filetypes], state="readonly")
|
||||
|
||||
if button_box_pos == 'left':
|
||||
action_buttons_frame.grid_columnconfigure(1, weight=1)
|
||||
self.filename_entry.grid(
|
||||
row=0, column=1, sticky="ew", padx=(10, 0))
|
||||
save_button.grid(row=0, column=0, sticky="e", padx=(10, 5))
|
||||
@@ -424,7 +431,7 @@ class WidgetManager:
|
||||
self.filter_combobox.grid(
|
||||
row=1, column=1, sticky="w", padx=(10, 0), pady=(10, 0))
|
||||
else: # right
|
||||
action_buttons_frame.grid_columnconfigure(1, weight=1)
|
||||
action_buttons_frame.grid_columnconfigure(0, weight=1)
|
||||
save_button.grid(row=0, column=1, sticky="w", padx=(5, 5))
|
||||
self.filename_entry.grid(
|
||||
row=0, column=0, sticky="ew", padx=(0, 10))
|
||||
|
@@ -33,7 +33,7 @@ class GlotzMol(tk.Tk):
|
||||
dialog = CustomFileDialog(self,
|
||||
initial_dir=os.path.expanduser("~"),
|
||||
filetypes=[("All Files", "*.*")
|
||||
])
|
||||
], dialog_mode="save")
|
||||
|
||||
# This is the crucial part: wait for the dialog to be closed
|
||||
self.wait_window(dialog)
|
||||
|
Reference in New Issue
Block a user