[master 1/4] Allow passing an optional button list to showDetailedError.

dwlehman installerbot-noreply at redhat.com
Mon Apr 13 21:12:55 UTC 2015


From: David Lehman <dlehman at redhat.com>

The button list will be unconditionally ignored by the TUI.

Related: rhbz#1158475
---
 pyanaconda/ui/__init__.py     | 3 +++
 pyanaconda/ui/gui/__init__.py | 9 +++++----
 pyanaconda/ui/tui/__init__.py | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/ui/__init__.py b/pyanaconda/ui/__init__.py
index 8d71c5f..1a101d7 100644
--- a/pyanaconda/ui/__init__.py
+++ b/pyanaconda/ui/__init__.py
@@ -121,6 +121,9 @@ def showError(self, message):
         """
         raise NotImplementedError
 
+    def showDetailedError(self, message, details, buttons=None):
+        raise NotImplementedError
+
     def showYesNoQuestion(self, message):
         """Display a dialog with the given message that presents the user a yes
            or no choice.  This method returns True if the yes choice is selected,
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 65da07e..cb454e8 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -747,15 +747,16 @@ def showError(self, message):
         sys.exit(1)
 
     @gtk_action_wait
-    def showDetailedError(self, message, details):
+    def showDetailedError(self, message, details, buttons=None):
         from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog
-        dlg = DetailedErrorDialog(None, buttons=[_("_Quit")],
-                                  label=message)
+        buttons = buttons or [_("_Quit")]
+        dlg = DetailedErrorDialog(None, buttons=buttons, label=message)
 
         with self.mainWindow.enlightbox(dlg.window):
             dlg.refresh(details)
-            dlg.run()
+            rc = dlg.run()
             dlg.window.destroy()
+            return rc
 
     @gtk_action_wait
     def showYesNoQuestion(self, message):
diff --git a/pyanaconda/ui/tui/__init__.py b/pyanaconda/ui/tui/__init__.py
index 4e8c5e1..9b6d2c1 100644
--- a/pyanaconda/ui/tui/__init__.py
+++ b/pyanaconda/ui/tui/__init__.py
@@ -268,7 +268,7 @@ def _showError(self, message):
         error_window = ErrorDialog(self._app, message)
         self._app.switch_screen_modal(error_window)
 
-    def showDetailedError(self, message, details):
+    def showDetailedError(self, message, details, buttons=None):
         return self._show_message_in_main_thread(self._showDetailedError, (message, details))
 
     def _showDetailedError(self, message, details):


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/0f3b204abefb07c312263a55ddfa026314debf5c


More information about the anaconda-patches mailing list