"""The module registry — the single place that lists available quads in order. To add a new module: create modules/.py exposing a top-level `SPEC` (ModuleSpec), then import it and append its SPEC here. The first four *enabled* specs fill the 2x2 grid; extra specs are kept for future paginated layouts. """ from __future__ import annotations from modules import bluetooth, location, network, weather from module_base import ModuleSpec ALL_SPECS: list[ModuleSpec] = [ location.SPEC, weather.SPEC, bluetooth.SPEC, network.SPEC, ] def ordered_specs(settings) -> list[ModuleSpec]: """Return specs in the user's saved order, unknown/new ones appended.""" order = settings.order() if not order: return list(ALL_SPECS) by_id = {s.id: s for s in ALL_SPECS} result = [by_id[i] for i in order if i in by_id] result += [s for s in ALL_SPECS if s.id not in order] return result