Optimizations and better newlines handling
This commit is contained in:
parent
c848d55462
commit
51b9a59719
|
@ -2585,19 +2585,20 @@ class MyForm(QtGui.QMainWindow):
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
messageText, = row
|
messageText, = row
|
||||||
|
|
||||||
messageText = shared.fixPotentiallyInvalidUTF8Data(messageText)
|
|
||||||
messageText = unicode(messageText, 'utf-8)')
|
|
||||||
lines = messageText.split('\n')
|
lines = messageText.split('\n')
|
||||||
for i in xrange(len(lines)):
|
totalLines = len(lines)
|
||||||
|
for i in xrange(totalLines):
|
||||||
if 'Message ostensibly from ' in lines[i]:
|
if 'Message ostensibly from ' in lines[i]:
|
||||||
lines[i] = u'<p style="font-size: 12px; color: grey;">%s</span></p>' % (
|
lines[i] = '<p style="font-size: 12px; color: grey;">%s</span></p>' % (
|
||||||
lines[i])
|
lines[i])
|
||||||
elif lines[i] == '------------------------------------------------------':
|
elif lines[i] == '------------------------------------------------------':
|
||||||
lines[i] = '<hr>'
|
lines[i] = '<hr>'
|
||||||
content = u''
|
elif lines[i] == '' and (i+1) < totalLines and \
|
||||||
for i in xrange(len(lines)):
|
lines[i+1] != '------------------------------------------------------':
|
||||||
content += lines[i]
|
lines[i] = '<br><br>'
|
||||||
content = content.replace('\n\n', '<br><br>')
|
content = ' '.join(lines) # To keep the whitespace between lines
|
||||||
|
content = shared.fixPotentiallyInvalidUTF8Data(content)
|
||||||
|
content = unicode(content, 'utf-8)')
|
||||||
self.ui.textEditInboxMessage.setHtml(QtCore.QString(content))
|
self.ui.textEditInboxMessage.setHtml(QtCore.QString(content))
|
||||||
|
|
||||||
def on_action_InboxMarkUnread(self):
|
def on_action_InboxMarkUnread(self):
|
||||||
|
|
Reference in New Issue
Block a user