Ejemplo n.º 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)
Ejemplo n.º 2
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()