Skip to content

Commit

Permalink
IMPROVEMENT: improve the title text on the directory selection windows
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Apr 22, 2024
1 parent 943884e commit a27373a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions MethodicConfigurator/frontend_tkinter_directory_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, parent, parent_frame, initialdir: str, label_text: str, # py
autoresize_width: bool, dir_tooltip: str, button_tooltip: str):
self.parent = parent
self.directory = deepcopy(initialdir)
self.label_text = label_text
self.autoresize_width = autoresize_width

# Create a new frame for the directory selection label and button
Expand All @@ -62,11 +63,9 @@ def __init__(self, parent, parent_frame, initialdir: str, label_text: str, # py

# Create a read-only entry for the directory
dir_var = tk.StringVar(value=self.directory)
self.directory_entry = tk.Entry(directory_selection_subframe, textvariable=dir_var, state='readonly')
if autoresize_width:
self.directory_entry = tk.Entry(directory_selection_subframe, textvariable=dir_var,
width=max(4, len(self.directory)), state='readonly')
else:
self.directory_entry = tk.Entry(directory_selection_subframe, textvariable=dir_var, state='readonly')
self.directory_entry.config(width=max(4, len(self.directory)))
self.directory_entry.pack(side=tk.LEFT, fill="x", expand=True, anchor=tk.NW, pady=(4, 0))
show_tooltip(self.directory_entry, dir_tooltip)

Expand All @@ -78,7 +77,7 @@ def __init__(self, parent, parent_frame, initialdir: str, label_text: str, # py

def on_select_directory(self):
# Open the directory selection dialog
selected_directory = filedialog.askdirectory(initialdir=self.directory)
selected_directory = filedialog.askdirectory(initialdir=self.directory, title=f"Select {self.label_text}")
if selected_directory:
if self.autoresize_width:
# Set the width of the directory_entry to match the width of the selected_directory text
Expand Down

0 comments on commit a27373a

Please sign in to comment.