| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package object :: Module ActionListener :: Class 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)
| |
A.connect_signal (...) -> EventCallback | |
A.notify (...) -> None | |
| Inherited from BaseObject | |
B.destroy () -> None | |
B.disconnect_signal (...) -> None | |
B.emit (...) -> bool | |
B.run_signal_handlers (...) -> None | |
B.set_event_manager (...) -> None | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
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(). |
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(). |
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 | http://epydoc.sf.net |