On Fri, 2013-03-15 at 14:17 -0400, Chris Lumens wrote:
This saves some very small amount of time in bringing the hub up
after the
welcome spoke goes away. It's still not quite fast enough, though.
---
pyanaconda/ui/gui/spokes/datetime_spoke.py | 55 ++++++++++++++++++------------
1 file changed, 33 insertions(+), 22 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py
b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 1800f02..2b344c4 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -29,11 +29,12 @@ log = logging.getLogger("anaconda")
# pylint: disable-msg=E0611
from gi.repository import AnacondaWidgets, GLib, Gtk, Gdk
+from pyanaconda.ui import communication
from pyanaconda.ui.common import FirstbootSpokeMixIn
from pyanaconda.ui.gui import GUIObject
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.gui.categories.localization import LocalizationCategory
-from pyanaconda.ui.gui.utils import enlightbox, gtk_thread_nowait, gtk_call_once
+from pyanaconda.ui.gui.utils import enlightbox, gtk_thread_nowait, gtk_thread_wait,
gtk_call_once
from pyanaconda import timezone
from pyanaconda.timezone import NTP_SERVICE
@@ -311,27 +312,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
self._citiesStore = self.builder.get_object("cities")
self._tzmap = self.builder.get_object("tzmap")
- self._regions_zones = timezone.get_all_regions_and_timezones()
-
- for day in xrange(1, 32):
- self.add_to_store(self._daysStore, day)
-
- self._months_nums = dict()
- for i in xrange(1, 13):
- #a bit hacky way, but should return the translated string
- #TODO: how to handle language change? Clear and populate again?
- month = datetime.date(2000, i, 1).strftime('%B')
- self.add_to_store(self._monthsStore, month)
- self._months_nums[month] = i
-
- for year in xrange(1990, 2051):
- self.add_to_store(self._yearsStore, year)
-
- for region in self._regions_zones.keys():
- self.add_to_store(self._regionsStore, region)
- for city in self._regions_zones[region]:
- self.add_to_store(self._citiesStore, city)
-
# we need to know it the new value is the same as previous or not
self._old_region = None
self._old_city = None
@@ -360,6 +340,31 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
self._ntpSwitch = self.builder.get_object("networkTimeSwitch")
+ self._regions_zones = timezone.get_all_regions_and_timezones()
+
+ threadMgr.add(AnacondaThread(name="AnaDateTimeThread",
target=self._initialize))
+
+ @gtk_thread_wait
+ def _initialize(self):
+ for day in xrange(1, 32):
+ self.add_to_store(self._daysStore, day)
+
+ self._months_nums = dict()
+ for i in xrange(1, 13):
+ #a bit hacky way, but should return the translated string
+ #TODO: how to handle language change? Clear and populate again?
+ month = datetime.date(2000, i, 1).strftime('%B')
+ self.add_to_store(self._monthsStore, month)
+ self._months_nums[month] = i
+
+ for year in xrange(1990, 2051):
+ self.add_to_store(self._yearsStore, year)
+
+ for region in self._regions_zones.keys():
+ self.add_to_store(self._regionsStore, region)
+ for city in self._regions_zones[region]:
+ self.add_to_store(self._citiesStore, city)
+
if self._radioButton24h.get_active():
self._set_amPm_part_sensitive(False)
Does this really change anything?
Cause if I'm not wrong, using the
@gtk_thread_wait decorator makes the _initialize method run in the main
loop, thus in the main thread. I believe the code changing the Gtk
widgets (not stores etc.) should be put in a separate function decorated
with @gtk_thread_nowait (because the thread doesn't have to wait for
these actions to finish).
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic