Exemplo n.º 1
0
    def set_handler(self, name, handler):
        '''Attach a single event handler.

        :Parameters:
            `name` : str
                Name of the event type to attach to.
            `handler` : callable
                Event handler to attach.

        '''
        # Create event stack if necessary
        if self._event_stack is None:
            self._event_stack = [{}]

        self._event_stack[0][name] = WeakMethod(handler)
Exemplo n.º 2
0
 def __init__(self, loop, callback, timeout, starttime):
     self.loop = loop
     self.callback = WeakMethod(callback)
     self.timeout = timeout
     self._last_dt = starttime
     self._dt = 0.