Feed a key press to the CommandLineInterface.
498050
def feed_key(self, key_press):
        
        assert isinstance(key_press, KeyPress)
        cli = self._active_cli

        # Feed the key and redraw.
        # (When the CLI is in 'done' state, it should return to the event loop
        # as soon as possible. Ignore all key presses beyond this point.)
        if not cli.is_done:
            cli.input_processor.feed(key_press)
            cli.input_processor.process_keys()
230804
def applyCommand(self):
        
        # generate the command information
        cursor      = self.textCursor()
        cursor.movePosition(cursor.EndOfLine)
        
        line        = projex.text.nativestring(cursor.block().text())
        at_end      = cursor.atEnd()
        modifiers   = QApplication.instance().keyboardModifiers()
        mod_mode    = at_end or modifiers == Qt.ShiftModifier
        
        # test the line for information
        if mod_mode and line.endswith(':'):
            cursor.movePosition(cursor.EndOfLine)
            
            line = re.sub('^>>> ', '', line)
            line = re.sub('^\.\.\. ', '', line)
            count = len(line) - len(line.lstrip()) + 4
            
            self.insertPlainText('\n... ' + count * ' ')
            return False
        
        elif mod_mode and line.startswith('...') and \
            (line.strip() != '...' or not at_end):
            cursor.movePosition(cursor.EndOfLine)
            line = re.sub('^\.\.\. ', '', line)
            count = len(line) - len(line.lstrip())
            self.insertPlainText('\n... ' + count * ' ')
            return False
        
        # if we're not at the end of the console, then add it to the end
        elif line.startswith('>>>') or line.startswith('...'):
            # move to the top of the command structure
            line = projex.text.nativestring(cursor.block().text())
            while line.startswith('...'):
                cursor.movePosition(cursor.PreviousBlock)
                line = projex.text.nativestring(cursor.block().text())
            
            # calculate the command
            cursor.movePosition(cursor.EndOfLine)
            line = projex.text.nativestring(cursor.block().text())
            ended = False
            lines = []
            
            while True:
                # add the new block
                lines.append(line)
                
                if cursor.atEnd():
                    ended = True
                    break
                
                # move to the next line
                cursor.movePosition(cursor.NextBlock)
                cursor.movePosition(cursor.EndOfLine)
                
                line = projex.text.nativestring(cursor.block().text())
                
                # check for a new command or the end of the command
                if not line.startswith('...'):
                    break
            
            command = '\n'.join(lines)
            
            # if we did not end up at the end of the command block, then
            # copy it for modification
            if not (ended and command):
                self.waitForInput()
                self.insertPlainText(command.replace('>>> ', ''))
                cursor.movePosition(cursor.End)
                return False
        
        else:
            self.waitForInput()
            return False
        
        self.executeCommand(command)
        return True
674409
public void sendKey(int key)
	{
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "sendKey("+key+")");
		}
		
		sender.sendKeyCode(key);
	}
1095274
def _run_cmd(cmd):
    """"""
    if not os.path.exists(cmd[0]):
        cmd[0] = shutil.which(cmd[0])
        assert cmd[0] is not None

    shebang_parts = parseshebang.parse(cmd[0])

    proc = subprocess.Popen(shebang_parts + cmd,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate()
    return {
        "stdout": stdout,
        "stderr": stderr,
        "code": proc.returncode
    }
1135661
def handle_keypress(screen):
    
    global selected_pid
    try:
        key = screen.getkey().upper()
    except:
        return
    if key in ("KEY_DOWN", "J"):
        move_selection()
    elif key in ("KEY_UP", "K"):
        move_selection(reverse=True)
    elif key in ("A", "+"):
        send_signal("TTIN")
        if selected_pid in gunicorns:
            gunicorns[selected_pid]["workers"] = 0
    elif key in ("W", "-"):
        if selected_pid in gunicorns:
            if gunicorns[selected_pid]["workers"] != 1:
                send_signal("TTOU")
                gunicorns[selected_pid]["workers"] = 0
    elif key in ("R",):
        if selected_pid in gunicorns:
            send_signal("HUP")
            del gunicorns[selected_pid]
            selected_pid = None
    elif key in ("T",):
        for pid in gunicorns.copy().iterkeys():
            selected_pid = pid
            send_signal("HUP")
            del gunicorns[selected_pid]
            selected_pid = None
    elif key in ("M", "-"):
        if selected_pid in gunicorns:
            send_signal("QUIT")
            del gunicorns[selected_pid]
            selected_pid = None
    elif key in ("Q",):
        raise KeyboardInterrupt
1113466
def keyPressEvent(self, event):
        ""
        key = event.key()
        if key == Qt.Key_Escape:
            self.app.quit()
208622
function( key, character, shiftKey, altKey, ctrlKey, metaKey )
        {
            // submit form on enter-key
            if( interceptenter && key == 13 && ! shiftKey && ! altKey && ! ctrlKey && ! metaKey )
            {
                commands.sync();
                if( interceptenter() )
                {
                    commands.closePopup();
                    return false; // swallow enter
                }
            }
            // Exec hotkey (onkeydown because e.g. CTRL+B would oben the bookmarks)
            if( character && !shiftKey && !altKey && ctrlKey && !metaKey )
            {
                var hotkey = character.toLowerCase();
                if( hotkeys[hotkey] )
                {
                    hotkeys[hotkey]();
                    return false; // prevent default
                }
            }
            // Handle suggester
            if( suggester )
                return suggester_keydown( key, character, shiftKey, altKey, ctrlKey, metaKey );
        }
485164
public void pressSoftKeyboardNextButton(){
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "pressSoftKeyboardNextButton()");
		}
		
		presser.pressSoftKeyboard(EditorInfo.IME_ACTION_NEXT);
	}
1008141
def _bind_exit_key(self, key):
        """
        keyinfo = make_KeyPress_from_keydescr(key.lower()).tuple()
        self.exit_dispatch[keyinfo] = None
1027829
def on_key(self, event):
        """"""

        if self.main_window.grid.actions.pasting and \
           event.GetKeyCode() == wx.WXK_ESCAPE:
            self.aborted = True

        event.Skip()
953419
def _call_handler(self, key, insert_text):
        
        if isinstance(key, tuple):
            for k in key:
                self._call_handler(k, insert_text)
        else:
            if key == Keys.BracketedPaste:
                self._in_bracketed_paste = True
                self._paste_buffer = ''
            else:
                self.feed_key_callback(KeyPress(key, insert_text))
976114
def pressAndHold(*args):
    '''
    
    '''
    for i in args:
        win32api.keybd_event(VK_CODE[i], 0,0,0)
        time.sleep(.05)
1232916
def _call_cmd_line(self):
        """"""
        try:
            logging.info("Calling Popen with: {}".format(self.args))
            p = Popen(self.args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
        except OSError:
            raise(RuntimeError("No such command found in PATH"))

        # Calling this command with newline as stdin as the
        # iCommnads hangs waiting for user input if the password
        # has not been set or has timed out.
        self.stdout, self.stderr = p.communicate("\n".encode())
        self.stdout = self.stdout.decode("utf-8")
        self.stderr = self.stderr.decode("utf-8")
        self.returncode = p.returncode
87276
public void sendCommand(MenuCommand command) {
        lastTx.set(clock.millis());
        try {
            connector.sendMenuCommand(command);
        } catch (IOException e) {
            logger.log(ERROR, "Error while writing out command", e);
            connector.close();
        }
    }
100518
function send_commands(cmds, cb) {
        function callback(value) {
            if (cb) cb(value)
            this.locked = false
        }
        function run() { 
            if (this.locked = cmds.length > 0) send_command(cmds.shift(), (success) => {
                if (success) setTimeout(run, 200);
                else callback(false);
            });
            else callback(true); 
        };
        if(!this.locked) run();
    }
679938
def press_keys(self,characters=[]):
        """"""
        for character in characters:
            self.press_key(character)
        for character in characters:
            self.release_key(character)
1103023
def send_keystrokes(ip, keystrokes, wait=False):
        """"""
        tv_url = 'http://{}:6095/controller?action=keyevent&keycode='.format(ip)

        for keystroke in keystrokes:
            if keystroke == 'wait' or wait is True:

                time.sleep(0.7)
            else:
                request = requests.get(tv_url + keystroke)

                if request.status_code != 200:
                    return False

        return True