[PATCH 2/2] Unset the 'seen' flag if values are changed in the UI (#971050)

Vratislav Podzimek vpodzime at redhat.com
Mon Jun 17 11:44:34 UTC 2013


The 'seen' flag is used by the Initial Setup to find out if the values were
changed by the user and the execute methods of the ksdata elements should be
called or not.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/datetime_spoke.py | 14 ++++++++++++--
 pyanaconda/ui/gui/spokes/password.py       |  4 ++++
 pyanaconda/ui/tui/spokes/time.py           |  1 +
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 879c7da..5e0c9ce 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -301,6 +301,9 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
     def __init__(self, *args):
         NormalSpoke.__init__(self, *args)
 
+        # taking values from the kickstart file?
+        self._kickstarted = flags.flags.automatedInstall
+
     def initialize(self):
         NormalSpoke.initialize(self)
         self._daysStore = self.builder.get_object("days")
@@ -402,6 +405,8 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
             return _("Nothing selected")
 
     def apply(self):
+        old_tz = self.data.timezone.timezone
+
         # we could use self._tzmap.get_timezone() here, but it returns "" if
         # Etc/XXXXXX timezone is selected
         region = self._get_active_region()
@@ -409,7 +414,11 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         new_tz = region + "/" + city
 
         self.data.timezone.timezone = new_tz
-        self.data.timezone.seen = True
+
+        if old_tz != new_tz:
+            # new values, not from kickstart
+            self.data.timezone.seen = False
+            self._kickstarted = False
 
         self.data.timezone.nontp = not self._ntpSwitch.get_active()
 
@@ -425,7 +434,8 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
 
     @property
     def completed(self):
-        if flags.flags.automatedInstall and not self.data.timezone.seen:
+        if self._kickstarted and not self.data.timezone.seen:
+            # taking values from kickstart, but not specified
             return False
         else:
             return timezone.is_valid_timezone(self.data.timezone.timezone)
diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index 4cb5af1..2c877d2 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -98,7 +98,11 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke):
         self.data.rootpw.password = cryptPassword(self._password)
         self.data.rootpw.isCrypted = True
         self.data.rootpw.lock = False
+
+        # value from the kickstart changed
+        self.data.rootpw.seen = False
         self._kickstarted = False
+
         self.pw.set_placeholder_text("")
         self.confirm.set_placeholder_text("")
 
diff --git a/pyanaconda/ui/tui/spokes/time.py b/pyanaconda/ui/tui/spokes/time.py
index 7887b96..fd44db7 100644
--- a/pyanaconda/ui/tui/spokes/time.py
+++ b/pyanaconda/ui/tui/spokes/time.py
@@ -133,3 +133,4 @@ class TimeZoneSpoke(FirstbootSpokeMixIn, NormalTUISpoke):
 
     def apply(self):
         self.data.timezone.timezone = self._selection
+        self.data.timezone.seen = False
-- 
1.7.11.7



More information about the anaconda-patches mailing list