Skip to content

Commit fbe14b4

Browse files
committed
✨ add maximum depth of search in reports folder to GUI
1 parent e9897c7 commit fbe14b4

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

gui/app.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@
110110

111111

112112
def create_run_vuegen(
113-
is_dir, config_path, report_type, run_streamlit, output_dir_entry, python_dir_entry
113+
is_dir,
114+
config_path,
115+
report_type,
116+
run_streamlit,
117+
output_dir_entry,
118+
python_dir_entry,
119+
max_depth: int,
114120
):
115121
def inner():
116122
kwargs = {}
@@ -125,6 +131,8 @@ def inner():
125131
print(f"{run_streamlit.get() = }")
126132
kwargs["streamlit_autorun"] = run_streamlit.get()
127133
kwargs["output_dir"] = output_dir_entry.get()
134+
if max_depth.get():
135+
kwargs["max_depth"] = int(max_depth.get())
128136
print("kwargs:")
129137
pprint(kwargs)
130138

@@ -146,6 +154,16 @@ def inner():
146154
messagebox.showwarning(
147155
"warning", "Running locally. Ignoring set Python Path"
148156
)
157+
if kwargs["max_depth"] < 2:
158+
messagebox.showwarning(
159+
"warning", "Maximum depth must be at least 2. Setting to 2."
160+
)
161+
kwargs["max_depth"] = 2
162+
elif kwargs["max_depth"] > 9:
163+
messagebox.showwarning(
164+
"warning", "Maximum depth must be at most 9. Setting to 9."
165+
)
166+
kwargs["max_depth"] = 9
149167
try:
150168
os.chdir(kwargs["output_dir"]) # Change the working directory
151169
# Define logger suffix based on report type and name
@@ -316,6 +334,40 @@ def select_directory():
316334
# output directory selection
317335
ctk_label_outdir = customtkinter.CTkLabel(app, text="Select output directory:")
318336
ctk_label_outdir.grid(row=row_count, column=0, columnspan=1, padx=10, pady=5)
337+
CTK_ENTRY_MAX_DEPTH_DEFAULT = 2
338+
# Maximum Depth input
339+
ctk_label_max_depth = customtkinter.CTkLabel(
340+
app,
341+
text=f"Maximum Depth: (default {CTK_ENTRY_MAX_DEPTH_DEFAULT})",
342+
)
343+
ctk_label_max_depth.grid(
344+
row=row_count, column=1, columnspan=1, padx=10, pady=5, sticky="e"
345+
)
346+
347+
348+
max_depth = tk.IntVar(value=CTK_ENTRY_MAX_DEPTH_DEFAULT)
349+
350+
351+
def slider_event(value):
352+
max_depth.set(value)
353+
ctk_label_max_depth.configure(text=f"Maximum Depth: {int(value)}")
354+
355+
356+
ctk_entry_max_depth = customtkinter.CTkSlider(
357+
app,
358+
from_=2,
359+
to=9,
360+
variable=max_depth,
361+
width=150,
362+
command=slider_event,
363+
number_of_steps=7,
364+
)
365+
ctk_entry_max_depth.set(
366+
CTK_ENTRY_MAX_DEPTH_DEFAULT
367+
) # Set the initial value of the slider
368+
ctk_entry_max_depth.grid(
369+
row=row_count, column=2, columnspan=1, padx=10, pady=5, sticky="w"
370+
)
319371
row_count += 1
320372
##########################################################################################
321373
output_dir_entry = tk.StringVar(value=str(output_dir))
@@ -380,6 +432,7 @@ def select_directory():
380432
run_streamlit=run_streamlit,
381433
output_dir_entry=output_dir_entry,
382434
python_dir_entry=python_dir_entry,
435+
max_depth=max_depth,
383436
)
384437
run_button = customtkinter.CTkButton(
385438
app,

0 commit comments

Comments
 (0)