[master 1/3] Install input checks before modifying the user GUI (#1256065)

dashea installerbot-noreply at redhat.com
Wed Oct 7 13:51:47 UTC 2015


From: David Shea <dshea at redhat.com>

The signal handlers for the user spoke expect the input check variables
to be available, so make sure that is true.
---
 pyanaconda/ui/gui/spokes/user.py | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index e21cc81..9350976 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -272,22 +272,6 @@ def initialize(self):
 
         # indicate when the password was set by kickstart
         self._user.password_kickstarted = self.data.user.seen
-        if self._user.password_kickstarted:
-            self.usepassword.set_active(self._user.password != "")
-            if not self._user.isCrypted:
-                self.pw.set_text(self._user.password)
-                self.confirm.set_text(self._user.password)
-            else:
-                self.usepassword.set_active(True)
-                self.pw.set_placeholder_text(_("The password was set by kickstart."))
-                self.confirm.set_placeholder_text(_("The password was set by kickstart."))
-        elif not self.policy.emptyok:
-            # Policy is that a non-empty password is required
-            self.usepassword.set_active(True)
-
-        if not self.policy.emptyok:
-            # User isn't allowed to change whether password is required or not
-            self.usepassword.set_sensitive(False)
 
         # Password checks, in order of importance:
         # - if a password is required, is one specified?
@@ -315,6 +299,26 @@ def initialize(self):
 
         self.add_re_check(self.fullname, GECOS_VALID, _("Full name cannot contain colon characters"))
 
+        # Modify the GUI based on the kickstart and policy information
+        # This needs to happen after the input checks have been created, since
+        # the Gtk signal handlers use the input check variables.
+        if self._user.password_kickstarted:
+            self.usepassword.set_active(self._user.password != "")
+            if not self._user.isCrypted:
+                self.pw.set_text(self._user.password)
+                self.confirm.set_text(self._user.password)
+            else:
+                self.usepassword.set_active(True)
+                self.pw.set_placeholder_text(_("The password was set by kickstart."))
+                self.confirm.set_placeholder_text(_("The password was set by kickstart."))
+        elif not self.policy.emptyok:
+            # Policy is that a non-empty password is required
+            self.usepassword.set_active(True)
+
+        if not self.policy.emptyok:
+            # User isn't allowed to change whether password is required or not
+            self.usepassword.set_sensitive(False)
+
         self._advanced = AdvancedUserDialog(self._user, self.data)
         self._advanced.initialize()
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/3e53499cfa0e5da65e503cd99483edeafa93ae10


More information about the anaconda-patches mailing list