def get_text(self): global text, content_counter, result if content_counter == 1: text = get_content() else: text += "\r\n" + get_content() result = " ".join(text.split('\r\n')) self.statusbar.showMessage("获取内容%d" % (content_counter)) self.textBrowser_origin.clear() self.textBrowser_origin.append(result) content_counter += 1
def get_text(self, mode): global text, content_counter, result if mode == "add_text": if content_counter == 1: text = get_content() else: text += "\r\n" + get_content() if mode == "add_ph": text += " " + 20 * ("," + ".") + "?" # print("text:",text) result = " ".join(re.split(r'[\s]+', text)) # print("result:", result) assert len(result) != 0 self.statusbar.showMessage("获取内容%d" % (content_counter)) self.textBrowser_origin.clear() self.textBrowser_origin.append(result) content_counter += 1
def get_text(self, mode, engine=None): """ 2 engines :param mode: str :return: None """ global text, content_counter, result if mode == "add_text": if content_counter == 1: text = get_content() else: text += "\r\n" + get_content() if mode == "add_ph" and engine == "Google": text += " " + 20 * ("," + ".") + "?" if mode == "add_ph" and engine == "Youdao": text += " " + 'P' + 100 * (",") + "." result = " ".join(re.split(r'[\s]+', text)) assert len(result) != 0 self.statusbar.showMessage("获取内容%d" % (content_counter)) self.textBrowser_origin.clear() self.textBrowser_origin.append(result) content_counter += 1