jvconnected.interfaces

Submodules

class jvconnected.interfaces.Registry(*args, **kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

Registry for interface modules

This is a singleton and should not be instanciated directly. Instead, it is accessed by jvconnected.interfaces.registry:

>>> from jvconnected.interfaces import registry, Interface
>>> class MyInterfaceClass(Interface):
>>>     interface_name = 'my_interface'
>>> registry.register(MyInterfaceClass)
>>> for name, cls in registry:
>>>     print(name, cls.__name__)
my_interface MyInterfaceClass

Subclasses of Interface must have a unique name assigned as their interface_name. They can then be added using the register() method.

The Engine then instanciates them and adds them to its interfaces.

Events
interface_added(name: str, cls: Interface)

Fired when an interface is registered

interface_removed(name: str, cls: Interface)

Fired when an interface is unregistered

register(cls)[source]

Register an interface

Parameters

cls – Subclass of Interface to register

unregister(name: str)[source]

Unregister an interface

Parameters

name (str) – The interface name

jvconnected.interfaces.registry: jvconnected.interfaces.Registry = <jvconnected.interfaces.Registry object>

Single instance of Registry to interact with