[PATCH] If a user has been created, don't allow entering the user spoke (#1058564).

Vratislav Podzimek vpodzime at redhat.com
Mon Feb 3 08:38:09 UTC 2014


On Fri, 2014-01-31 at 14:46 -0500, Chris Lumens wrote:
> However, we still show the spoke in an insensitive state since removing all
> spokes from the progress hub might look pretty weird.  This also redoes the
> root password spoke fix from #1041405 to make it insensitive instead of
> hidden too.
> 
> Note:  Nothing should be required for the text UI here.  The password and user
> spokes get sorted to the end of the list always.  This will require changing on
> rhel7-branch.
> ---
>  pyanaconda/ui/common.py              | 15 ++++++++++++++-
>  pyanaconda/ui/gui/hubs/__init__.py   |  2 +-
>  pyanaconda/ui/gui/spokes/password.py |  2 +-
>  pyanaconda/ui/gui/spokes/user.py     |  8 +++++++-
>  pyanaconda/ui/tui/spokes/user.py     |  8 +++++++-
>  5 files changed, 30 insertions(+), 5 deletions(-)
> 
> diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
> index 63a7afc..96ac3c8 100644
> --- a/pyanaconda/ui/common.py
> +++ b/pyanaconda/ui/common.py
> @@ -1,6 +1,6 @@
>  # Common classes for user interface
>  #
> -# Copyright (C) 2012  Red Hat, Inc.
> +# Copyright (C) 2012-2014  Red Hat, Inc.
>  #
>  # This copyrighted material is made available to anyone wishing to use,
>  # modify, copy, or redistribute it subject to the terms and conditions of
> @@ -282,6 +282,19 @@ class Spoke(UIObject):
>          return False
>  
>      @property
> +    def sensitive(self):
> +        """May the user click on this spoke's selector and be taken to the spoke?
> +           This is different from the showable property.  A spoke that is not
> +           sensitive will still be shown on the hub, but the user may not enter it.
> +           This is also different from the ready property.  A spoke that is not
> +           ready may not be entered, but the spoke may become ready in the future.
> +           A spoke that is not sensitive will likely not become so.
> +
> +           Most spokes will not want to override this method.
> +        """
> +        return True
> +
> +    @property
>      def mandatory(self):
>          """Mark this spoke as mandatory. Installation will not be allowed
>             to proceed until all mandatory spokes are complete.
> diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
> index ecccffc..e0f4d13 100644
> --- a/pyanaconda/ui/gui/hubs/__init__.py
> +++ b/pyanaconda/ui/gui/hubs/__init__.py
> @@ -259,7 +259,7 @@ class Hub(GUIObject, common.Hub):
>          setViewportBackground(viewport)
>  
>      def _updateCompleteness(self, spoke, update_continue=True):
> -        spoke.selector.set_sensitive(spoke.ready)
> +        spoke.selector.set_sensitive(spoke.sensitive and spoke.ready)
>          spoke.selector.set_property("status", spoke.status)
>          spoke.selector.set_tooltip_markup(escape_markup(spoke.status))
>          spoke.selector.set_incomplete(not spoke.completed and spoke.mandatory)
> diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
> index 1ef7a0b..bedefb5 100644
> --- a/pyanaconda/ui/gui/spokes/password.py
> +++ b/pyanaconda/ui/gui/spokes/password.py
> @@ -144,7 +144,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler)
>          return bool(self.data.rootpw.password or self.data.rootpw.lock)
>  
>      @property
> -    def showable(self):
> +    def sensitive(self):
>          return not (self.completed and flags.automatedInstall)
>  
>      def _checkPasswordEmpty(self, inputcheck):
> diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
> index 07d9012..65c074b 100644
> --- a/pyanaconda/ui/gui/spokes/user.py
> +++ b/pyanaconda/ui/gui/spokes/user.py
> @@ -1,6 +1,6 @@
>  # User creation spoke
>  #
> -# Copyright (C) 2013 Red Hat, Inc.
> +# Copyright (C) 2013-2014 Red Hat, Inc.
>  #
>  # This copyrighted material is made available to anyone wishing to use,
>  # modify, copy, or redistribute it subject to the terms and conditions of
> @@ -17,10 +17,12 @@
>  # Red Hat, Inc.
>  #
>  # Red Hat Author(s): Martin Sivak <msivak at redhat.com>
> +#                    Chris Lumens <clumens at redhat.com>
>  #
>  
>  import re
>  
> +from pyanaconda.flags import flags
>  from pyanaconda.i18n import _, CN_
>  from pyanaconda.users import cryptPassword, validatePassword, guess_username
>  
> @@ -392,6 +394,10 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler):
>              self.data.user.userList.remove(self._user)
>  
>      @property
> +    def sensitive(self):
> +        return not (self.completed and flags.automatedInstall)
> +
> +    @property
>      def completed(self):
>          return len(self.data.user.userList) > 0
>  
> diff --git a/pyanaconda/ui/tui/spokes/user.py b/pyanaconda/ui/tui/spokes/user.py
> index 8cc96ac..f069eec 100644
> --- a/pyanaconda/ui/tui/spokes/user.py
> +++ b/pyanaconda/ui/tui/spokes/user.py
> @@ -1,6 +1,6 @@
>  # User creation text spoke
>  #
> -# Copyright (C) 2013  Red Hat, Inc.
> +# Copyright (C) 2013-2014  Red Hat, Inc.
>  #
>  # This copyrighted material is made available to anyone wishing to use,
>  # modify, copy, or redistribute it subject to the terms and conditions of
> @@ -17,12 +17,14 @@
>  # Red Hat, Inc.
>  #
>  # Red Hat Author(s): Martin Sivak <msivak at redhat.com>
> +#                    Chris Lumens <clumens at redhat.com>
>  #
>  
>  from pyanaconda.ui.tui.spokes import EditTUISpoke
>  from pyanaconda.ui.tui.spokes import EditTUISpokeEntry as Entry
>  from pyanaconda.ui.common import FirstbootSpokeMixIn
>  from pyanaconda.users import guess_username
> +from pyanaconda.flags import flags
>  from pyanaconda.i18n import N_, _
>  from pykickstart.constants import FIRSTBOOT_RECONFIG
>  from pyanaconda.constants import ANACONDA_ENVIRON, FIRSTBOOT_ENVIRON
> @@ -95,6 +97,10 @@ class UserSpoke(FirstbootSpokeMixIn, EditTUISpoke):
>              return False
>  
>      @property
> +    def showable(self):
> +        return not (self.completed and flags.automatedInstall)
> +
> +    @property
>      def mandatory(self):
>          """ Only mandatory if root account is disabled. """
>          return not bool(self.data.rootpw.password) or self.data.rootpw.lock
This should be better. Let me just check it doesn't break the Initial
Setup.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list