Panel Core#

The resolved intermediate format: fully numeric, still named, and a real file format rather than a private data structure.

scenet.core#

Panel Core: the resolved intermediate format.

Every position is absolute and numeric, but identifiers survive – which is what separates this from SVG. A Core document can be read, diffed, hand-adjusted and re-emitted.

Golden-file tests target this tier rather than the SVG, because it changes only when layout genuinely changes. Diffing SVG text is brittle: a reordered attribute or a different path-rounding convention produces a huge diff that means nothing.

class scenet.core.CoreModel[source]#

Bases: BaseModel

Base for every Panel Core type: frozen, and rejecting unknown keys.

Strictness matters more here than in the IR. A Core document is something a user may hand-edit and feed back in, and a silently-ignored key would mean their edit had no effect with nothing to say so. json.loads reads NaN and Infinity, and neither is a coordinate, so a Core holding one is refused rather than drawn.

scenet.core.FaceMark#

One mark on a drawn face, or of the emanata drawn around it – they are made of the same two primitives. Chosen by its mark, exactly as a script entry is by its verb, so a hand-edited disc with a bad radius is not also reported as every reason it is not a stroke. A mark written without the tag is still accepted.

alias of FaceStroke | FaceDisc

class scenet.core.Speaking[source]#

Bases: NamedTuple

Somebody a balloon points at, in a Core: the face, and where its tail aims.

face: Disc#

Alias for field number 0

mouth: tuple[float, float]#

Alias for field number 1

static __new__(_cls, face, mouth)#

Create new instance of Speaking(face, mouth)

scenet.core.point_pair(point)[source]#

Convert a point to the rounded (x, y) pair a Core document stores.

Return type:

tuple[float, float]

scenet.core.round_pairs(points)[source]#

Convert a sequence of points – a hull, typically – to rounded pairs.

Return type:

tuple[tuple[float, float], ...]

scenet.core.vector_pair(vector)[source]#

Convert a vector to the rounded (dx, dy) pair a Core document stores.

Return type:

tuple[float, float]