~agateau/ubiquity/kde-show-os-name

« back to all changes in this revision

Viewing changes to ubiquity/plugins/ubi-timezone.py

  • Committer: Colin Watson
  • Date: 2013-01-11 18:41:51 UTC
  • Revision ID: cjwatson@canonical.com-20130111184151-s7nweopd2er26u30
For automatic installs, set debian-installer/country to a country
matching time/zone when starting up the timezone plugin, since its
ok_handler will typically never be called (LP: #1098577).

Show diffs side-by-side

added added

removed removed

Lines of Context:
426
426
            self.collator = icu.Collator.createInstance(icu.Locale(locale))
427
427
        except:
428
428
            self.collator = None
429
 
        if not 'UBIQUITY_AUTOMATIC' in os.environ:
 
429
        if 'UBIQUITY_AUTOMATIC' in os.environ:
 
430
            if self.db.fget('time/zone', 'seen') == 'true':
 
431
                self.set_di_country(self.db.get('time/zone'))
 
432
        else:
430
433
            self.db.fset('time/zone', 'seen', 'false')
431
434
            cc = self.db.get('debian-installer/country')
432
435
            try:
688
691
            pass
689
692
        return rv
690
693
 
 
694
    def set_di_country(self, zone):
 
695
        location = self.tzdb.get_loc(zone)
 
696
        if location:
 
697
            self.preseed('debian-installer/country', location.country)
 
698
 
691
699
    def ok_handler(self):
692
700
        zone = self.ui.get_timezone()
693
701
        if zone is None:
694
702
            zone = self.db.get('time/zone')
695
703
        else:
696
704
            self.preseed('time/zone', zone)
697
 
        for location in self.tzdb.locations:
698
 
            if location.zone == zone:
699
 
                self.preseed('debian-installer/country', location.country)
700
 
                break
 
705
        self.set_di_country(zone)
701
706
        plugin.Plugin.ok_handler(self)
702
707
 
703
708
    def cleanup(self):