Source code for pjkm.tui.screens.welcome
"""Welcome screen: project name and archetype selection."""
from __future__ import annotations
from textual.app import ComposeResult
from textual.containers import Vertical
from textual.screen import Screen
from textual.widgets import Button, Input, Label, RadioButton, RadioSet, Static
from pjkm import __version__
from pjkm.core.models.project import Archetype
[docs]
ARCHETYPE_DESCRIPTIONS = {
Archetype.SINGLE_PACKAGE: "Standalone Python package with src layout",
Archetype.SERVICE: "Service repo with infra, Docker Compose, Makefile",
Archetype.POLY_REPO: "Multi-package repo with submodules and shared infra",
Archetype.SCRIPT_TOOL: "Lightweight CLI tool or script",
}
[docs]
class WelcomeScreen(Screen):
"""First screen: enter project name and select archetype."""
[docs]
def compose(self) -> ComposeResult:
with Vertical(id="wizard-container"):
yield Static(f"pjkm v{__version__}", classes="title")
yield Label("Python Project Builder", classes="subtitle")
yield Label("Project name:")
yield Input(placeholder="my-project", id="project-name")
yield Label("")
yield Label("Archetype:")
with RadioSet(id="archetype-select"):
for arch in Archetype:
yield RadioButton(
f"{arch.value} — {ARCHETYPE_DESCRIPTIONS[arch]}",
value=arch == Archetype.SINGLE_PACKAGE,
name=arch.value,
)
yield Label("")
yield Button("Next →", variant="primary", id="next-btn")