Package ocempgui :: Package object :: Module ActionListener :: Class ActionListener
[show private | hide private]
[frames | no frames]

Type ActionListener

 object --+        
          |        
INotifyable --+    
              |    
     BaseObject --+
                  |
                 ActionListener


ActionListener () -> ActionListener

Creates a new ActionListener, which can listen to any signal.

The ActionListener can listen to any signal connected to it
through an event. While inheritors of the BaseObject ususally
reassign the internal signal dictionary, the ActionListener will
automatically create the matching signal entry for it.

The callbacks connected to the ActionListener need to match the
following signature:

def function_name (*data):
    ...

Dependant on the data list passed on the connect_signal() call,
the callbacks need to be able to handle that data. The following
examples will show how to do this:

def cb_func (arg1, arg2, arg3):
    ...

ac = ActionListener ()
ac.connect_signal (signal, cb_func, first, second, third)

'first', 'second' and 'third' are passed to the cb_func function
and are available within this function as 'arg1', 'arg2' and
'arg3'.

It is also possible to use a more general argument list within the
callback:

def cb_func (*args):
    ...

Method Summary
  __init__(self)
  connect_signal(self, signal, callback, *data)
A.connect_signal (...) -> EventCallback
  notify(self, event)
A.notify (...) -> None
    Inherited from BaseObject
  destroy(self)
B.destroy () -> None
  disconnect_signal(self, event)
B.disconnect_signal (...) -> None
  emit(self, signal, data)
B.emit (...) -> bool
  run_signal_handlers(self, signal, *data)
B.run_signal_handlers (...) -> None
  set_event_manager(self, manager)
B.set_event_manager (...) -> None
    Inherited from object
  __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)

Property Summary
    Inherited from BaseObject
  manager: The event manager to use by the object.

Method Details

connect_signal(self, signal, callback, *data)

A.connect_signal (...) -> EventCallback

Connects a function or method to a signal.

The function or method is invoked as soon as the signal is emitted on the action listener. If *data is supplied, it will be passed as arguments to the connected function. The returned EventCallback can be used to disconnect the function using disconnect_signal().
Overrides:
ocempgui.object.BaseObject.BaseObject.connect_signal

notify(self, event)

A.notify (...) -> None

Notifies the ActionListener about an event.

It invokes the connected EventCallbacks, which match the specific event.signal, using EventCallback.run().
Overrides:
ocempgui.events.INotifyable.INotifyable.notify

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