Refactor crashdialog setText

This commit is contained in:
Florian Bruhin 2014-01-31 10:30:18 +01:00
parent 89738bce7d
commit 0cbb574ced

View File

@ -32,17 +32,20 @@ class CrashDialog(QDialog):
txt = QTextEdit(self) txt = QTextEdit(self)
txt.setReadOnly(True) txt.setReadOnly(True)
txt.setText( outputs = [
'==== Version info ====\n{}\n\n'.format(utils.version()) + ('Version info', utils.version()),
'==== Exception ====\n{}\n'.format( ('Exception', ''.join(traceback.format_exception(*exc))),
''.join(traceback.format_exception(*exc))) + ('Open Pages', '\n'.join(pages)),
'==== Open pages ====\n{}\n\n'.format('\n'.join(pages)) + ('Command history', '\n'.join(cmdhist)),
'==== Command history ====\n{}\n\n'.format('\n'.join(cmdhist)) + ('Commandline args', ' '.join(sys.argv[1:])),
'==== Commandline args ====\n{}\n\n'.format( ('Config', utils.config.config.dump_userconfig()),
' '.join(sys.argv[1:])) + ]
'==== Config ====\n{}'.format( chunks = []
utils.config.config.dump_userconfig()) for (header, body) in outputs:
) h = '==== {} ===='.format(header)
chunks.append('\n'.join([h, body]))
txt.setText('\n\n'.join(chunks))
vbox.addWidget(txt) vbox.addWidget(txt)
self.setLayout(vbox) self.setLayout(vbox)