50a51,69
> class EventWrapper(Event):
> """Helper class to wrap callable objects in an Event base class"""
>
> def __init__(self, func, **kwargs):
> super(EventWrapper, self).__init__(**kwargs)
>
> if not callable(func):
> raise RuntimeError("Can't wrap '%s', object is not callable" % \
> str(func))
>
> self._func = func
>
> def __call__(self):
> self._func()
>
> def __str__(self):
> return "EventWrapper(%s)" % (str(self._func), )
>
>
62c81,88
< __all__ = [ 'Event', 'ProgressEvent', 'SimExit', 'mainq' ]
---
>
> def create(func, priority=Event.Default_Pri):
> """Create an Event from a function"""
>
> return EventWrapper(func, priority=priority)
>
> __all__ = [ 'Event', 'EventWrapper', 'ProgressEvent', 'SimExit',
> 'mainq', 'create' ]