fix: silent pipeline log and server indexing progress

Three issues caused the Logs view to appear blank during a real pipeline run:

1. `from run import step_fetch, step_link` was outside the worker's
   try/except/finally. An import failure silently killed the thread,
   leaving _pipeline_done uncalled and the Run button stuck disabled
   forever. Now wrapped in its own try/except that posts the error to
   the log and resets the UI.

2. `build_server_index` makes N sequential HTTP requests (one per mod
   folder's meta.cpp) with no output during the scan. Added an optional
   `progress_fn(current, total, name)` callback; step_fetch wires it to
   print progress every 25 folders so the log never goes silent.

3. No immediate feedback after clicking Start — the log was blank until
   the worker thread started printing. Now posts a "Pipeline started"
   banner from the main thread before the worker launches.
This commit is contained in:
Tran G. (Revernomad) Khoa
2026-04-08 23:35:26 +07:00
parent e0c2dfb32a
commit 3276f4b63f
5 changed files with 38 additions and 5 deletions

View File

@@ -143,11 +143,22 @@ class ArmaModManagerApp(ctk.CTk):
self._pipeline_running = True
self._get_dashboard().set_pipeline_ui(running=True)
self.navigate_to("Logs")
# Post an immediate banner so the log is never blank after clicking Start.
_sep = "=" * 50
self.post_log(f"\n{_sep}\n {t('pipeline.starting')}\n{_sep}\n\n")
def worker() -> None:
# run.py calls fix_console_encoding() at import time, which needs
# the real sys.stdout.buffer. Import it before we redirect stdout.
from run import step_fetch, step_link
try:
from run import step_fetch, step_link
except Exception as _import_err:
self.after(0, lambda: self.post_log(
f"\n✗ Failed to load pipeline: {_import_err}\n"
))
self.after(0, self._pipeline_done)
return
self._redirect_output()
try:
from arma_modlist_tools.parser import parse_modlist_html

View File

@@ -26,6 +26,7 @@ _EN: dict[str, str] = {
"nav.settings": "Settings",
# ── Pipeline step headers (printed to log) ───────────────────────────────
"pipeline.starting": "Pipeline started",
"pipeline.step1_name": "Parse presets",
"pipeline.step2_name": "Compare presets",
"pipeline.step3_name": "Download mods",
@@ -266,6 +267,7 @@ _VI: dict[str, str] = {
"nav.settings": "Cài đặt",
# ── Pipeline step headers ────────────────────────────────────────────────
"pipeline.starting": "Pipeline đã bắt đầu",
"pipeline.step1_name": "Phân tích preset",
"pipeline.step2_name": "So sánh preset",
"pipeline.step3_name": "Tải mod",