[PATCH 1/3] Get back to python-meh UI in exception handling

Vratislav Podzimek vpodzime at redhat.com
Tue Jul 17 14:30:32 UTC 2012


Now that python-meh is ported to Gtk3, we can again use its UI in
exception handling.
---
 pyanaconda/exception.py       |   19 +++++++++----------
 pyanaconda/ui/gui/__init__.py |    2 ++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 5c90166..28f4225 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -37,16 +37,15 @@ log = logging.getLogger("anaconda")
 
 class AnacondaExceptionHandler(ExceptionHandler):
     def handleException(self, (ty, value, tb), obj):
-        import traceback
-
-        # Save the exception to the filesystem first.
-        self.exn = self.exnClass((ty, value, tb), self.conf)
-        (fd, self.exnFile) = self.openFile()
-        text = self.exn.write(obj, fd)
-        fd.close()
-
-        traceback.print_exception(ty, value, tb)
-        os._exit(10)
+        if issubclass(ty, storage.errors.StorageError) and value.hardware_fault:
+            hw_error_msg = _("The installation was stopped due to what "
+                             "seems to be a problem with your hardware. "
+                             "The exact error message is:\n\n%s.\n\n "
+                             "The installer will now terminate.") % str(value)
+            self.intf.showError(hw_error_msg)
+        else:
+            super(AnacondaExceptionHandler, self).handleException((ty, value, tb),
+                                                                  obj)
 
     def postWriteHook(self, (ty, value, tb), anaconda):
         # See if /mnt/sysimage is present and put exception there as well
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 3d2fff9..4d3ea3a 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -116,6 +116,8 @@ class GraphicalUserInterface(UserInterface):
             dlg.run()
             dlg.destroy()
 
+        sys.exit(0)
+
     def showYesNoQuestion(self, message):
         from gi.repository import AnacondaWidgets, Gtk
 
-- 
1.7.4.4



More information about the anaconda-patches mailing list