plainbox.impl.signal – signal system

class plainbox.impl.signal.Signal(signal_name)[source]

Basic signal that supports arbitrary listeners.

While this class can be used directly it is best used with the helper decorator Signal.define on a member function. The function body is ignored, apart from the documentation.

The function name then becomes a unique (per encapsulating class instance) object (an instance of this Signal class) that is created on demand.

In practice you just have a documentation and use object.signal_name.connect() and object.signal_name(*args, **kwargs) to fire it.

connect(listener)[source]

Connect a new listener to this signal

That listener will be called whenever fire() is invoked on the signal

classmethod define(first_responder)[source]

Helper decorator to define a signal descriptor in a class

The decorated function is never called but is used to get documentation.

disconnect(listener)[source]

Disconnect an existing listener from this signal

fire(args, kwargs)[source]

Fire this signal with the specified arguments and keyword arguments.

Typically this is used by using __call__() on this object which is more natural as it does all the argument packing/unpacking transparently.

Previous topic

plainbox.impl.session.suspend – session suspend support

Next topic

plainbox.impl.symbol – Symbol Type

This Page