diff options
author | Chris Lumens <clumens@redhat.com> | 2012-10-09 15:45:42 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2012-10-09 16:06:59 -0400 |
commit | 5b00c4df5dfcd6ddafa63671b7fd7f27faa681f6 (patch) | |
tree | d1cc0536b43ecfcd13394cda9d50bfd65aaea8bd | |
parent | 08dfb0ff5bb75d2ce3007aee4a53c48f15a9eef7 (diff) | |
download | anaconda-5b00c4df5dfcd6ddafa63671b7fd7f27faa681f6.tar.gz anaconda-5b00c4df5dfcd6ddafa63671b7fd7f27faa681f6.tar.xz anaconda-5b00c4df5dfcd6ddafa63671b7fd7f27faa681f6.zip |
Modify the DetailedErrorDialog buttons.
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.
-rw-r--r-- | pyanaconda/ui/gui/spokes/lib/detailederror.glade | 22 | ||||
-rw-r--r-- | pyanaconda/ui/gui/spokes/lib/detailederror.py | 33 | ||||
-rw-r--r-- | pyanaconda/ui/gui/spokes/software.py | 9 | ||||
-rw-r--r-- | pyanaconda/ui/gui/spokes/storage.py | 8 |
4 files changed, 34 insertions, 38 deletions
diff --git a/pyanaconda/ui/gui/spokes/lib/detailederror.glade b/pyanaconda/ui/gui/spokes/lib/detailederror.glade index eb031b577..3a873ce70 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 fd6a45585..2ccb7c8df 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): @@ -30,12 +33,12 @@ class DetailedErrorDialog(GUIObject): set of error messages, like might be required to display the results of package dependency solving or storage sanity checking. - By default, this dialog has only a single button - cancel, displayed - on the far left hand side of the dialog, with a response ID of 0. - For all other buttons, provide a kwarg named "buttons" as a list of - translated labels. Each will have an incrementing response ID - starting with 1. It is up to the caller of the "run" method to do - something with the returned response ID. + If no buttons are provided, this dialog will have only a single button: + cancel, with a response ID of 0. Otherwise, the kwarg named "buttons" + should be a list of translated labels. Each will have an incrementing + response ID starting with 0, and any Quit button will be placed on the + far left hand side of the dialog. It's up to the caller of the "run" + method to do something with the returned response ID. """ builderObjects = ["detailedErrorDialog", "detailedTextBuffer"] mainWidgetName = "detailedErrorDialog" @@ -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 1d795a903..080d7da36 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 cda59a618..84a23ac0c 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 |