Sends a 'down' event for the specified scan code
964883
def press(self, key_code):
        
        if key_code >= 128:
            # Media key
            ev = NSEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(
                14, # type
                (0, 0), # location
                0xa00, # flags
                0, # timestamp
                0, # window
                0, # ctx
                8, # subtype
                ((key_code-128) << 16) | (0xa << 8), # data1
                -1 # data2
            )
            Quartz.CGEventPost(0, ev.CGEvent())
        else:
            # Regular key
            # Apply modifiers if necessary
            event_flags = 0
            if self.current_modifiers["shift"]:
                event_flags += Quartz.kCGEventFlagMaskShift
            if self.current_modifiers["caps"]:
                event_flags += Quartz.kCGEventFlagMaskAlphaShift
            if self.current_modifiers["alt"]:
                event_flags += Quartz.kCGEventFlagMaskAlternate
            if self.current_modifiers["ctrl"]:
                event_flags += Quartz.kCGEventFlagMaskControl
            if self.current_modifiers["cmd"]:
                event_flags += Quartz.kCGEventFlagMaskCommand
            
            # Update modifiers if necessary
            if key_code == 0x37: # cmd
                self.current_modifiers["cmd"] = True
            elif key_code == 0x38 or key_code == 0x3C: # shift or right shift
                self.current_modifiers["shift"] = True
            elif key_code == 0x39: # caps lock
                self.current_modifiers["caps"] = True
            elif key_code == 0x3A: # alt
                self.current_modifiers["alt"] = True
            elif key_code == 0x3B: # ctrl
                self.current_modifiers["ctrl"] = True
            event = Quartz.CGEventCreateKeyboardEvent(None, key_code, True)
            Quartz.CGEventSetFlags(event, event_flags)
            Quartz.CGEventPost(Quartz.kCGHIDEventTap, event)
            time.sleep(0.01)
884452
def on_key_down(self, event):
        ''''''
        state = self.state

        # send all key events to the parent
        if self.mouse_pos:
            latlon = self.coordinates(self.mouse_pos.x, self.mouse_pos.y)
            selected = self.selected_objects(self.mouse_pos)
            state.event_queue.put(SlipKeyEvent(latlon, event, selected))

        c = event.GetUniChar()
        if c == ord('+') or (c == ord('=') and event.ShiftDown()):
            self.change_zoom(1.0/1.2)
            event.Skip()
        elif c == ord('-'):
            self.change_zoom(1.2)
            event.Skip()
        elif c == ord('G'):
            self.enter_position()
            event.Skip()
        elif c == ord('C'):
            self.clear_thumbnails()
            event.Skip()
975621
def _onLeftButtonDown(self, evt):
        """"""
        x = evt.GetX()
        y = self.figure.bbox.height - evt.GetY()
        evt.Skip()
        self.CaptureMouse()
        FigureCanvasBase.button_press_event(self, x, y, 1, guiEvent=evt)
697073
function onKeyEventTargetKeyDown(e) {
      var macroModeState = vimGlobalState.macroModeState;
      var lastChange = macroModeState.lastInsertModeChanges;
      var keyName = CodeMirror.keyName(e);
      function onKeyFound() {
        lastChange.changes.push(new InsertModeKey(keyName));
        return true;
      }
      if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {
        CodeMirror.lookupKey(keyName, ['vim-insert'], onKeyFound);
      }
    }
753895
def downto(min)
      if block_given?
        super {|dt| yield dt.clear_timezone_offset }
      else
        enum = super
        enum.each {|dt| dt.clear_timezone_offset }
        enum
      end
    end
207423
def dropEvent(self, event):
        """"""
        super(TrashWidget, self).dropEvent(event)
        self.itemTrashed.emit()
639941
def down(self):
        
        set_interface_down(self.ifIndex, self.auth, self.url, devip=self.ip)
        self.adminstatus = get_interface_details(self.ifIndex, self.auth, self.url, devip=self.ip)[
            'adminStatusDesc']
1287996
public Object down(Event evt) {
        Object retval=super.down(evt);

        switch(evt.getType()) {
            case Event.CONNECT:
            case Event.CONNECT_WITH_STATE_TRANSFER:
            case Event.CONNECT_USE_FLUSH:
            case Event.CONNECT_WITH_STATE_TRANSFER_USE_FLUSH:
                register(cluster_name, local_addr, this);
                break;
            case Event.DISCONNECT:
                unregister(cluster_name, local_addr);
                break;
            case Event.SET_LOCAL_ADDRESS:
                local_addr=evt.getArg();
                break;
            case Event.BECOME_SERVER: // called after client has joined and is fully working group member
                is_server=true;
                break;
            case Event.VIEW_CHANGE:
            case Event.TMP_VIEW:
                curr_view=evt.getArg();
                Address[] mbrs=((View)evt.getArg()).getMembersRaw();
                is_coord=local_addr != null && mbrs != null && mbrs.length > 0 && local_addr.equals(mbrs[0]);
                break;
            case Event.GET_PING_DATA:
                return getDiscoveryResponsesFor(evt.getArg()); // don't pass further down
            case Event.GET_PHYSICAL_ADDRESS:
                if(cluster_name == null)
                    return retval;
                Address mbr=evt.getArg();
                Map<Address,SHARED_LOOPBACK> map=routing_table.get(cluster_name);
                SHARED_LOOPBACK lp=map != null? map.get(mbr) : null;
                return lp != null? lp.getPhysicalAddress() : null;
        }

        return retval;
    }
940584
def if_end_action(self, text, loc, arg):
        """"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("IF_END:",arg)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        self.codegen.newline_label("exit{0}".format(self.label_stack.pop()), True, True)
1372608
def _specialKeyEvent(key, upDown):
    
    assert upDown in ('up', 'down'), "upDown argument must be 'up' or 'down'"

    key_code = special_key_translate_table[key]

    ev = AppKit.NSEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(
            Quartz.NSSystemDefined, # type
            (0,0), # location
            0xa00 if upDown == 'down' else 0xb00, # flags
            0, # timestamp
            0, # window
            0, # ctx
            8, # subtype
            (key_code << 16) | ((0xa if upDown == 'down' else 0xb) << 8), # data1
            -1 # data2
        )

    Quartz.CGEventPost(0, ev.CGEvent())
387109
def scanerror(self, msg):
        """"""
        error('scan error: ' + msg + ' on line {}'.format(self.sline))
        sys.exit(-1)
1346944
def intf_down(self, interface):
        '''
        
        '''
        intf = self._devinfo.get(interface, None)
        if intf and self._devupdown_callback:
            self._devupdown_callback(intf, 'down')
73928
def handle_modifier_down(self, modifier):
        
        _logger.debug("%s pressed", modifier)
        if modifier in (Key.CAPSLOCK, Key.NUMLOCK):
            if self.modifiers[modifier]:
                self.modifiers[modifier] = False
            else:
                self.modifiers[modifier] = True
        else:
            self.modifiers[modifier] = True
988855
function onKeyDown(e, that) {
        //On enter send command
        if (e.keyCode === 13) {
            //Remove all may existing suggestions
            that.$debuggerInput.find('.suggestion').remove();
            var com = that.$debuggerInput.val();

            if (com.length > 0) {
                history.push(com);
                historyCurrent = history.length;
                that.log($('<span>').text('>> ' + com));
                that._nodeDebuggerDomain.exec('eval', com);
                //reset the input field
                that.$debuggerInput.val('');
            }
        }
        //On key up/down scroll through history
        if (e.keyCode === 40) {
            historyCurrent++;
            if (history[historyCurrent]) {
                that.$debuggerInput.val(history[historyCurrent]);
            }
            else {
                historyCurrent = history.length;
                that.$debuggerInput.val('');
            }
            //e.preventDefault();
        }
        if (e.keyCode === 38) {
            historyCurrent--;
            if (history[historyCurrent]) {
                that.$debuggerInput.val(history[historyCurrent]);
            }
            else {
                historyCurrent = 0;
            }
            e.preventDefault();
        }
    }
1203625
def read_key(suppress=False):
    
    event = read_event(suppress)
    return event.name or event.scan_code
941455
def do_down(self, arg):
        """"""
        print "running down migration"
        self.manager.run_one(arg, Direction.DOWN)
95472
def if_else_action(self, text, loc, arg):
        """"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("IF_ELSE:",arg)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        #jump to exit after all statements for true condition are executed
        self.label_number = self.label_stack.pop()
        label = self.codegen.label("exit{0}".format(self.label_number), True, False)
        self.codegen.unconditional_jump(label)
        #generate final 'false' label (executes if condition isn't satisfied)
        self.codegen.newline_label("false{0}".format(self.label_stack.pop()), True, True)
        self.label_stack.append(self.label_number)