示例#1
0
    def setText(self, text):
        text = htmlToPlainText(text)

        urls = re.findall(r'(https?://[^\s]+|file:///[^\s]+)', text)
        if urls:
            beg = 0
            new_text = ''
            for url in urls:
                i = text.index(url, beg)
                new_text += text[beg:i] + '<a href="%s">%s</a>' % (url, url)
                beg = i + len(url)
            new_text += text[beg:]

            text = new_text.replace('\n', '<br>')

        super().setText(text)
示例#2
0
    def setText(self, text):
        text = htmlToPlainText(text)

        urls = re.findall(r'(https?://[^\s]+|file:///[^\s]+)', text)
        if urls:
            beg = 0
            new_text = ''
            for url in urls:
                i = text.index(url, beg)
                new_text += text[beg:i] + '<a href="%s">%s</a>' % (url, url)
                beg = i + len(url)
            new_text += text[beg:]

            text = new_text.replace('\n', '<br>')

        super().setText(text)
示例#3
0
 def setText(self, text):
     text = htmlToPlainText(text)
     self.setPlainText(text)
示例#4
0
 def setText(self, text):
     text = htmlToPlainText(text)
     self.setPlainText(text)