diff --git a/src/list_items.py b/src/list_items.py index 8308def..cabb8d6 100644 --- a/src/list_items.py +++ b/src/list_items.py @@ -13,7 +13,7 @@ import smileys class MessageEdit(QtGui.QTextBrowser): - def __init__(self, text, width, parent=None): + def __init__(self, text, width, message_type, parent=None): super(MessageEdit, self).__init__(parent) self.urls = {} self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) @@ -25,13 +25,17 @@ class MessageEdit(QtGui.QTextBrowser): self.setOpenLinks(False) self.setSearchPaths([smileys.SmileyLoader.get_instance().get_smileys_path()]) self.document().setDefaultStyleSheet('a { color: #306EFF; }') - self.setDecoratedText(text) + text = self.decoratedText(text) + if message_type == TOX_MESSAGE_TYPE['ACTION']: + self.setHtml('
' + text + '
') + else: + self.setHtml(text) font = QtGui.QFont() font.setFamily("Times New Roman") font.setPixelSize(14) font.setBold(False) self.setFont(font) - self.setFixedHeight(self.document().size().height()) + self.resize(width, self.document().size().height()) self.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse | QtCore.Qt.LinksAccessibleByMouse) self.anchorClicked.connect(self.on_anchor_clicked) @@ -64,7 +68,7 @@ class MessageEdit(QtGui.QTextBrowser): movie.currentPixmap()) self.setLineWrapColumnOrWidth(self.lineWrapColumnOrWidth()) - def setDecoratedText(self, text): + def decoratedText(self, text): text = cgi.escape(text) # replace < and > exp = QtCore.QRegExp( '(' @@ -90,7 +94,7 @@ class MessageEdit(QtGui.QTextBrowser): arr[i] = '' + arr[i][4:] + '' text = '