summaryrefslogtreecommitdiffstats
path: root/gui.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2005-09-20 19:37:06 +0000
committerChris Lumens <clumens@redhat.com>2005-09-20 19:37:06 +0000
commit70d10ea749562734dd0f2f8f434c2a524f5e34ad (patch)
tree83c44e51ae9f55b46f06aa70b816267493e0a4d8 /gui.py
parent71595af83e28dff1fd608e224ca13bbfa4b15c7d (diff)
downloadanaconda-70d10ea749562734dd0f2f8f434c2a524f5e34ad.tar.gz
anaconda-70d10ea749562734dd0f2f8f434c2a524f5e34ad.tar.xz
anaconda-70d10ea749562734dd0f2f8f434c2a524f5e34ad.zip
Use glade for the exception dialog and display the full traceback on the
bottom.
Diffstat (limited to 'gui.py')
-rwxr-xr-xgui.py78
1 files changed, 47 insertions, 31 deletions
diff --git a/gui.py b/gui.py
index 151de66c4..e5e6fedba 100755
--- a/gui.py
+++ b/gui.py
@@ -536,7 +536,7 @@ class ProgressWindow:
rootPopBusyCursor()
class ExceptionWindow:
- def __init__ (self, text):
+ def __init__ (self, shortTraceback, longTracebackFile=None):
try:
floppyDevices = 0
for dev in kudzu.probe(kudzu.CLASS_FLOPPY, kudzu.BUS_UNSPEC,
@@ -546,35 +546,51 @@ class ExceptionWindow:
except:
floppyDevices = 0
- win = gtk.Dialog(_("Exception Occurred"), mainWindow, gtk.DIALOG_MODAL)
- win.add_button(_("_Debug"), 0)
- if floppyDevices > 0 or DEBUG:
- win.add_button(_("_Save to floppy"), 1)
- win.add_button('gtk-ok', 2)
- buffer = gtk.TextBuffer(None)
- buffer.set_text(text)
- textbox = gtk.TextView()
- textbox.set_buffer(buffer)
- textbox.set_property("editable", False)
- textbox.set_property("cursor_visible", False)
- sw = gtk.ScrolledWindow ()
- sw.add (textbox)
- sw.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-
- hbox = gtk.HBox (False)
-
- if floppyDevices > 0:
- info = WrappingLabel(exceptionText)
+ # Get a bunch of widgets from the XML file.
+ exnxml = gtk.glade.XML(findGladeFile("exn.glade"), domain="anaconda")
+ win = exnxml.get_widget("exnDialog")
+ vbox = exnxml.get_widget("mainVBox")
+ shortExnView = exnxml.get_widget("shortExnView")
+ longExnView = exnxml.get_widget("longExnView")
+ expander = exnxml.get_widget("longViewExpander")
+ info = exnxml.get_widget("info")
+
+ info.set_text(exceptionText)
+
+ # Add the brief traceback message to the upper text view.
+ textbuf = gtk.TextBuffer()
+ textbuf.set_text(shortTraceback)
+ shortExnView.set_buffer(textbuf)
+
+ # Remove the debug button if we don't need it.
+ if floppyDevices == 0 and not DEBUG:
+ buttonBox = exnxml.get_widget("buttonBox")
+ floppyButton = exnxml.get_widget("floppyButton")
+ buttonBox.remove(floppyButton)
+
+ # If there's an anacdump.txt file, add it to the lower view in the
+ # expander. If not, remove the expander.
+ if longTracebackFile:
+ try:
+ f = open(longTracebackFile)
+ lines = f.readlines()
+ f.close()
+
+ # Add text one line at a time to work around limits in
+ # set_text.
+ textbuf = gtk.TextBuffer()
+ iter = textbuf.get_start_iter()
+
+ for line in lines:
+ textbuf.insert(iter, line)
+
+ longExnView.set_buffer(textbuf)
+ except IOError:
+ log.error("Could not read %s, skipping" % longTraceback)
+ vbox.remove(expander)
else:
- info = WrappingLabel(exceptionTextNoFloppy)
-
- info.set_size_request (400, -1)
+ vbox.remove(expander)
- hbox.pack_start (sw, True)
- win.vbox.pack_start (info, False)
- win.vbox.pack_start (hbox, True)
- win.set_size_request (500, 300)
- win.set_position (gtk.WIN_POS_CENTER)
addFrame(win)
win.show_all ()
self.window = win
@@ -713,9 +729,9 @@ class InstallInterface:
custom_buttons, custom_icon).getrc()
return rc
- def exceptionWindow(self, title, text):
- log.critical(text)
- win = ExceptionWindow (text)
+ def exceptionWindow(self, shortText, longTextFile):
+ log.critical(shortText)
+ win = ExceptionWindow (shortText, longTextFile)
return win.getrc ()
def beep(self):