Round dashboards: shape and ring, the ring drawn and turned in every look, Knob preset and face guide in the editor

This commit is contained in:
Melvin Strobl
2026-10-14 14:23:55 +02:00
parent 9bed078c41
commit be3446cb16
21 changed files with 1447 additions and 57 deletions
+21
View File
@@ -445,6 +445,27 @@ 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],
)
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_setting_refuses_a_message_it_cannot_carry():
"""The same rule a widget binding is held to, from the document alone."""
DashboardDef(