refactor: read offline from the screen state

The rows asked state.offline while the plan, the estimate and the
result read the environment, kept in step only by the session loop.
tui_offline_only(state) is the one question; the variable only carries
the choice to the runs and the wording.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 00:58:06 +01:00
1 parent af34c81d71
commit 9f3fc2e0c1
10 files changed
+63 -47

No files matched your search

+8
View File
@@ -7,6 +7,7 @@ from pathlib import Path
from typing import TYPE_CHECKING, NamedTuple
from installer.invocation import offline_requested
from installer.offline import LOCAL
if TYPE_CHECKING:
from installer.handheld_app import CardApp
@@ -374,3 +375,10 @@ class TuiState:
@property
def screen(self) -> str:
return self.stack[-1]
def tui_offline_only(state: TuiState) -> bool:
"""Without the internet and without a pack: what is not here cannot
come. The screens ask state.offline, never the environment, which only
carries the choice to the runs."""
return state.offline and LOCAL.pack is None