models: Displayed data

class Model(name, session)

Bases: State, Drawing

A Model is a Drawing together with an id number that allows it to be referenced in a typed command.

Model subclasses can be saved session files.

Parameters:
name : str

The name of the model.

Attributes:
id : None or tuple of int

Model/submodel identification: e.g., 1.3.2 is (1, 3, 2). Set and unset by Models instance.

SESSION_ENDURING : bool, class-level optional

If True, then model survives across sessions.

SESSION_SAVE : bool, class-level optional

If True, then model is saved in sessions.

add(models)

Experimental API . Add child models to this model.

all_models()

Experimental API . Return all models including self and children at all levels.

child_models()

Experimental API . Return child models.

delete()

Experimental API . Delete this model.

deleted

Experimental API . Return whether this model has already been deleted.

Returns:
Returns boolean value. True if model has been deleted; False otherwise.
id_string()

Experimental API . Return the dot-separated identifier for this model. A top-level model (one that is not a child of another model) will have no dots in its identifier. A child model identifier consists of its parent model identifier, followed by a dot (period), followed by its (undotted) identifier within the parent model.

Returns:
A string. If the model has not been assigned an identifier, an empty string is returned.
classmethod restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

single_color

Experimental API . Getting the single color may give the dominant color. Setting the single color will set the model to that color. Color values are rgba uint8 arrays.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

class Models(session)

Bases: StateManager

assign_id(model, id)

Experimental API . Parent model for new id must already exist.

reset_state(session)

Experimental API . Reset state to data-less state

static restore_snapshot(session, data)

Experimental API . Create object using snapshot data.

take_snapshot(session, flags)

Experimental API . Return snapshot of current state of instance.

The semantics of the data is unknown to the caller. Returns None if should be skipped. The default implementation is for non-core classes and returns a copy of the instance dictionary (a deep copy of lists/dicts/etc., but shallow copy of named objects). Named objects are later converted to unique names.

class Surface(name, session)

Bases: Model

A surface is a type of model where vertex coloring, style (filled, mesh, dot) and masking can be controlled by user commands.

ancestor_models(models)

Experimental API . Return set of ancestors of models that are not in specified models.