PATCH 1/2 adds two methods needed by python-meh to user interfaces. We had such method in the old UI and the other way to do that would be some getattr hack, which I'd like to avoid.
PATCH 2/2 removes the (not needed?) line causing traceback.
Vratislav Podzimek (2): Add mainExceptionWindow and saveExceptionWindow methods to the interfaces Do not run __del__() on anaconda interface in runDebug
pyanaconda/exception.py | 2 -- pyanaconda/ui/__init__.py | 12 ++++++++++++ pyanaconda/ui/gui/__init__.py | 11 +++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-)
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@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 ###
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).
How does the mainExceptionWindow method on anaconda's GraphicalUserInterface end up getting called?
- Chris
On Thu, 2012-08-02 at 11:22 -0400, Chris Lumens wrote:
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).
How does the mainExceptionWindow method on anaconda's GraphicalUserInterface end up getting called?
We pass anaconda.intf to the AnacondaExceptionHandler (at the end of pyanaconda/exception.py), so that exception handling does not have to determine whether we are using graphical or text interface. Moreover we use showErrorMsg method in case of HW error.
How does the mainExceptionWindow method on anaconda's GraphicalUserInterface end up getting called?
We pass anaconda.intf to the AnacondaExceptionHandler (at the end of pyanaconda/exception.py), so that exception handling does not have to determine whether we are using graphical or text interface. Moreover we use showErrorMsg method in case of HW error.
Oh right, I remember this now.
I give it a cautious ACK, only because I want to keep the number of dialogs on the UserInterface classes down to a minimum. So hopefully we won't need to add too many more.
- Chris
On Thu, 2012-08-02 at 14:18 -0400, Chris Lumens wrote:
How does the mainExceptionWindow method on anaconda's GraphicalUserInterface end up getting called?
We pass anaconda.intf to the AnacondaExceptionHandler (at the end of pyanaconda/exception.py), so that exception handling does not have to determine whether we are using graphical or text interface. Moreover we use showErrorMsg method in case of HW error.
Oh right, I remember this now.
I give it a cautious ACK, only because I want to keep the number of dialogs on the UserInterface classes down to a minimum. So hopefully we won't need to add too many more.
I am thinking about a possibly better way to implement this. I will work on that and send a patch, but for now, I'm pushing this one to make exception handling running.
UserInterface object no longer has the __del__() method. --- pyanaconda/exception.py | 2 -- 1 file changed, 2 deletions(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 8adb156..96c2c1a 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -76,8 +76,6 @@ class AnacondaExceptionHandler(ExceptionHandler): except SystemError: pass
- self.intf.__del__ () - pidfl = "/tmp/vncshell.pid" if os.path.exists(pidfl) and os.path.isfile(pidfl): pf = open(pidfl, "r")
anaconda-patches@lists.fedorahosted.org