def _handle_input(self): char = self._char if char: num = ord(char) logger.debug('first ordinal: %d' % num) if num == 27: self._input_movement() elif num == 127: self._backspace() else: self._input_content(char)
def ijoin_lists(l): """ Convert the list of lists l to its elements' sums. """ if l: try: if not all(ymap(isinstance, l, list)): from tek.errors import MooException raise MooException('Some elements aren\'t lists!') for i in cumsum([0] + list(map(len, l[:-1]))): l[i:i + 1] = l[i] except Exception as e: logger.debug('ijoin_lists failed with: ' + str(e)) return l
def ijoin_lists(l): """ Convert the list of lists l to its elements' sums. """ if l: try: if not all(ymap(isinstance, l, list)): from tek.errors import MooException raise MooException("Some elements aren't lists!") for i in cumsum([0] + list(map(len, l[:-1]))): l[i : i + 1] = l[i] except Exception as e: logger.debug("ijoin_lists failed with: " + str(e)) return l
def _input_movement(self): char2, char3 = ord(self._char), ord(self._char) if not self._single: logger.debug('second ordinal: %d' % char2) logger.debug('third ordinal: %d' % char3) if char2 == 91: if char3 == 51: fourth = ord(self._char) if fourth == 126: self._delete() else: logger.debug('fourth ordinal: %d' % fourth) elif char3 == 70: # end self._move_cursor(1, len(self._input) - self._cursor_position) elif char3 == 72: # home self._move_cursor(-1, self._cursor_position) elif char3 in [50, 53, 54]: fourth = ord(self._char) logger.debug('fourth ordinal: %d' % fourth) elif char3 in self._move_keys: self._move_cursor(self._move_keys[char3])