refactor: keep result titles, fake menu by context

This commit is contained in:
Abdessamad Derraz committed 2026-11-17 16:31:25 +01:00
1 parent 188f9393a3
commit 6cbf1d9c74
2 files changed
+30 -22

No files matched your search

+28 -20
View File
@@ -29000,27 +29000,35 @@ def _outcome_head(state: TuiState, counts: _OutcomeCounts) -> tuple[str, str]:
counts.left)
errors, total = counts.errors, counts.total
if summary.get("interrupted") or state.code == 130:
return "Stopped", (f"Stopped: {installed} of {total} installed, run again to finish."
if total
else "Stopped. Run again to carry on: what is done stays done.")
if left and installed:
return ("Finished with files missing",
f"{installed} installed, {left} not fetched ({offline_named()}){errors}.")
if left:
return ("Nothing installed",
f"Nothing was installed: {_plural(left, 'file')} not fetched "
title = "Stopped"
head = (f"Stopped: {installed} of {total} installed, run again to finish."
if total else "Stopped. Run again to carry on: what is done stays done.")
elif left and installed:
title = "Finished with files missing"
head = f"{installed} installed, {left} not fetched ({offline_named()}){errors}."
elif left:
title = "Nothing installed"
head = (f"Nothing was installed: {_plural(left, 'file')} not fetched "
f"({offline_named()}){errors}.")
if failed and installed:
return "Finished with errors", f"{installed} installed, {len(failed)} failed."
if failed:
return "Nothing installed", f"Nothing was installed: {_plural(len(failed), 'file')} failed."
if not summary and counts.space:
return "Not enough space", counts.space
if not summary:
return "Stopped", f"The installer stopped with code {state.code}."
if installed:
return "Done", _done_head(state, counts)
return "Done", EVERYTHING_IN_PLACE
elif failed and installed:
title = "Finished with errors"
head = f"{installed} installed, {len(failed)} failed."
elif failed:
title = "Nothing installed"
head = f"Nothing was installed: {_plural(len(failed), 'file')} failed."
elif not summary and counts.space:
title = "Not enough space"
head = counts.space
elif not summary:
title = "Stopped"
head = f"The installer stopped with code {state.code}."
elif installed:
title = "Done"
head = _done_head(state, counts)
else:
title = "Done"
head = EVERYTHING_IN_PLACE
return title, head
def _outcome_counted(state: TuiState, counts: _OutcomeCounts, title: str,
+2 -2
View File
@@ -7378,8 +7378,8 @@ class WhatEachScreenOffers(unittest.TestCase):
the collection for the file whose save directory is unknown."""
menus = []
def menu(_plat, files, *_rest, **_named):
menus.append([entry["dest"] for entry in files])
def menu(context, *_rest, **_named):
menus.append([entry["dest"] for entry in context.files])
return
with SaveDirectoryRepository() as repo: