Package paramz :: Package core :: Module observable :: Class Observable
[hide private]
[frames] | no frames]

Class Observable

source code


Observable pattern for parameterization.

This Object allows for observers to register with self and a (bound!) function as an observer. Every time the observable changes, it sends a notification with self as only argument to all its observers.

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
set_updates(self, on=True) source code
 
add_observer(self, observer, callble, priority=0)
Add an observer `observer` with the callback `callble` and priority `priority` to this observers list.
source code
 
remove_observer(self, observer, callble=None)
Either (if callble is None) remove all callables, which were added alongside observer, or remove callable `callble` which was added alongside the observer `observer`.
source code
 
notify_observers(self, which=None, min_priority=None)
Notifies all observers.
source code
 
change_priority(self, observer, callble, priority) 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, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

notify_observers(self, which=None, min_priority=None)

source code 

Notifies all observers. Which is the element, which kicked off this
notification loop. The first argument will be self, the second `which`.

.. note::
   
   notifies only observers with priority p > min_priority!
   
:param min_priority: only notify observers with priority > min_priority
                     if min_priority is None, notify all observers in order