We need to set the timezone in the initialization method because the Datetime spoke's status is queried before the refresh method gets invoked. However the change of timezone results in a change of the displayed date/time and we don't want to start timers for updating the date/time when the spoke is not shown. <not-in-the-commit-message> I will squash this patch with the PATCH 3/5. </not-in-the-commit-message> --- pyanaconda/ui/gui/spokes/datetime_spoke.py | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index c529ca9..af03029 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -108,6 +108,12 @@ class DatetimeSpoke(NormalSpoke): if self._radioButton24h.get_active(): self._set_amPm_part_sensitive(False) + self._update_datetime_timer_id = None + if self.data.timezone.timezone: + self._tzmap.set_timezone(self.data.timezone.timezone) + else: + self._tzmap.set_timezone("Europe/Prague") + @property def status(self): if self.data.timezone.timezone: @@ -117,6 +123,8 @@ class DatetimeSpoke(NormalSpoke): def apply(self): GLib.source_remove(self._update_datetime_timer_id) + self._update_datetime_timer_id = None + self.data.timezone.timezone = self._tzmap.get_timezone() @property @@ -132,8 +140,6 @@ class DatetimeSpoke(NormalSpoke): if self.data.timezone.timezone: self._tzmap.set_timezone(self.data.timezone.timezone) - else: - self._tzmap.set_timezone("Europe/Prague") self._update_datetime() @@ -259,7 +265,9 @@ class DatetimeSpoke(NormalSpoke): os.system("date -s '%0.2d/%0.2d/%0.4d %0.2d:%0.2d:%0.2d'" % (month, day, year, hours, minutes, seconds)) - self._update_datetime_timer_id = GLib.timeout_add_seconds(1, + #start the timer only when the spoke is shown + if self._update_datetime_timer_id is not None: + self._update_datetime_timer_id = GLib.timeout_add_seconds(1, self._update_datetime) #run only once (after first 2 seconds of inactivity) @@ -279,6 +287,12 @@ class DatetimeSpoke(NormalSpoke): """ + #do not start timers if the spoke is not shown + if self._update_datetime_timer_id is None: + self._update_datetime() + self._save_system_time() + return + #stop time updating GLib.source_remove(self._update_datetime_timer_id) -- 1.7.4.4 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list