Update the ErrorDialog

This commit is contained in:
Andrew Resch 2010-12-12 09:58:28 -08:00 committed by Pedro Algarvio
parent 49d5ed6bde
commit 5ad3a1666c
1 changed files with 15 additions and 2 deletions

View File

@ -147,13 +147,16 @@ class ErrorDialog(BaseDialog):
When run(), it will return a gtk.RESPONSE_CLOSE.
"""
def __init__(self, header, text, parent=None, details=None):
def __init__(self, header, text, parent=None, details=None, traceback=False):
"""
:param header: see `:class:BaseDialog`
:param text: see `:class:BaseDialog`
:param parent: see `:class:BaseDialog`
:param details: str, extra information that will be displayed in a
:param details: extra information that will be displayed in a
scrollable textview
:type details: string
:param traceback: show the traceback information in the details area
:type traceback: bool
"""
super(ErrorDialog, self).__init__(
header,
@ -162,6 +165,16 @@ class ErrorDialog(BaseDialog):
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE),
parent)
if traceback:
import traceback
import sys
tb = sys.exc_info()
tb = traceback.format_exc(tb[2])
if details:
details += "\n" + tb
else:
details = tb
if details:
self.set_default_size(500, 400)
textview = gtk.TextView()