47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""Presentation state for managed-game installation operations."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class GameSyncPresentation:
|
|
"""User-facing wording for one managed-game synchronization."""
|
|
|
|
operation_label: str
|
|
file_progress_verb: str
|
|
|
|
|
|
def game_sync_presentation(
|
|
*,
|
|
installed: bool,
|
|
repair: bool = False,
|
|
) -> GameSyncPresentation:
|
|
"""Distinguish a fresh download from an update or repair."""
|
|
|
|
if not installed:
|
|
return GameSyncPresentation(
|
|
operation_label=(
|
|
"Installing and verifying official game files…"
|
|
if repair
|
|
else "Installing official game files…"
|
|
),
|
|
file_progress_verb="Downloading",
|
|
)
|
|
if repair:
|
|
return GameSyncPresentation(
|
|
operation_label="Checking every game file against the official depot…",
|
|
file_progress_verb="Repairing",
|
|
)
|
|
return GameSyncPresentation(
|
|
operation_label="Synchronizing official game files…",
|
|
file_progress_verb="Updating",
|
|
)
|
|
|
|
|
|
def game_file_progress_status(current_file: str, verb: str) -> str:
|
|
"""Render the current depot asset with the operation's exact intent."""
|
|
|
|
return f"{verb} {current_file}"
|