def lookup(): if not Editor.isValid(): return word=Editor.selectionInTarget() if not word: word=Editor.selectionInSource() if not word: return os.system("kfmclient newTab 'http://multitran.ru/c/m.exe?l1=1&l2=2&s=%s'" % word)
def lookup(): if not Editor.isValid(): return word = Editor.selectionInTarget() if not word: word = Editor.selectionInSource() if not word: return os.system("kioclient exec 'http://tureng.com/search/%s'" % word)
def main(): current_entry = Editor.currentEntry() source = Editor.entrySource(current_entry, 0).decode("utf-8") target = Editor.entryTarget(current_entry, 0).decode("utf-8") source_tags = get_tags(source) target_tags = get_tags(target) if len(source_tags) - len(target_tags) <= 0: return tag_to_insert = source_tags[len(target_tags)] selection = Editor.selectionInTarget() if selection: selection = selection.decode("utf-8") tmp = replace_inner_text(tag_to_insert, selection) partition = target.rfind(selection) target = target[:partition] + target[partition:].replace(selection, tmp) else: target += tag_to_insert Editor.setEntryTarget(current_entry, 0, target.encode("utf-8"))