예제 #1
0
    def fire(self, name, *args, **kwargs):
        '''
        Fire an arbitrary event

        Event names, by convention, should be lower-case-and-hypen-seperated.
        When events are hooked, the command that emitted the event will
        have its name prepended in this way. 

        For example, before the InitCommand executes it will fire an event 
        that can be handled by the name 'init-pre-exec' for an event fired 
        with the name 'pre-exec'.
        '''
        event.fire(self.command + '-' + name, *args, **kwargs)
예제 #2
0
    def fire(self, name, *args, **kwargs):
        '''
        Fire an arbitrary event

        Event names, by convention, should be lower-case-and-hypen-seperated.
        When events are hooked, the command that emitted the event will
        have its name prepended in this way. 

        For example, before the InitCommand executes it will fire an event 
        that can be handled by the name 'init-pre-exec' for an event fired 
        with the name 'pre-exec'.
        '''
        event.fire(self.command + '-' + name, *args, **kwargs)
예제 #3
0
파일: hook.py 프로젝트: dustinlacewell/pin
 def fire(self, eventname, *args, **kwargs):
     event.fire(self.name + '-' + eventname, *args, **kwargs)
예제 #4
0
def test_event_fire():
    global CALLED
    CALLED = False
    event.fire('test-cb')
    assert CALLED == True
예제 #5
0
def test_event_fire():
    global CALLED
    CALLED = False
    event.fire('test-cb')
    assert CALLED == True
예제 #6
0
파일: hook.py 프로젝트: dustinlacewell/pin
 def fire(self, eventname, *args, **kwargs):
     event.fire(self.name + '-' + eventname, *args, **kwargs)