Index Pools

IndexPool objects are meant to manage index values that are fed into the preporder parameter of the bewegung.Video.prepare() decorator method and the zindex parameter of the bewegung.Video.layer() decorator method. A Video object therefore manages two pools: bewegung.Video.zindex and bewegung.Video.preporder.

The IndexPool Class

class bewegung.IndexPool

Used to manage z-index for layers tasks and prepare-order (“preporder”) values (“indices”) for prepare tasks. Indices, represented by integers, are unique within a pool. New pools are empty.

Mutable.

__contains__(index)

Checks whether an index is already present in the pool.

Parameters

index (int) – Value that should be checked

Return type

bool

__len__()

Number of entries in the pool

Return type

int

as_list()

Exports pool as a sorted list

Return type

List[int]

property max: int

Highest index currently present in pool

Return type

int

property min: int

Lowest index currently present in pool

Return type

int

on_bottom()

Returns an index that would be on the bottom of the pool, i.e. min - 1. If the pool is empty, it returns 0. The index is not automatically added (registered) to the pool.

Return type

int

on_top()

Returns an index that would be on top of the pool, i.e. max + 1. If the pool is empty, it returns 0. The index is not automatically added (registered) to the pool.

Return type

int

register(index)

Registers, i.e. adds an index to the pool. Raises an exception if the index is already present in the pool.

Parameters

index (int) – Value that should be added to the pool