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