base.BaseRegistry

moderngl_window.resources.base.BaseRegistry[source]

Base class for all resource pools

Methods

BaseRegistry.__init__()[source]

Initialize internal attributes

BaseRegistry.load(meta: moderngl_window.meta.base.ResourceDescription) → Any[source]

Loads a resource using the configured finders and loaders.

Parameters

meta (ResourceDescription) – The resource description

BaseRegistry.add(meta: moderngl_window.meta.base.ResourceDescription) → None[source]

Adds a resource description without loading it. The resource is loaded and returned when load_pool() is called.

Parameters

meta (ResourceDescription) – The resource description

BaseRegistry.load_pool() → Generator[Tuple[moderngl_window.meta.base.ResourceDescription, Any], None, None][source]

Loads all the data files using the configured finders.

This is only relevant when resource have been added to this pool using add().

Returns

Generator of (meta, resource) tuples

BaseRegistry.resolve_loader(meta: moderngl_window.meta.base.ResourceDescription) → None[source]

Attempts to assign a loader class to a ResourceDescription.

Parameters

meta (ResourceDescription) – The resource description instance

Attributes

BaseRegistry.settings_attr = None

The name of the attribute in Settings containting a list of loader classes.

Type

str

BaseRegistry.count

The number of resource descriptions added. This is only relevant when using add and load_pool.

Type

int

BaseRegistry.loaders

Loader classes for this resource type

Type

Generator