Added engine file and separated test code

This commit is contained in:
Maximilian Giller 2025-09-17 03:33:50 +02:00
parent 02a140ee67
commit da9f8f72ec
2 changed files with 43 additions and 38 deletions

4
src/engine.py Normal file
View file

@ -0,0 +1,4 @@
class Engine:
"""Calculates a sequence."""

View file

@ -153,43 +153,44 @@ class Flickr:
return Flickr.schema().loads(json) return Flickr.schema().loads(json)
f = Flickr( if __name__ == "__main__":
[ # Small test
Space( f = Flickr(
"iosf", [
"Living Room", Space(
[ "iosf",
Fixture( "Living Room",
"98iwd", [
"Cool Light", Fixture(
Capabilities.BRIGHTNESS, "98iwd",
SpaceVector(), "Cool Light",
SpaceVector(), Capabilities.BRIGHTNESS,
SpaceVector(), SpaceVector(),
0.5, SpaceVector(),
) SpaceVector(),
], 0.5,
SpaceVector(), )
) ],
], SpaceVector(),
[ )
Sequence( ],
"094rj", [
"Thunder", Sequence(
[ "094rj",
Track( "Thunder",
"89idf", [
"Ceiling flicker", Track(
["98iwd"], "89idf",
[Keyframe(Decimal.from_float(0), "bri", 1)], "Ceiling flicker",
) ["98iwd"],
], [Keyframe(Decimal.from_float(0), "bri", 1)],
) )
], ],
) )
],
)
f.save("test.json")
a = Flickr.load("test.json")
f.save("test.json") print(f.to_json())
a = Flickr.load("test.json")
print(f.to_json())