prole/installer/ui/ncurses_ui.py
chrisfu 6b89ea23d7 Stabilize deliverable k3d pipeline and refactor installer components
- Finalized stable, repeatable reset logic for the k3d pipeline.

- Refactored installer into modular components: core, milestone, runner, and state.

- Introduced new UI abstractions with support for ncurses and Tkinter.

- Updated initialization scripts and configurations for CloudNativePG, Kerberos, OpenBao, and Monitoring.

- Improved pipeline repair and port-forwarding mechanisms.
2026-02-15 00:03:24 -08:00

38 lines
1.3 KiB
Python

"""Ncurses UI adapter skeleton for the installer runner."""
from __future__ import annotations
from ..runner import InstallerRunner
from ..state import InstallerState
from ..milestone import Milestone
class NcursesUI:
"""Minimal ncurses adapter that listens to runner events."""
def __init__(self, runner: InstallerRunner):
self.runner = runner
self._bind_runner()
def _bind_runner(self) -> None:
self.runner.on('on_enter_milestone', self.on_enter_milestone)
self.runner.on('on_validation_error', self.on_validation_error)
self.runner.on('on_progress', self.on_progress)
self.runner.on('on_complete', self.on_complete)
# Event handlers (override in concrete UI)
def on_enter_milestone(self, milestone: Milestone, state: InstallerState) -> None:
pass
def on_validation_error(self, milestone: Milestone | None, state: InstallerState, errors: list[str]) -> None:
pass
def on_progress(self, milestone: Milestone, state: InstallerState, message: str, percent: float | None) -> None:
pass
def on_complete(self, milestone: Milestone | None, state: InstallerState) -> None:
pass
def start(self, start_id: str | None = None) -> bool:
"""Run the installer without a GUI main loop."""
return self.runner.run(start_id=start_id)