Exemple #1
0
 def ok_handler(self):
     if self.language_question is not None:
         new_language = self.frontend.get_language()
         self.preseed(self.language_question, new_language)
         if (self.initial_language is None
                 or self.initial_language != new_language):
             self.db.reset('debian-installer/country')
     FilteredCommand.ok_handler(self)
Exemple #2
0
 def ok_handler(self):
     if self.language_question is not None:
         new_language = self.frontend.get_language()
         self.preseed(self.language_question, new_language)
         if (self.initial_language is None or
             self.initial_language != new_language):
             self.db.reset('debian-installer/country')
     FilteredCommand.ok_handler(self)
Exemple #3
0
 def ok_handler(self):
     zone = self.frontend.get_timezone()
     if zone is None:
         zone = self.db.get('time/zone')
     else:
         self.preseed('time/zone', zone)
     for location in self.tzdb.locations:
         if location.zone == zone:
             self.preseed('debian-installer/country', location.country)
             break
     FilteredCommand.ok_handler(self)
Exemple #4
0
    def run(self, priority, question):
        if question.startswith('user-setup/password-weak'):
            # A dialog is a bit clunky, but workable for now. Perhaps it
            # would be better to display some text in the style of
            # password_error, and then let the user carry on anyway by
            # clicking next again?
            response = self.frontend.question_dialog(
                self.description(question),
                self.extended_description(question),
                ('oem-config/text/go_back', 'oem-config/text/continue'))
            if response is None or response == 'oem-config/text/continue':
                self.preseed(question, 'true')
            else:
                self.preseed(question, 'false')
                return super(User, self).error(priority, question)
            return True

        if question.startswith('user-setup/user-setup'):
            response = self.frontend.question_dialog(
                self.description('oem-config/text/user-setup'),
                self.extended_description('oem-config/text/user-setup'),
                ('oem-config/text/go_back', 'oem-config/text/yes'))
            if response is None or response == 'oem-config/text/yes':
                self.preseed(question, 'true')
            else:
                self.preseed(question, 'false')
                return super(User, self).error(priority, question)
            return True

        return FilteredCommand.run(self, priority, question)
Exemple #5
0
    def run(self, priority, question):
        if question.startswith('user-setup/password-weak'):
            # A dialog is a bit clunky, but workable for now. Perhaps it
            # would be better to display some text in the style of
            # password_error, and then let the user carry on anyway by
            # clicking next again?
            response = self.frontend.question_dialog(
                self.description(question),
                self.extended_description(question),
                ('oem-config/text/go_back', 'oem-config/text/continue'))
            if response is None or response == 'oem-config/text/continue':
                self.preseed(question, 'true')
            else:
                self.preseed(question, 'false')
            return True

        return FilteredCommand.run(self, priority, question)
    def run(self, priority, question):
        if question == 'localechooser/languagelist':
            self.language_question = question
            if self.initial_language is None:
                self.initial_language = self.db.get(question)
            current_language_index = self.value_index(question)
            current_language = "English"

            import gzip
            
            if os.path.exists("/usr/share/oem-languages/languagelist.data.gz"):
               languagelist = gzip.open('/usr/share/oem-languages/languagelist.data.gz')
            else:
                languagelist = gzip.open('/usr/lib/oem-config/language/languagelist.data.gz')

            language_display_map = {}
            i = 0
            for line in languagelist:
                line = unicode(line, 'utf-8')
                if line == '' or line == '\n':
                    continue
                code, name, trans = line.strip(u'\n').split(u':')[1:]
                if code in ('dz', 'km'):
                    i += 1
                    continue
                language_display_map[trans] = (name, code)
                if i == current_language_index:
                    current_language = trans
                i += 1
            languagelist.close()

            def compare_choice(x, y):
                result = cmp(language_display_map[x][1],
                             language_display_map[y][1])
                if result != 0:
                    return result
                return cmp(x, y)

            sorted_choices = sorted(language_display_map, compare_choice)
            self.frontend.set_language_choices(sorted_choices,
                                               language_display_map)
            self.frontend.set_language(current_language)

        return FilteredCommand.run(self, priority, question)
Exemple #7
0
    def run(self, priority, question):
        if question == 'localechooser/languagelist':
            self.language_question = question
            if self.initial_language is None:
                self.initial_language = self.db.get(question)
            current_language_index = self.value_index(question)
            current_language = "English"

            import gzip
            languagelist = gzip.open(
                '/usr/lib/oem-config/language/languagelist.data.gz')
            language_display_map = {}
            i = 0
            for line in languagelist:
                line = unicode(line, 'utf-8')
                if line == '' or line == '\n':
                    continue
                code, name, trans = line.strip(u'\n').split(u':')[1:]
                if code in ('dz', 'km'):
                    i += 1
                    continue
                language_display_map[trans] = (name, code)
                if i == current_language_index:
                    current_language = trans
                i += 1
            languagelist.close()

            def compare_choice(x, y):
                result = cmp(language_display_map[x][1],
                             language_display_map[y][1])
                if result != 0:
                    return result
                return cmp(x, y)

            sorted_choices = sorted(language_display_map, compare_choice)
            self.frontend.set_language_choices(sorted_choices,
                                               language_display_map)
            self.frontend.set_language(current_language)

        return FilteredCommand.run(self, priority, question)
    def run(self, priority, question):
        if self.done:
            return self.succeeded

        if question == 'console-setup/layout':
            # Reset this in case we just backed up from the variant
            # question.
            self.succeeded = True
            # TODO cjwatson 2006-09-07: no console-setup support for layout
            # choice translation yet
            self.frontend.set_keyboard_choices(
                self.choices_untranslated(question))
            self.frontend.set_keyboard(self.db.get(question))
            return True
        elif question == 'console-setup/variant':
            # TODO cjwatson 2006-10-02: no console-setup support for variant
            # choice translation yet
            self.frontend.set_keyboard_variant_choices(
                self.choices_untranslated(question))
            self.frontend.set_keyboard_variant(self.db.get(question))
            return FilteredCommand.run(self, priority, question)
        else:
            return True
Exemple #9
0
    def run(self, priority, question):
        if question == 'time/zone':
            if self.multiple:
                # Work around a debconf bug: REGISTER does not appear to
                # give a newly-registered question the same default as the
                # question associated with its template, unless we also
                # RESET it.
                self.db.reset(question)
            zone = self.db.get(question)
            # Some countries don't have a default zone, so just pick the
            # first choice in the list.
            if not zone:
                choices_c = self.choices_untranslated(question)
                if choices_c:
                    zone = choices_c[0]
            # special cases where default is not in zone.tab
            if zone == 'Canada/Eastern':
                zone = 'America/Toronto'
            elif zone == 'US/Eastern':
                zone = 'America/New_York'
            self.frontend.set_timezone(zone)

        return FilteredCommand.run(self, priority, question)
 def ok_handler(self):
     if self.current_question is not None:
         self.preseed(self.current_question, 'yes')
     FilteredCommand.ok_handler(self)
Exemple #11
0
 def ok_handler(self):
     variant = self.frontend.get_keyboard_variant()
     if variant is not None:
         self.preseed('console-setup/variant', variant)
     return FilteredCommand.ok_handler(self)