Package ocempgui :: Package events :: Module IObserver :: Class IObserver
[show private | hide private]
[frames | no frames]

Type IObserver

object --+
         |
        IObserver


IObserver () -> IObserver

A class matching a observer interface of the observer pattern.

The IObserver class is an interface, that should be implemented by
classes, that should be able to register themselves on concrete
Subject implementations. It declares a single method, update(),
which receives the state change details of the Subject.

A short example for reacting upon state changes of Subject:

class MyObserver (IObserver):
    ...
    def update (self, subject, attribute, oldval, newval):
        # Look for the certain subject.
        if subject == 'UniqueSubjectName':
            # Which state changed?
            if attribute == 'value':
                self.do_some_action (oldval, newval)
        ...

Method Summary
  update(self, subject, prop, oldval, newval)
I.update (...) -> None
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

update(self, subject, prop, oldval, newval)

I.update (...) -> None

Notifies the IObserver about a state change of a certain Subject.

This method has to be implemented by inherited classes. Its signature matches the basic requirements of the Subject class.

Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 http://epydoc.sf.net