def activate(self, leaf): text = interface.get_text_representation(leaf) xte_paste_argv = ['xte', 'usleep 300000'] # replace all newlines with 'key Return' for line in text.splitlines(True): xte_paste_argv.append("str " + line.rstrip("\r\n")) if line.endswith("\n"): xte_paste_argv.append("key Return") if not utils.spawn_async(xte_paste_argv): raise CommandMissingError('xte')
def activate(self, leaf): text = interface.get_text_representation(leaf) xte_paste_argv = ['xte', 'usleep 300000'] # replace all newlines with 'key Return' for line in text.splitlines(True): xte_paste_argv.append("str " + line.rstrip("\r\n")) if line.endswith("\n"): xte_paste_argv.append("key Return") try: utils.spawn_async_raise(xte_paste_argv) except utils.SpawnError as exc: raise OperationError(exc)
def valid_for_item(self, leaf): try: return bool(interface.get_text_representation(leaf)) except AttributeError: pass