Round dashboards: one face at a time, a face per widget type, paged by swipe, dots and keys; slider reading; face row in the editor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8b8cb5cda9
commit
84071ee106
@@ -445,25 +445,28 @@ def test_a_dashboard_is_cut_into_a_sane_number_of_columns():
|
||||
DashboardDef(name="house", columns=columns)
|
||||
|
||||
|
||||
def test_a_round_dashboard_is_square_and_rings_one_of_its_own_widgets():
|
||||
dial = WidgetDef(id="dial", type="slider", layout={"lg": Placement(x=1)})
|
||||
stat = WidgetDef(id="stat", type="stat")
|
||||
|
||||
knob = DashboardDef(
|
||||
name="knob",
|
||||
shape="round",
|
||||
canvas_width=360,
|
||||
canvas_height=200,
|
||||
ring="dial",
|
||||
widgets=[dial, stat],
|
||||
)
|
||||
def test_a_round_dashboard_is_square():
|
||||
knob = DashboardDef(name="knob", shape="round", canvas_width=360, canvas_height=200)
|
||||
|
||||
assert knob.canvas_height == 360
|
||||
# Drawn along the edge, so the outline of the grid leaves it out.
|
||||
assert [shape.type for shape in knob.footprint] == ["stat"]
|
||||
for shape, ring in (("rect", "dial"), ("round", "gone"), ("round", "stat")):
|
||||
with pytest.raises(ValueError):
|
||||
DashboardDef(name="knob", shape=shape, ring=ring, widgets=[dial, stat])
|
||||
|
||||
|
||||
def test_a_slider_reads_what_it_shows_beside_its_value():
|
||||
"""The room's temperature beside its setpoint: read, and held to numbers."""
|
||||
setpoint = {"target": "house.setpoint", "dtype": "float"}
|
||||
slider = WidgetDef(
|
||||
id="target",
|
||||
type="slider",
|
||||
config={**setpoint, "reading": {"message": "house.indoor", "dtype": "float"}},
|
||||
)
|
||||
|
||||
assert slider.messages == ["house.indoor"]
|
||||
with pytest.raises(ValueError):
|
||||
WidgetDef(
|
||||
id="target",
|
||||
type="slider",
|
||||
config={**setpoint, "reading": {"message": "house.mode", "dtype": "str"}},
|
||||
)
|
||||
|
||||
|
||||
def test_a_setting_refuses_a_message_it_cannot_carry():
|
||||
|
||||
Reference in New Issue
Block a user