Add toggleable maintenance state and status panel

This commit is contained in:
Codex Agent
2025-11-22 18:37:11 +01:00
parent ecc193f61b
commit 290b7a8565
3 changed files with 73 additions and 13 deletions

View File

@@ -304,13 +304,14 @@ class ReactorDashboard:
y,
"Turbine / Grid",
[
("Turbines", " ".join(self._turbine_status_lines())),
("Electrical", f"{state.total_electrical_output():7.1f} MW"),
("Load", f"{self._total_load_supplied(state):7.1f}/{self._total_load_demand(state):7.1f} MW"),
("Consumer", f"{consumer_status}"),
("Demand", f"{consumer_demand:7.1f} MW"),
],
("Turbines", " ".join(self._turbine_status_lines())),
("Electrical", f"{state.total_electrical_output():7.1f} MW"),
("Load", f"{self._total_load_supplied(state):7.1f}/{self._total_load_demand(state):7.1f} MW"),
("Consumer", f"{consumer_status}"),
("Demand", f"{consumer_demand:7.1f} MW"),
],
)
y = self._draw_section(win, y, "Maintenance", self._maintenance_lines())
self._draw_health_bar(win, y + 1)
def _draw_help_panel(self, win: "curses._CursesWindow") -> None:
@@ -415,6 +416,11 @@ class ReactorDashboard:
lines.append(("Alphas", f"{particles.get('alpha', 0.0):9.2e}"))
return lines
def _maintenance_lines(self) -> list[tuple[str, str]]:
if not self.reactor.maintenance_active:
return [("Active", "None")]
return [(comp, "IN PROGRESS") for comp in sorted(self.reactor.maintenance_active)]
def _draw_health_bar(self, win: "curses._CursesWindow", start_y: int) -> None:
height, width = win.getmaxyx()
if start_y >= height - 2: