Пример #1
0
 def on_language_change(self):
     language = self.language_list.get_text()
     language1 = language2lang_country.get(language, None)
     language2 = language1 and language1.split('_')[0]
     language3 = lang_country2linux_locale.get(self.info.language, None)
     language4 = language3 and language3.split('.')[0]
     language5 = language4 and language4.split('_')[0]
     translation = gettext.translation(self.info.application_name, localedir=self.info.translations_dir, languages=[language1, language2, language3, language4, language5])
     translation.install(unicode=True)
Пример #2
0
 def on_language_change(self):
     language = self.language_list.get_text()
     language1 = language2lang_country.get(language, None)
     language2 = language1 and language1.split('_')[0]
     language3 = lang_country2linux_locale.get(self.info.language, None)
     language4 = language3 and language3.split('.')[0]
     language5 = language4 and language4.split('_')[0]
     translation = gettext.translation(self.info.application_name, localedir=self.info.translations_dir, languages=[language1, language2, language3, language4, language5])
     translation.install(unicode=True, names=[ngettext])
Пример #3
0
    def on_install(self):
        drive = self.get_drive()
        installation_size_mb = self.get_installation_size_mb()
        if not installation_size_mb:
            log.debug("installation size is None")
            return
        language = self.language_list.get_text()
        language = self.language2lang_country.get(language, None)
        locale = lang_country2linux_locale.get(language, self.info.locale)
        username = self.username.get_text()
        password1 = self.password1.get_text()
        password2 = self.password2.get_text()
        error_message = ""
        if not username:
            error_message = _("Please enter a valid username")
        #这个地方注释了用户名大小写和空格的问题
            '''
        elif username != username.lower():
            error_message = _("Please use all lower cases in the username.")
        elif " " in username:
            error_message =  _("Please do not use spaces in the username.")
        elif not re_username_first.match(username):
            error_message =  _("Your username must start with a lower-case letter.")
        elif not re_username.match(username):
            error_message =  _("Your username must contain only lower-case letters, numbers, hyphens, and underscores.")
            '''
        elif username in reserved_usernames:
            error_message = _("The selected username is reserved, please select a different one.")
        elif not password1:
            error_message = _("Please enter a valid password.")
        elif " " in password1:
            error_message = _("Please do not use spaces in the password.")
        elif password1 != password2:
            error_message = _("Passwords do not match.")
        self.error_label.set_text(error_message)
        if error_message:
            return
        log.debug(
            "target_drive=%s, installation_size=%sMB, distro_name=%s, language=%s, locale=%s, username=%s" \
            % (drive.path, installation_size_mb, self.info.distro.name, language, locale, username))
        self.info.target_drive = drive
        self.info.installation_size_mb = installation_size_mb
        self.info.language = language
        self.info.locale = locale
        self.info.username = username
        self.info.password = password1
	instmod = self.chk_bt_instmod.is_checked()
	if instmod:
	    self.info.instmod = "true"
	else:
	    self.info.instmod = "false"
        if self.chk_bt_autologin.is_checked():
            self.info.autologin = "******"
        else:
            self.info.autologin = "******"
        self.frontend.stop()
Пример #4
0
 def on_install(self):
     drive = self.get_drive()
     language = self.language_list.get_text()
     language = self.language2lang_country.get(language, None)
     locale = lang_country2linux_locale.get(language, self.info.locale)
     self.info.target_drive = drive
     self.info.language = language
     self.info.locale = locale
     self.info.flag = False
     self.frontend.stop()
 def on_install(self):
     drive = self.get_drive()
     installation_size_mb = self.get_installation_size_mb()
     language = self.language_list.get_text()
     language = language2lang_country.get(language, None)
     locale = lang_country2linux_locale.get(language, self.info.locale)
     username = self.username.get_text()
     password1 = self.password1.get_text()
     password2 = self.password2.get_text()
     error_message = ""
     if not username:
         error_message = _("Please enter a valid username.")
     elif username != username.lower():
         error_message = _("Please use all lower cases in the username.")
     elif " " in username:
         error_message = _("Please do not use spaces in the username.")
     elif not re_username_first.match(username):
         error_message = _(
             "Your username must start with a lower-case letter.")
     elif not re_username.match(username):
         error_message = _(
             "Your username must contain only lower-case letters, numbers, hyphens, and underscores."
         )
     elif username in reserved_usernames:
         error_message = _(
             "The selected username is reserved, please select a different one."
         )
     elif not password1:
         error_message = _("Please enter a valid password.")
     elif " " in password1:
         error_message = _("Please do not use spaces in the password.")
     elif password1 != password2:
         error_message = _("Passwords do not match.")
     self.error_label.set_text(error_message)
     if error_message:
         if self.info.non_interactive:
             log.error("ERROR: %s Exiting." % error_message)
             self.frontend.quit()
         return
     log.debug(
         "target_drive=%s, installation_size=%sMB, distro_name=%s, language=%s, locale=%s, username=%s" \
         % (drive.path, installation_size_mb, self.info.distro.name, language, locale, username))
     self.info.target_drive = drive
     self.info.installation_size_mb = installation_size_mb
     self.info.language = language
     self.info.locale = locale
     self.info.username = username
     self.info.password = password1
     self.frontend.stop()
Пример #6
0
 def on_install(self):
     drive = self.get_drive()
     installation_size_mb = self.get_installation_size_mb()
     language = self.language_list.get_text()
     language = language2lang_country.get(language, None)
     locale = lang_country2linux_locale.get(language, self.info.locale)
     username = self.username.get_text()
     password1 = self.password1.get_text()
     password2 = self.password2.get_text()
     error_message = ""
     if not username:
         error_message = _("Please enter a valid username.")
     elif username != username.lower():
         error_message = _("Please use all lower cases in the username.")
     elif " " in username:
         error_message =  _("Please do not use spaces in the username.")
     elif not re_username_first.match(username):
         error_message =  _("Your username must start with a lower-case letter.")
     elif not re_username.match(username):
         error_message =  _("Your username must contain only lower-case letters, numbers, hyphens, and underscores.")
     elif username in reserved_usernames:
         error_message = _("The selected username is reserved, please select a different one.")
     elif not password1:
         error_message = _("Please enter a valid password.")
     elif " " in password1:
         error_message = _("Please do not use spaces in the password.")
     elif password1 != password2:
         error_message = _("Passwords do not match.")
     self.error_label.set_text(error_message)
     if error_message:
         if self.info.non_interactive:
             log.error("ERROR: %s Exiting." % error_message)
             self.frontend.quit()
         return
     log.debug(
         "target_drive=%s, installation_size=%sMB, distro_name=%s, language=%s, locale=%s, username=%s" \
         % (drive.path, installation_size_mb, self.info.distro.name, language, locale, username))
     self.info.target_drive = drive
     self.info.installation_size_mb = installation_size_mb
     self.info.language = language
     self.info.locale = locale
     self.info.username = username
     self.info.password = password1
     self.frontend.stop()