def __sendString(self, string):
logger.debug("<STR_LIT>", string)<EOL>if not cm.ConfigManager.SETTINGS[cm.ENABLE_QT4_WORKAROUND]:<EOL><INDENT>self.__checkWorkaroundNeeded()<EOL><DEDENT>remapNeeded = False<EOL>for char in string:<EOL><INDENT>keyCodeList = self.localDisplay.keysym_to_keycodes(ord(char))<EOL>usableCode, offset = self.__findUsableKeycode(keyCodeList)<EOL>if usableCode is None and char not in self.remappedChars:<EOL><INDENT>remapNeeded = True<EOL>break<EOL><DEDENT><DEDENT>if remapNeeded:<EOL><INDENT>self.__ignoreRemap = True<EOL>self.remappedChars = {}<EOL>remapChars = []<EOL>for char in string:<EOL><INDENT>keyCodeList = self.localDisplay.keysym_to_keycodes(ord(char))<EOL>usableCode, offset = self.__findUsableKeycode(keyCodeList)<EOL>if usableCode is None:<EOL><INDENT>remapChars.append(char)<EOL><DEDENT><DEDENT>logger.debug("<STR_LIT>", remapChars)<EOL>availCodes = self.__availableKeycodes<EOL>logger.debug("<STR_LIT>", availCodes)<EOL>mapping = self.localDisplay.get_keyboard_mapping(<NUM_LIT:8>, <NUM_LIT:200>)<EOL>firstCode = <NUM_LIT:8><EOL>for i in range(len(availCodes) - <NUM_LIT:1>):<EOL><INDENT>code = availCodes[i]<EOL>sym1 = <NUM_LIT:0><EOL>sym2 = <NUM_LIT:0><EOL>if len(remapChars) > <NUM_LIT:0>:<EOL><INDENT>char = remapChars.pop(<NUM_LIT:0>)<EOL>self.remappedChars[char] = (code, <NUM_LIT:0>)<EOL>sym1 = ord(char)<EOL><DEDENT>if len(remapChars) > <NUM_LIT:0>:<EOL><INDENT>char = remapChars.pop(<NUM_LIT:0>)<EOL>self.remappedChars[char] = (code, <NUM_LIT:1>)<EOL>sym2 = ord(char)<EOL><DEDENT>if sym1 != <NUM_LIT:0>:<EOL><INDENT>mapping[code - firstCode][<NUM_LIT:0>] = sym1<EOL>mapping[code - firstCode][<NUM_LIT:1>] = sym2<EOL><DEDENT><DEDENT>mapping = [tuple(l) for l in mapping]<EOL>self.localDisplay.change_keyboard_mapping(firstCode, mapping)<EOL>self.localDisplay.flush()<EOL><DEDENT>focus = self.localDisplay.get_input_focus().focus<EOL>for char in string:<EOL><INDENT>try:<EOL><INDENT>keyCodeList = self.localDisplay.keysym_to_keycodes(ord(char))<EOL>keyCode, offset = self.__findUsableKeycode(keyCodeList)<EOL>if keyCode is not None:<EOL><INDENT>if offset == <NUM_LIT:0>:<EOL><INDENT>self.__sendKeyCode(keyCode, theWindow=focus)<EOL><DEDENT>if offset == <NUM_LIT:1>:<EOL><INDENT>self.__pressKey(Key.SHIFT)<EOL>self.__sendKeyCode(keyCode, self.modMasks[Key.SHIFT], focus)<EOL>self.__releaseKey(Key.SHIFT)<EOL><DEDENT>if offset == <NUM_LIT:4>:<EOL><INDENT>self.__pressKey(Key.ALT_GR)<EOL>self.__sendKeyCode(keyCode, self.modMasks[Key.ALT_GR], focus)<EOL>self.__releaseKey(Key.ALT_GR)<EOL><DEDENT>if offset == <NUM_LIT:5>:<EOL><INDENT>self.__pressKey(Key.ALT_GR)<EOL>self.__pressKey(Key.SHIFT)<EOL>self.__sendKeyCode(keyCode, self.modMasks[Key.ALT_GR]|self.modMasks[Key.SHIFT], focus)<EOL>self.__releaseKey(Key.SHIFT)<EOL>self.__releaseKey(Key.ALT_GR)<EOL><DEDENT><DEDENT>elif char in self.remappedChars:<EOL><INDENT>keyCode, offset = self.remappedChars[char]<EOL>if offset == <NUM_LIT:0>:<EOL><INDENT>self.__sendKeyCode(keyCode, theWindow=focus)<EOL><DEDENT>if offset == <NUM_LIT:1>:<EOL><INDENT>self.__pressKey(Key.SHIFT)<EOL>self.__sendKeyCode(keyCode, self.modMasks[Key.SHIFT], focus)<EOL>self.__releaseKey(Key.SHIFT)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logger.warning("<STR_LIT>", char)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>logger.exception("<STR_LIT>", char, str(e))<EOL><DEDENT><DEDENT>self.__ignoreRemap = False<EOL>
Send a string of printable characters.