From 5ad3a1666c7c6f60aa0a4a6bc6fbf04f173724ac Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 12 Dec 2010 09:58:28 -0800 Subject: [PATCH] Update the ErrorDialog --- deluge/ui/gtkui/dialogs.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/dialogs.py b/deluge/ui/gtkui/dialogs.py index cf1cf910c..9409513c1 100644 --- a/deluge/ui/gtkui/dialogs.py +++ b/deluge/ui/gtkui/dialogs.py @@ -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()