(self)
Handle keyboard events.
Handle keyboard events.
Handle keyboard events .
def drain_queue(self):
        """Handle keyboard events."""
        while True:
            # s is one unicode char or one scancode
            uc, sc, mods = self._get_key()
            if not uc and not sc:
                break
            if uc == EOF and self.quit_on_eof:
                # ctrl-D (unix) / ctrl-Z (windows)
                self._input_queue.put(signals.Event(signals.QUIT))
            elif uc == u'\x7f':
                # backspace
                self._input_queue.put(
                    signals.Event(signals.KEYB_DOWN, (uea.BACKSPACE, scancode.BACKSPACE, []))
                )
            elif sc or uc:
                # check_full=False to allow pasting chunks of text
                self._input_queue.put(signals.Event(signals.KEYB_DOWN, (uc, sc, mods)))
                # this is needed since we don't send key-up events at all otherwise
                if sc == scancode.F12:
                    self._f12_active = True
                elif self._f12_active:
                    self._input_queue.put(signals.Event(signals.KEYB_UP, (scancode.F12,)))
                    self._f12_active = False
def drain_queue ( self ) : while True : # s is one unicode char or one scancode uc , sc , mods = self . _get_key ( ) if not uc and not sc : break if uc == EOF and self . quit_on_eof : # ctrl-D (unix) / ctrl-Z (windows) self . _input_queue . put ( signals . Event ( signals . QUIT ) ) elif uc == u'\x7f' : # backspace self . _input_queue . put ( signals . Event ( signals . KEYB_DOWN , ( uea . BACKSPACE , scancode . BACKSPACE , [ ] ) ) ) elif sc or uc : # check_full=False to allow pasting chunks of text self . _input_queue . put ( signals . Event ( signals . KEYB_DOWN , ( uc , sc , mods ) ) ) # this is needed since we don't send key-up events at all otherwise if sc == scancode . F12 : self . _f12_active = True elif self . _f12_active : self . _input_queue . put ( signals . Event ( signals . KEYB_UP , ( scancode . F12 , ) ) ) self . _f12_active = False