base.ResourceDescription

moderngl_window.meta.base.ResourceDescription[source]

Description of any resource. Resource descriptions are required to load a resource. This class can be extended to add more specific properties.

Methods

ResourceDescription.__init__(**kwargs)[source]

Initialize a resource description

Parameters

**kwargs – Attributes describing the resource to load

Attributes

ResourceDescription.path

The path to a resource when a single file is specified

Type

str

ResourceDescription.resolved_path

The resolved path by a finder.

The absolute path to the resource can optionally be assigned by a loader class.

Type

pathlib.Path

ResourceDescription.attrs

All keywords arguments passed to the resource

Type

dict

ResourceDescription.label

optional name for the resource

Assigning a label is not mandatory but can help when aliasing resources. Some prefer to preload all needed resources and fetch them later by the label. This can he a lot less chaotic in larger applications.

Type

str

ResourceDescription.kind

default resource kind.

The resource kind is directly matched with the kind in loader classes.

This property also supports assignment and is useful if the kind is detected based in the the attribute values.

description.kind = 'something'
Type

str

ResourceDescription.loader_cls

The loader class for this resource.

This property is assigned to during the loading stage were a loader class is assigned based on the kind.

Type

Type

ResourceDescription.default_kind = None

The default kind for this resource type

Type

str

ResourceDescription.resource_type = None

A unique identifier for the resource type

Type

str