[PATCH 1/2] Add mainExceptionWindow and saveExceptionWindow methods to the interfaces

Vratislav Podzimek vpodzime at redhat.com
Tue Jul 31 14:41:30 UTC 2012


python-meh has its own methods, but we have our own exception handling code
(inherited from the python-meh's one) that needs access to both python-meh
UI and anaconda UI. Hence anaconda's UIs need a mainExceptionWindow and
saveExceptionWindow methods calling the python-meh's ones (GUI or TUI).
---
 pyanaconda/ui/__init__.py     |   12 ++++++++++++
 pyanaconda/ui/gui/__init__.py |   11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/pyanaconda/ui/__init__.py b/pyanaconda/ui/__init__.py
index 3ca6c22..3cf3eb6 100644
--- a/pyanaconda/ui/__init__.py
+++ b/pyanaconda/ui/__init__.py
@@ -92,3 +92,15 @@ class UserInterface(object):
            want to overwhelm the user with choices.
         """
         raise NotImplementedError
+
+    def mainExceptionWindow(self, text, exn_file):
+        """Return window with the exception and buttons for debugging, bug
+           reporting and exitting the installer.
+
+           This method will be called only when unhandled exception appears.
+        """
+        raise NotImplementedError
+
+    def saveExceptionWindow(self, account_manager, signature):
+        """Show a window that provides a way to report a bug."""
+        raise NotImplementedError
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 2f13bed..5887047 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -19,6 +19,7 @@
 # Red Hat Author(s): Chris Lumens <clumens at redhat.com>
 #
 import importlib, inspect, os, sys
+import meh.ui.gui
 
 from pyanaconda.ui import UserInterface
 from pyanaconda.ui.gui.utils import enlightbox
@@ -132,6 +133,16 @@ class GraphicalUserInterface(UserInterface):
 
         return bool(rc)
 
+    def mainExceptionWindow(self, text, exn_file, *args, **kwargs):
+        meh_intf = meh.ui.gui.GraphicalIntf()
+
+        return meh_intf.mainExceptionWindow(text, exn_file)
+
+
+    def saveExceptionWindow(self, account_manager, signature, *args, **kwargs):
+        meh_intf = meh.ui.gui.GraphicalIntf()
+        meh_intf.saveExceptionWindow(account_manager, signature)
+
     ###
     ### SIGNAL HANDLING METHODS
     ###
-- 
1.7.10.4



More information about the anaconda-patches mailing list