replace unprintable chars when showing an error

This commit is contained in:
Damien Elmes 2009-06-15 12:55:17 +09:00
parent 5eddecd75d
commit 1ed03b3f0b

View file

@ -150,7 +150,7 @@ class AnkiQt(QMainWindow):
def getError(self):
p = self.pool
self.pool = ""
return p
return unicode(p, 'utf8', 'replace')
self.errorPipe = ErrorPipe(self)
sys.stderr = self.errorPipe
@ -194,10 +194,7 @@ Please do not file a bug report with Anki.<br>""")
diag.setLayout(layout)
text = QTextEdit()
text.setReadOnly(True)
try:
text.setHtml(txt + "<div style='white-space: pre-wrap'>" + error + "</div>")
except:
text.setHtml("couldn't set error")
text.setHtml(txt + "<div style='white-space: pre-wrap'>" + error + "</div>")
layout.addWidget(text)
box = QDialogButtonBox(QDialogButtonBox.Close)
layout.addWidget(box)