orrery.models.ModelRegistry#

class ModelRegistry[source]#

Bases: object

Holds a list of named Models

Methods

add_invalidated_observer

Add observer to listen to invalidated callback of the specified Model

add_model

Add a model to this registry with the specified name

add_observer

Add observer to listen to changed callback of the specified Model

get_model

Return the model in this registry with the specified name

model_names

Return a Model containing a list of current model names

models

Return dictionary of registered model names to models

remove_invalidated_observer

Remove previously added invalidated observer

remove_observer

Remove previously added value changed observer

add_invalidated_observer(name, callback, **kwargs)[source]#

Add observer to listen to invalidated callback of the specified Model

add_model(name, model=None)[source]#

Add a model to this registry with the specified name

Return type:

Model

Parameters:
  • name – Name used to reference the model in the registry

  • model – The Model to add. If a model is not specified, a new ValueModel will be created

Returns:

the Model that was added to the registry

add_observer(name, callback, **kwargs)[source]#

Add observer to listen to changed callback of the specified Model

get_model(name)[source]#

Return the model in this registry with the specified name

Return type:

Model

model_names()[source]#

Return a Model containing a list of current model names

Return type:

Model

models()[source]#

Return dictionary of registered model names to models

Return type:

dict[str, Model]

remove_invalidated_observer(name, callback_id)[source]#

Remove previously added invalidated observer

remove_observer(name, callback_id)[source]#

Remove previously added value changed observer