"""Tasks widget: a simple outstanding-task checklist in its own region -- split out of the calendar widget's old week-view-only task list (see models.TaskWidgetConfig) so a task list can be placed and sized on its own, independent of any calendar's view/footprint. No "enabled" concept and no button actions: the widget's mere presence on the grid is the on/off switch (same as every other widget type), and its cache refreshes on the same throttled schedule as weather -- nothing here to advance/back/force.""" from __future__ import annotations from PIL import Image from sqlalchemy.orm import Session from ..calendar_render import _build_tasks from ..models import Frame, TaskWidgetConfig, Widget from ..routers.common import get_or_refresh_tasks_for_widget from ._shared import placeholder_image ACTION_LABELS: dict[str, str] = {} def render(db: Session, frame: Frame, widget: Widget, target_w: int, target_h: int, is_normal_wake: bool = True) -> Image.Image: """is_normal_wake is unused here -- see app/widgets/photos.py's identical note; every widget type's render() shares one call signature regardless of which ones actually care.""" cfg = db.get(TaskWidgetConfig, widget.id) if not cfg.calendar_key or not cfg.user_id: return placeholder_image(target_w, target_h, ["Tasks widget", "not configured yet"]) tasks = get_or_refresh_tasks_for_widget(db, frame, widget) return _build_tasks(tasks, target_w, target_h) ACTIONS: dict = {}