[PATCH 3/3] Modify the DetailedErrorDialog buttons.

Chris Lumens clumens at redhat.com
Tue Oct 9 19:49:56 UTC 2012


First, don't always put a cancel button on.  That looks weird on the storage
spoke where we don't mention cancel.  Second, change the order such that the
Quit or Cancel button comes left-most and is positioned secondarily.
---
 pyanaconda/ui/gui/spokes/lib/detailederror.glade | 22 ++--------------------
 pyanaconda/ui/gui/spokes/lib/detailederror.py    | 21 +++++++++++++++++----
 pyanaconda/ui/gui/spokes/software.py             |  9 +++++----
 pyanaconda/ui/gui/spokes/storage.py              |  8 ++++----
 4 files changed, 28 insertions(+), 32 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/detailederror.glade b/pyanaconda/ui/gui/spokes/lib/detailederror.glade
index eb031b5..3a873ce 100644
--- a/pyanaconda/ui/gui/spokes/lib/detailederror.glade
+++ b/pyanaconda/ui/gui/spokes/lib/detailederror.glade
@@ -50,26 +50,11 @@
           </packing>
         </child>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area2">
+          <object class="GtkButtonBox" id="detailedButtonBox">
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="detailedCancelButton">
-                <property name="label">gtk-cancel</property>
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">start</property>
-                <property name="use_action_appearance">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-                <property name="secondary">True</property>
-              </packing>
+              <placeholder/>
             </child>
           </object>
           <packing>
@@ -81,8 +66,5 @@
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="0">detailedCancelButton</action-widget>
-    </action-widgets>
   </object>
 </interface>
diff --git a/pyanaconda/ui/gui/spokes/lib/detailederror.py b/pyanaconda/ui/gui/spokes/lib/detailederror.py
index fd6a455..dbc3b08 100644
--- a/pyanaconda/ui/gui/spokes/lib/detailederror.py
+++ b/pyanaconda/ui/gui/spokes/lib/detailederror.py
@@ -23,6 +23,9 @@ from gi.repository import Gtk
 
 from pyanaconda.ui.gui import GUIObject
 
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+
 __all__ = ["DetailedErrorDialog"]
 
 class DetailedErrorDialog(GUIObject):
@@ -46,10 +49,20 @@ class DetailedErrorDialog(GUIObject):
         label = kwargs.pop("label", None)
         GUIObject.__init__(self, *args, **kwargs)
 
-        i = 1
-        for button in buttons:
-            self.window.add_button(button, i)
-            i += 1
+        if not buttons:
+            self.window.add_button(_("_Cancel"), 0)
+        else:
+            buttonbox = self.builder.get_object("detailedButtonBox")
+            i = 0
+
+            for button in buttons:
+                widget = self.window.add_button(button, i)
+
+                # Quit buttons should always appear left-most.
+                if button == _("_Quit"):
+                    buttonbox.set_child_secondary(widget, True)
+
+                i += 1
 
         if label:
             self.builder.get_object("detailedLabel").set_text(label)
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 1d795a9..080d7da 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -300,7 +300,8 @@ class SoftwareSelectionSpoke(NormalSpoke):
                   "This is likely caused by an error with\nyour installation source.  "
                   "You can attempt to remove these packages from your installation.\n"
                   "change your installation source, or quit the installer.")
-        dialog = DetailedErrorDialog(self.data, buttons=[_("_Quit"), _("_Remove Packages"),
+        dialog = DetailedErrorDialog(self.data, buttons=[_("_Quit"), _("_Cancel"),
+                                                         _("_Remove Packages"),
                                                          _("_Modify Software Source")],
                                                 label=label)
         with enlightbox(self.window, dialog.window):
@@ -310,11 +311,11 @@ class SoftwareSelectionSpoke(NormalSpoke):
         dialog.window.destroy()
 
         if rc == 0:
-            # Close the dialog so the user can change selections.
-            pass
-        elif rc == 1:
             # Quit.
             sys.exit(0)
+        elif rc == 1:
+            # Close the dialog so the user can change selections.
+            pass
         elif rc == 2:
             # TODO:  Attempt to remove the affected packages.
             pass
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index cda59a6..84a23ac 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -690,7 +690,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         label = _("The following errors were encountered when checking your storage "
                   "configuration.  You can modify your storage layout\nor quit the "
                   "installer.")
-        dialog = DetailedErrorDialog(self.data, buttons=[_("_Quit")], label=label)
+        dialog = DetailedErrorDialog(self.data, buttons=[_("_Quit"), _("_Modify Storage Layout")], label=label)
         with enlightbox(self.window, dialog.window):
             errors = "\n".join(self.errors)
             dialog.refresh(errors)
@@ -699,8 +699,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         dialog.window.destroy()
 
         if rc == 0:
-            # Close the dialog so the user can change selections.
-            pass
-        elif rc == 1:
             # Quit.
             sys.exit(0)
+        elif rc == 1:
+            # Close the dialog so the user can change selections.
+            pass
-- 
1.7.11.2



More information about the anaconda-patches mailing list