Handle a shot event.

        :param obj: A :py:class:`~turberfield.dialogue.model.Model.Shot` object.
        :return: The supplied object.
329842
def handle_shot(self, obj):
        
        print(
            "{t.dim}{shot}{t.normal}".format(
                shot=obj.name.capitalize(), t=self.terminal
            ),
            end="\n" * 3,
            file=self.terminal.stream
        )
        return obj
1316285
def call_orig(self, *args, **kwargs):
        '''
        
        '''
        return self._orig(self._obj, *args, **kwargs)
318305
public function eventHandler($e, $obj)
    {
        if (method_exists($this, $e)) {
            call_user_func(array($this, $e), $e, $obj);
        }
    }
1354438
def delete_object(self, obj):
        
        session = self.get_db_session()
        session.delete(obj)
        session.commit()
5882
def legion_create_handler(obj):
    
    def _handler(sig, frame):
        obj._sig_handler(sig, frame)

    if '_sig_handler' not in dir(obj):                                                          # pragma: no cover
        raise Excecption("Object instance has no _sig_handler method")
    return _handler
558148
def tap(self, interceptor):
        
        interceptor(self.obj)
        return self._wrap(self.obj)
488871
def edit_and_execute(event):
    
    buff = event.current_buffer

    buff.open_in_editor(event.cli)
    buff.accept_action.validate_and_handle(event.cli, buff)
607560
def fire(obj, to_state = nil, *args)
      transitions = @transitions.select { |t| t.from == obj.current_state }
      fail InvalidTransition, error_message_for_invalid_transitions(obj) if transitions.size == 0

      next_state = nil
      transitions.each do |transition|
        next if to_state && !Array(transition.to).include?(to_state)
        next unless transition.executable?(obj, *args)

        next_state = to_state || Array(transition.to).first
        transition.execute(obj, *args)
        update_event_timestamp(obj, next_state) if timestamp_defined?
        break
      end
      # Update timestamps on obj if a timestamp has been defined
      next_state
    end
245364
protected void handleObjectPressed (final SceneObject scobj, int mx, int my)
    {
        String action = scobj.info.action;
        final ObjectActionHandler handler = ObjectActionHandler.lookup(action);

        // if there's no handler, just fire the action immediately
        if (handler == null) {
            fireObjectAction(null, scobj, new SceneObjectActionEvent(
                                 this, 0, action, 0, scobj));
            return;
        }

        // if the action's not allowed, pretend like we handled it
        if (!handler.actionAllowed(action)) {
            return;
        }

        // if there's no menu for this object, fire the action immediately
        RadialMenu menu = handler.handlePressed(scobj);
        if (menu == null) {
            fireObjectAction(handler, scobj, new SceneObjectActionEvent(
                                 this, 0, action, 0, scobj));
            return;
        }

        // make the menu surround the clicked object, but with consistent size
        Rectangle mbounds = getRadialMenuBounds(scobj);

        _activeMenu = menu;
        _activeMenu.addActionListener(new ActionListener() {
            public void actionPerformed (ActionEvent e) {
                if (e instanceof CommandEvent) {
                    fireObjectAction(handler, scobj, e);
                } else {
                    SceneObjectActionEvent event = new SceneObjectActionEvent(
                        e.getSource(), e.getID(), e.getActionCommand(),
                        e.getModifiers(), scobj);
                    fireObjectAction(handler, scobj, event);
                }
            }
        });
        _activeMenu.activate(this, mbounds, scobj);
    }
1368831
async def handler(event):
    """"""
    await asyncio.wait([
        event.delete(),
        event.respond(OFFTOPIC[event.chat_id], reply_to=event.reply_to_msg_id)
    ])
242945
def shot_save_callback(self, *args, **kwargs):
        
        tasksel = self.browser.shotbrws.selected_indexes(2)
        if not tasksel or not tasksel[0].isValid():
            self.statusbar.showMessage('No task selected! Cannot save!')
            return

        taskitem = tasksel[0].internalPointer()
        task = taskitem.internal_data()
        rtype = djadapter.RELEASETYPES['work']
        descriptor = self.shot_descriptor_le.text()
        if not self.check_selection_for_save(task, rtype, descriptor):
            return

        tfi = TaskFileInfo.get_next(task=task, releasetype=rtype,
                                    typ=self._filetype, descriptor=descriptor)
        self._save_tfi(tfi)
967203
def handle_event(self, event):
        
        result_id, ptr, method, args = event[1]
        obj = None
        result = None
        try:
            obj, handler = bridge.get_handler(ptr, method)
            result = handler(*[v for t, v in args])
        except bridge.BridgeReferenceError as e:
            #: Log the event, don't blow up here
            msg = "Error processing event: {} - {}".format(
                  event, e).encode("utf-8")
            print(msg)
            self.show_error(msg)
        except:
            #: Log the event, blow up in user's face
            msg = "Error processing event: {} - {}".format(
                  event, traceback.format_exc()).encode("utf-8")
            print(msg)
            self.show_error(msg)
            raise
        finally:
            if result_id:
                if hasattr(obj, '__nativeclass__'):
                    sig = getattr(type(obj), method).__returns__
                else:
                    sig = type(result).__name__

                self.send_event(
                    bridge.Command.RESULT,  #: method
                    result_id,
                    bridge.msgpack_encoder(sig, result)  #: args
                )
1067832
def handleEvent(self, eventObj):
        
        if not self.visible:
            return
        if not self.isEnabled:
            return False

        if eventObj.type != MOUSEBUTTONDOWN:
            # The animation only cares about a mouse down event
            return False

        eventPointInAnimationRect = self.rect.collidepoint(eventObj.pos)
        if not eventPointInAnimationRect:  # clicked outside of animation
            return False

        if self.state == PygAnimation.PLAYING:  # if playing, ignore the click
            return False

        return True
1064457
def key_press_event(self, obj, event):
        
        key = self.iren.GetKeySym()
        log.debug('Key %s pressed' % key)
        if key == 'q':
            self.q_pressed = True
            # Grab screenshot right before renderer closes
            self.last_image = self.screenshot(True, return_img=True)
        elif key == 'b':
            self.observer = self.iren.AddObserver('LeftButtonPressEvent',
                                                  self.left_button_down)
        elif key == 'v':
            self.isometric_view_interactive()
97098
def subscribe(obj, event, callback, event_state=None):
    
    if inspect.isclass(obj):
        cls = obj.__name__
    else:
        cls = obj.__class__.__name__

    if event_state is None:
        event_state = states.ANY

    event_key = '.'.join([cls, event, event_state])
    if event_key not in EVENT_HANDLERS:
        EVENT_HANDLERS[event_key] = []

    EVENT_HANDLERS[event_key].append(callback)
    return
1016432
def handle_single_request(self, request_object):
        
        if not isinstance(request_object, (MethodCall, Notification)):
            raise TypeError("Invalid type for request_object")

        method_name = request_object.method_name
        params = request_object.params
        req_id = request_object.id

        request_body = self.build_request_body(method_name, params, id=req_id)
        http_request = self.build_http_request_obj(request_body)

        try:
            response = urllib.request.urlopen(http_request)
        except urllib.request.HTTPError as e:
            raise CalledServiceError(e)

        if not req_id:
            return

        response_body = json.loads(response.read().decode())
        return response_body
203721
def from_events(self, instance, ev_args, ctx):
        

        obj = yield from self._process(instance, ev_args, ctx)
        self.__get__(instance, type(instance)).append(obj)
        return obj