Skip to content

Commit e62d183

Browse files
GUI: clearer status — Running vs Finished, bold state label
- Status shows Idle | Running | Finished | Stopped; Progress shows step or counts - State label in bold; set Stopped on Stop, Idle on validation error Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 73d447a commit e62d183

1 file changed

Lines changed: 29 additions & 22 deletions

File tree

strigil/gui.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,14 @@ def clear_log() -> None:
274274

275275
# Status bar and buttons (in bottom_frame, packed first so they stay visible when maximized)
276276
status_frame = ttk.Frame(bottom_frame)
277-
scan_status_var = tk.StringVar(value="")
278-
scrape_status_var = tk.StringVar(value="")
277+
state_var = tk.StringVar(value="Idle") # Idle | Running | Finished
278+
progress_var = tk.StringVar(value="")
279279
status_frame.pack(side=tk.LEFT, fill=tk.X, expand=True)
280-
ttk.Label(status_frame, text="Scan:").pack(side=tk.LEFT, padx=(0, 4))
281-
ttk.Label(status_frame, textvariable=scan_status_var).pack(side=tk.LEFT, padx=(0, 16))
282-
ttk.Label(status_frame, text="Scrape:").pack(side=tk.LEFT, padx=(0, 4))
283-
ttk.Label(status_frame, textvariable=scrape_status_var).pack(side=tk.LEFT)
280+
ttk.Label(status_frame, text="Status:").pack(side=tk.LEFT, padx=(0, 4))
281+
state_label = ttk.Label(status_frame, textvariable=state_var, font=("", 10, "bold"))
282+
state_label.pack(side=tk.LEFT, padx=(0, 12))
283+
ttk.Label(status_frame, text="Progress:").pack(side=tk.LEFT, padx=(0, 4))
284+
ttk.Label(status_frame, textvariable=progress_var).pack(side=tk.LEFT)
284285

285286
output_queue: queue.Queue[str | None] = queue.Queue()
286287
current_proc: list[subprocess.Popen | None] = [None]
@@ -298,39 +299,41 @@ def run_scrape(scrape_btn_ref: tk.Widget, stop_btn_ref: tk.Widget) -> None:
298299
return
299300
_save_last_urls(url_text.get("1.0", tk.END))
300301
scrape_btn_ref.config(state=tk.DISABLED)
301-
scan_status_var.set("Scanning resources...")
302-
scrape_status_var.set("—")
302+
state_var.set("Running")
303+
progress_var.set("—")
303304
scrape_counts: list[int] = [0, 0, 0] # pdf, text, images
304305
run_parallel = urls_mode_var.get() == "parallel" and len(urls) > 1
305306

306307
def update_status(line: str) -> None:
307308
if "Running:" in line or "Scrape:" in line or "Iteration" in line:
308-
scan_status_var.set("Scanning resources...")
309+
state_var.set("Running")
310+
progress_var.set("Starting…")
309311
elif "Found:" in line:
310-
scan_status_var.set("Mapping complete")
312+
state_var.set("Running")
313+
progress_var.set("Mapping done — downloading…")
311314
elif "→ Downloading" in line:
312-
scan_status_var.set("Downloading assets...")
315+
state_var.set("Running")
316+
progress_var.set("Downloading…")
313317
elif " [" in line and "/" in line and "] " in line:
314-
# Parse [3/12] style progress (require " " prefix to skip parallel URL prefix e.g. [1/3])
315-
scan_status_var.set("Downloading assets...")
316318
m = re.search(r" \[(\d+)/(\d+)\]", line)
317319
if m:
318-
scrape_status_var.set(f"{m.group(1)}/{m.group(2)} assets")
320+
state_var.set("Running")
321+
progress_var.set(f"{m.group(1)}/{m.group(2)} assets")
319322
elif " Text:" in line:
320323
scrape_counts[1] += 1
321-
scan_status_var.set("Page loaded")
322-
scrape_status_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
324+
state_var.set("Running")
325+
progress_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
323326
elif " Image:" in line:
324327
scrape_counts[2] += 1
325-
scan_status_var.set("Page loaded")
326-
scrape_status_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
328+
state_var.set("Running")
329+
progress_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
327330
elif " PDF:" in line:
328331
scrape_counts[0] += 1
329-
scan_status_var.set("Page loaded")
330-
scrape_status_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
332+
state_var.set("Running")
333+
progress_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
331334
elif "Done." in line:
332-
scan_status_var.set("Complete")
333-
scrape_status_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
335+
state_var.set("Finished")
336+
progress_var.set(f"{scrape_counts[0]} PDFs, {scrape_counts[1]} texts, {scrape_counts[2]} images")
334337

335338
try:
336339
delay = float(delay_var.get())
@@ -357,6 +360,8 @@ def update_status(line: str) -> None:
357360
pass
358361
elif not selected_types:
359362
append_log("Error: Select at least one file type.\n")
363+
state_var.set("Idle")
364+
progress_var.set("—")
360365
scrape_btn_ref.config(state=tk.NORMAL)
361366
return
362367

@@ -575,6 +580,8 @@ def do_stop() -> None:
575580
except Exception:
576581
pass
577582
output_queue.put(None)
583+
state_var.set("Stopped")
584+
progress_var.set("—")
578585

579586
scrape_btn = ttk.Button(btn_frame, text="Scrape")
580587
stop_btn = ttk.Button(btn_frame, text="Stop", command=do_stop, state=tk.DISABLED)

0 commit comments

Comments
 (0)