[PATCH 2/2] Don't let user hit Add button if no new layouts are selected
Chris Lumens
clumens at redhat.com
Tue Sep 11 15:29:36 UTC 2012
> diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
> index d350967..4fc07cb 100644
> --- a/pyanaconda/ui/gui/spokes/keyboard.py
> +++ b/pyanaconda/ui/gui/spokes/keyboard.py
> @@ -106,6 +106,16 @@ class AddLayoutDialog(GUIObject):
> for layout in self._xkl_wrapper.get_available_layouts():
> self._addLayout(self._store, layout)
>
> + self._confirmAddButton = self.builder.get_object("confirmAddButton")
> +
> + self._newLayoutSelection = self.builder.get_object("newLayoutSelection")
> + selected = self._newLayoutSelection.count_selected_rows()
> + if selected:
> + self._confirmAddButton.set_sensitive(True)
> + else:
> + self._confirmAddButton.set_sensitive(False)
> +
> +
If you're not planning on adding more code here, the bottom part could
just be:
self._confirmAddButton.set_sensitive(selected)
> @@ -124,6 +134,13 @@ class AddLayoutDialog(GUIObject):
> itr = store.get_iter(path)
> self._chosen_layouts.append(store[itr][0])
>
> + def on_add_layout_selection_changed(self, selection):
> + selected = selection.count_selected_rows()
> + if not selected:
> + self._confirmAddButton.set_sensitive(False)
> + else:
> + self._confirmAddButton.set_sensitive(True)
> +
> def on_cancel_clicked(self, *args):
> print "CANCELING"
Likewise, but with a not.
- Chris
More information about the anaconda-patches
mailing list