Updated to catch exception

This commit is contained in:
delicatebits 2013-04-01 20:52:22 -04:00
parent 234aa4dfec
commit d943974439

View File

@ -4641,7 +4641,13 @@ class MyForm(QtGui.QMainWindow):
raise SystemExit raise SystemExit
def on_action_InboxMsgForceHtml(self): def on_action_InboxMsgForceHtml(self):
# Updated to work with all characters. Previously, non-english characters caused errors.
try:
lines = str(self.ui.textEditInboxMessage.toPlainText()).split('\n') lines = str(self.ui.textEditInboxMessage.toPlainText()).split('\n')
except UnicodeEncodeError:
currentInboxRow = self.ui.tableWidgetInbox.currentRow()
self.ui.textEditInboxMessage.setHtml(self.ui.tableWidgetInbox.item(currentInboxRow,2).data(Qt.UserRole).toPyObject())
return
from_prefix = 'Message ostensibly from ' from_prefix = 'Message ostensibly from '
for i in xrange(len(lines)): for i in xrange(len(lines)):
if lines[i].find(from_prefix) != -1: if lines[i].find(from_prefix) != -1:
@ -4649,6 +4655,7 @@ class MyForm(QtGui.QMainWindow):
elif lines[i] == '------------------------------------------------------': elif lines[i] == '------------------------------------------------------':
lines[i] = '<hr>' lines[i] = '<hr>'
content = '\n'.join(lines) content = '\n'.join(lines)
content = content.replace('\n\n', '<br><br>')
self.ui.textEditInboxMessage.setHtml(QtCore.QString(content)) self.ui.textEditInboxMessage.setHtml(QtCore.QString(content))
def on_action_InboxReply(self): def on_action_InboxReply(self):