From 5ff504e549979a1da9b56bff699db65cc6ed33ff Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Thu, 9 Jul 2026 14:43:45 -0500 Subject: [PATCH] We dont need this window --- gui/wolf_workflow_tab.py | 22 +++++++++++-------- tests/test_wolf_inject_batch.py | 23 +++++++++++++++++--- util/wolfdawn/inject.py | 38 +++++++++++++++++++++------------ 3 files changed, 57 insertions(+), 26 deletions(-) diff --git a/gui/wolf_workflow_tab.py b/gui/wolf_workflow_tab.py index 952f8e1..eb5f7b6 100644 --- a/gui/wolf_workflow_tab.py +++ b/gui/wolf_workflow_tab.py @@ -3624,21 +3624,25 @@ class WolfWorkflowTab(QWidget): report.sync_failures.append((json_name, err or "unknown error")) log(f" ✗ sync {json_name}: {err}") - title, body = wolf_inject.format_report_dialog(report) - inject_state["dialog"] = (title, body) + dialog = wolf_inject.format_report_dialog(report) + status = wolf_inject.format_report_status(report) + inject_state["dialog"] = dialog inject_state["report"] = report inject_state["selected"] = set(selected) - return report.ok, title + log(status) + return report.ok, status def _after_inject(ok: bool, msg: str): - title, body = inject_state.get("dialog", ("Inject", msg)) + dialog = inject_state.get("dialog") report = inject_state.get("report") - if report and (report.failed or report.sync_failures): + if dialog: + title, body = dialog QMessageBox.warning(self, title, body) - elif report and report.succeeded: - QMessageBox.information(self, title, body) - elif body: - QMessageBox.information(self, title, body) + elif report is not None and not report.succeeded and not ( + report.failed or report.sync_failures + ): + QMessageBox.information(self, "Inject", msg or "Nothing was injected.") + # Full success: no popup (per-file detail is already in the log). inject_state: dict = {} self._run_task(task, on_done=_after_inject) diff --git a/tests/test_wolf_inject_batch.py b/tests/test_wolf_inject_batch.py index 6c63d42..0baaa4b 100644 --- a/tests/test_wolf_inject_batch.py +++ b/tests/test_wolf_inject_batch.py @@ -244,7 +244,17 @@ class InjectOrderTests(unittest.TestCase): class ReportDialogTests(unittest.TestCase): - def test_failure_dialog_lists_every_problem(self): + def test_success_has_no_dialog(self): + report = wi.InjectReport( + files=[ + wi.FileInjectResult("a.json", True, "applied 3 line(s)"), + wi.FileInjectResult("b.json", True, "no changes needed"), + ], + ) + self.assertIsNone(wi.format_report_dialog(report)) + self.assertEqual(wi.format_report_status(report), "Inject complete: 2 file(s).") + + def test_failure_dialog_lists_only_problems(self): report = wi.InjectReport( files=[ wi.FileInjectResult("a.json", True, "applied 3 line(s)"), @@ -252,11 +262,18 @@ class ReportDialogTests(unittest.TestCase): ], sync_failures=[("c.json", "permission denied")], ) - title, body = wi.format_report_dialog(report) + dialog = wi.format_report_dialog(report) + self.assertIsNotNone(dialog) + title, body = dialog self.assertIn("errors", title) self.assertIn("✗ b.json", body) self.assertIn("✗ sync c.json", body) - self.assertIn("✓ a.json", body) + self.assertNotIn("✓ a.json", body) + self.assertIn("1 file(s) succeeded", body) + self.assertEqual( + wi.format_report_status(report), + "Inject: 1 ok, 2 failed (see dialog).", + ) if __name__ == "__main__": diff --git a/util/wolfdawn/inject.py b/util/wolfdawn/inject.py index 5e55d84..05cf280 100644 --- a/util/wolfdawn/inject.py +++ b/util/wolfdawn/inject.py @@ -516,23 +516,33 @@ def inject_selected( return report -def format_report_dialog(report: InjectReport) -> tuple[str, str]: - """Return (title, body) for a completion dialog.""" - if report.ok and report.succeeded: - title = "Inject complete" - lines = [f"✓ {r.json_name}: {r.summary}" for r in report.succeeded] - elif report.failed or report.sync_failures: - title = "Inject finished with errors" - lines = [] - for r in report.succeeded: - lines.append(f"✓ {r.json_name}: {r.summary}") +def format_report_dialog(report: InjectReport) -> tuple[str, str] | None: + """Return ``(title, body)`` for a failure dialog, or ``None`` on full success. + + Success details already go to the workflow log; a per-file success popup + overflows the screen on large games. + """ + if report.failed or report.sync_failures: + lines: list[str] = [] + ok_n = len(report.succeeded) + if ok_n: + lines.append(f"{ok_n} file(s) succeeded; failures:") for r in report.failed: lines.append(f"✗ {r.json_name}: {r.summary}") if r.detail: lines.append(f" {r.detail}") for name, err in report.sync_failures: lines.append(f"✗ sync {name}: {err}") - else: - title = "Inject" - lines = ["Nothing was injected."] - return title, "\n".join(lines) + return "Inject finished with errors", "\n".join(lines) + return None + + +def format_report_status(report: InjectReport) -> str: + """One-line status for the log / status bar after inject.""" + ok_n = len(report.succeeded) + fail_n = len(report.failed) + len(report.sync_failures) + if fail_n: + return f"Inject: {ok_n} ok, {fail_n} failed (see dialog)." + if ok_n: + return f"Inject complete: {ok_n} file(s)." + return "Inject: nothing was injected."