def bulkCopy(nids): mw.progress.start(immediate=True) for nid in nids: note = mw.col.getNote(nid) word = note[srcField] try : with warnings.catch_warnings(): warnings.simplefilter("error") mw.progress.update(label=word) GetExamples(word) g = Google() g.write(word) dp = DictionaryParser(word) dp.format() except : # mw.progress.clear() # utils.showInfo("Exception " + word) txt = "<h3>" + word + "</h3>" txt += "<div style='white-space: pre-wrap'>" + traceback.format_exc() + "</div>" utils.showText(txt, type="html") pass mw.progress.finish()
def Example_read(text, exitme=0): text = stripHTML(text.replace("\n", "")).encode("utf-8").strip() sentence.getSentence(text) # mw.col.decks.current()['name'] sen = text if len(sen) == 0: if exitme == 1: TTS_read("No examples. %s" % (text), TTS_language) return param = ["ParseYourDictionary.exe", text] if subprocessing: subprocess.Popen(param, startupinfo=si, stdin=PIPE, stdout=PIPE, stderr=STDOUT) else: subprocess.Popen(param, startupinfo=si, stdin=PIPE, stdout=PIPE, stderr=STDOUT).communicate() g = Google() g.write(text) Example_read(text, 1) else: TTS_read(sen, TTS_language)