[PATCH 2/3] Make it more obvious which fields on custom part are editable (#958251).
Vratislav Podzimek
vpodzime at redhat.com
Thu May 2 08:32:33 UTC 2013
On Tue, 2013-04-30 at 15:40 -0400, Chris Lumens wrote:
> I'm doing this by marking the labels next to the fields as sensitive or
> insensitive as well. This relies upon the labels being mnemonic widgets
> for some other widget, which they ought to be anyway. Just don't break
> that assumption.
> ---
> pyanaconda/ui/gui/spokes/custom.py | 61 ++++++++++++++++++++++----------------
> 1 file changed, 36 insertions(+), 25 deletions(-)
>
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index c104d1e..62069ed 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -207,6 +207,16 @@ def validate_mountpoint(mountpoint, used_mountpoints, strict=True):
>
> return valid
>
> +def fancy_set_sensitive(widget, value):
> + """Set the sensitivity of a widget, and then set the sensitivity of
> + all widgets it is a mnemonic widget for. This has the effect of
> + marking both an entry and its label as sensitive/insensitive, for
> + instance.
> + """
> + widget.set_sensitive(value)
> + for w in widget.list_mnemonic_labels():
> + w.set_sensitive(value)
> +
Nice idea! I think this function could live in pyanaconda.ui.gui.utils,
it could come handy in other spokes as well.
> class AddDialog(GUIObject):
> builderObjects = ["addDialog", "mountPointStore", "mountPointCompletion", "mountPointEntryBuffer"]
> mainWidgetName = "addDialog"
> @@ -372,8 +382,10 @@ class ContainerDialog(GUIObject):
> dialog_label.set_text(dialog_text)
>
> # populate the dialog widgets
> - self._nameEntry.set_text(self.name)
> - self._nameEntry.set_sensitive(not self.exists)
> + name_entry = self.builder.get_object("container_name_entry")
> + name_entry.set_text(self.name)
> + name_entry.set_sensitive(not self.exists)
> + fancy_set_sensitive(name_entry, not self.exists)
You don't need to cal set_sensitive on the name_entry,
fancy_set_sensitive will do it.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list