Files
espresso_frame/server/app/widgets/tasks.py
T
tfaour 2868087467
Build and push server image / test (push) Successful in 42s
Build and push server image / build-and-push (push) Successful in 3m33s
Build and push server image / deploy (push) Failing after 1m24s
Add a per-widget text-size picker for calendar/tasks legibility
Calendar and tasks pack the most body text at the smallest default
sizes, so those two gear-icon dialogs get a "Text size" card (Normal/
Large/X-Large) alongside the existing Border card -- a new Widget-level
font_scale column with its own POST .../font-scale endpoint, same
Widget-property-not-config-field shape as border_style. Threaded through
every classic (calendar_render.py) and modern (html_render.py/
calendar_html_render.py) size calc via one shared panel_style.
scaled_size() so row heights/max_rows already derived from font size
re-fit around the bigger text automatically.
2026-08-02 03:23:27 +00:00

52 lines
2.4 KiB
Python

"""Tasks widget: a simple outstanding-task checklist merged from one or
more of its linked users' CalDAV task lists, in its own region -- split
out of the calendar widget's old week-view-only, single-list task list
(see models.TaskWidgetConfig) so a task list can be placed and sized on
its own, independent of any calendar's view/footprint, and can merge
more than one person's list the same way a calendar widget merges more
than one person's calendar (see models.FrameTaskList).
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. No placeholder for "nothing included yet"
either -- same posture as app/widgets/calendar.py, which this otherwise
mirrors closely: render() always draws through get_or_refresh_tasks_
for_widget's result even when it's [], showing "Nothing outstanding"
rather than a distinct not-configured state (the dialog's preview
endpoint is what actually 400s for that case, same asymmetry calendar
already has)."""
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
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."""
tasks = get_or_refresh_tasks_for_widget(db, frame, widget)
cfg = db.get(TaskWidgetConfig, widget.id)
title = cfg.name or "Tasks"
if cfg.render_style == "modern":
# Local import: html_render pulls in Playwright, a real headless-
# Chromium dependency -- every other widget type, and this one's
# own classic path, should never pay for it.
from .. import html_render
return html_render.build_tasks(tasks, target_w, target_h, frame.palette_rgb, title, frame.theme,
widget.font_scale)
return _build_tasks(tasks, target_w, target_h, frame.palette_rgb, title, font_scale=widget.font_scale)
ACTIONS: dict = {}