Package pypat :: Package behavioral :: Module mediator :: Class Mediator
[hide private]
[frames] | no frames]

Class Mediator

source code

object --+
         |
        Mediator


Mediator class as part of the Mediator design pattern.

- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
- External Mediator Pattern documentation: U{https://en.wikipedia.org/wiki/Mediator_pattern}

Instance Methods [hide private]
 
__init__(self)
Initialize a new Mediator instance.
source code
 
signal(self, signal_name, *args, **kwargs)
Send a signal out to all connected handlers.
source code
 
connect(self, signal_name, receiver)
Connect a receiver to a signal.
source code
 
disconnect(self, signal_name, receiver)
Disconnect a receiver from a signal.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialize a new Mediator instance.

Overrides: object.__init__

signal(self, signal_name, *args, **kwargs)

source code 

Send a signal out to all connected handlers.

Parameters:
  • signal_name (Str) - The name of the signal.
  • args - Positional arguments to send with the signal.
  • kwargs - Keyword arguments to send with the signal.

connect(self, signal_name, receiver)

source code 

Connect a receiver to a signal.

Parameters:
  • signal_name (str) - The name of the signal to connect the receiver to.
  • receiver - A handler to call when the signal is sent out.

disconnect(self, signal_name, receiver)

source code 

Disconnect a receiver from a signal.

Parameters:
  • signal_name (str) - The name of the signal to disconnect the receiver from.
  • receiver - The receiver to disconnect from the signal.