예제 #1
0
    def info_to_peez(self):
        """Processing info to peez step tasks."""

        from ue import validation

        error_msg = ["\n"]
        error = 0

        # Validation stuff

        # checking username entry
        for result in validation.check_username(self.username.get_property("text")):
            if result == 1:
                error_msg.append(
                    "· El <b>nombre de usuario</b> contiene carácteres incorrectos (sólo letras y números están permitidos).\n"
                )
            elif result == 2:
                error_msg.append("· El <b>nombre de usuario</b> contiene mayúsculas (no están permitidas).\n")
            elif result == 3:
                error_msg.append(
                    "· El <b>nombre de usuario</b> tiene tamaño incorrecto (permitido entre 3 y 24 caracteres).\n"
                )
            elif result == 4:
                error_msg.append("· El <b>nombre de usuario</b> contiene espacios en blanco (no están permitidos).\n")
            elif result in [5, 6]:
                error_msg.append("· El <b>nombre de usuario</b> ya está en uso o está prohibido.\n")

        # checking password entry
        for result in validation.check_password(
            self.password.get_property("text"), self.verified_password.get_property("text")
        ):
            if result in [1, 2]:
                error_msg.append(
                    "· La <b>contraseña</b> tiene tamaño incorrecto (permitido entre 4 y 16 caracteres).\n"
                )
            elif result == 3:
                error_msg.append("· Las <b>contraseñas</b> no coinciden.\n")

        # checking hostname entry
        for result in validation.check_hostname(self.hostname.get_property("text")):
            if result == 1:
                error_msg.append(
                    "· El <b>nombre del equipo</b> tiene tamaño incorrecto (permitido entre 3 y 18 caracteres).\n"
                )
            elif result == 2:
                error_msg.append("· El <b>nombre del equipo</b> contiene espacios en blanco (no están permitidos).\n")
            elif result == 3:
                error_msg.append(
                    "· El <b>nombre del equipo</b> contiene carácteres incorrectos (sólo letras y números están permitidos).\n"
                )

        # showing warning message is error is set
        if len(error_msg) > 1:
            self.show_error(self.resize_text("".join(error_msg), "4"))
        else:
            # showing next step and destroying mozembed widget to release memory
            self.browser_vbox.destroy()
            self.back.show()
            self.help.hide()
            self.steps.next_page()
예제 #2
0
 def run(self):
     from ue import validation
     error_msg = ['\n']
     error = 0
     result = validation.check_username(self.info['username'])
     if (result == 1):
         error_msg.append(
             "· username contains dots (they're not allowed).\n")
         error = 1
     elif (result == 2):
         error_msg.append(
             "· username contains uppercase characters (they're not allowed).\n"
         )
         error = 1
     elif (result == 3):
         error_msg.append(
             "· username wrong length (allowed between 3 and 24 chars).\n")
         error = 1
     elif (result == 4):
         error_msg.append(
             "· username contains white spaces (they're not allowed).\n")
         error = 1
     elif (result in [5, 6]):
         error_msg.append("· username is already taken or prohibited.\n")
         error = 1
     if (error == 1):
         self.show_error(''.join(error_msg))
     result = validation.check_password(self.info['password'],
                                        self.info['password'])
     if (result in [1, 2]):
         error_msg.append(
             "· password wrong length (allowed between 4 and 16 chars).\n")
         error = 1
     elif (result == 3):
         error_msg.append("· passwords don't match.\n")
         error = 1
     if (error == 1):
         self.show_error(''.join(error_msg))
     result = validation.check_hostname(self.info['hostname'])
     if (result == 1):
         error_msg.append(
             "· hostname wrong length (allowed between 3 and 18 chars).\n")
         error = 1
     elif (result == 2):
         error_msg.append(
             "· hostname contains white spaces (they're not allowed).\n")
         error = 1
     if (error == 1):
         self.show_error(''.join(error_msg))
     if ('/' not in self.info['mountpoints'].values()):
         error_msg.append("· mountpoint must start with '/').\n")
         error = 1
     if (error == 1):
         self.show_error(''.join(error_msg))
     self.progress_loop()
     self.clean_up()
     self.__reboot()
예제 #3
0
 def run(self):
   from ue import validation
   error_msg = ['\n']
   error = 0
   result = validation.check_username(self.info['username'])
   if ( result == 1 ):
     error_msg.append("· username contains dots (they're not allowed).\n")
     error = 1
   elif ( result == 2 ):
     error_msg.append("· username contains uppercase characters (they're not allowed).\n")
     error = 1
   elif ( result == 3 ):
     error_msg.append("· username wrong length (allowed between 3 and 24 chars).\n")
     error = 1
   elif ( result == 4 ):
     error_msg.append("· username contains white spaces (they're not allowed).\n")
     error = 1
   elif ( result in [5, 6] ):
     error_msg.append("· username is already taken or prohibited.\n")
     error = 1
   if ( error == 1 ):
     self.show_error(''.join(error_msg))
   result = validation.check_password(self.info['password'], self.info['password'])
   if ( result in [1,2] ):
     error_msg.append("· password wrong length (allowed between 4 and 16 chars).\n")
     error = 1
   elif ( result == 3 ):
     error_msg.append("· passwords don't match.\n")
     error = 1
   if ( error == 1 ):
     self.show_error(''.join(error_msg))
   result = validation.check_hostname(self.info['hostname'])
   if ( result == 1 ):
     error_msg.append("· hostname wrong length (allowed between 3 and 18 chars).\n")
     error = 1
   elif ( result == 2 ):
     error_msg.append("· hostname contains white spaces (they're not allowed).\n")
     error = 1
   if ( error == 1 ):
     self.show_error(''.join(error_msg))
   if ( '/' not in self.info['mountpoints'].values() ):
      error_msg.append("· mountpoint must start with '/').\n")
      error = 1
   if ( error == 1 ):
     self.show_error(''.join(error_msg))
   self.progress_loop()
   self.clean_up()
   self.__reboot()
예제 #4
0
 def on_next_clicked(self, widget):
   step = self.steps.get_current_page()
   pre_log('info', 'Step_before = %d' % step)
   # From Welcome to Info
   if step == 0:
     self.next.set_label('gtk-go-forward')
     self.next.set_sensitive(False)
     self.help.show()
     self.steps.next_page()
   # From Info to Part1
   elif step == 1:
     from ue import validation
     error_msg = ['\n']
     error = 0
     for result in validation.check_username(self.username.get_property('text')):
       if ( result == 1 ):
         error_msg.append("· <b>username</b> contains dots (they're not allowed).\n")
         error = 1
       elif ( result == 2 ):
         error_msg.append("· <b>username</b> contains uppercase characters (they're not allowed).\n")
         error = 1
       elif ( result == 3 ):
         error_msg.append("· <b>username</b> wrong length (allowed between 3 and 24 chars).\n")
         error = 1
       elif ( result == 4 ):
         error_msg.append("· <b>username</b> contains white spaces (they're not allowed).\n")
         error = 1
       elif ( result in [5, 6] ):
         error_msg.append("· <b>username</b> is already taken or prohibited.\n")
         error = 1
     for result in validation.check_password(self.password.get_property('text'), self.verified_password.get_property('text')):
       if ( result in [1,2] ):
         error_msg.append("· <b>password</b> wrong length (allowed between 4 and 16 chars).\n")
         error = 1
       elif ( result == 3 ):
         error_msg.append("· <b>passwords</b> don't match.\n")
         error = 1
     for result in validation.check_hostname(self.hostname.get_property('text')):
       if ( result == 1 ):
         error_msg.append("· <b>hostname</b> wrong length (allowed between 3 and 18 chars).\n")
         error = 1
       elif ( result == 2 ):
         error_msg.append("· <b>hostname</b> contains white spaces (they're not allowed).\n")
         error = 1
     if ( error == 1 ):
       self.show_error(''.join(error_msg))
     else:
       self.gparted_loop()
       self.browser_vbox.destroy()
       self.help.hide()
       self.next.set_sensitive(False)
       self.steps.set_current_page(3)
       #self.back.show()
       #if not self.checked_partitions:
       #  if not self.check_partitions():
       #    return          
       #self.steps.next_page()
   # From Part1 to part2
   elif step == 2 and self.gparted:
     self.next.set_sensitive(False)
     self.gparted_loop()
     self.steps.next_page()
   # From Part1 to Progress
   elif step == 2 and not self.gparted:
     self.progress_loop()
     self.steps.set_current_page(4)
   # From Part2 to Progress
   elif step == 3:
     self.embedded.destroy()
     self.next.set_sensitive(False)
     self.progress_loop()
     self.steps.next_page()
   # From Progress to Finish
   elif step == 4:
     self.next.set_label('Finish and Reboot')
     self.next.connect('clicked', lambda *x: gtk.main_quit())
     self.back.set_label('Just Finish')
     self.back.connect('clicked', lambda *x: gtk.main_quit())
     self.next.set_sensitive(True)
     self.back.show()
     self.cancel.hide()
     self.steps.next_page()
   
   step = self.steps.get_current_page()
   pre_log('info', 'Step_after = %d' % step)
예제 #5
0
    def on_next_clicked(self, widget):
        step = self.steps.get_current_page()
        pre_log('info', 'Step_before = %d' % step)
        # From Welcome to Info
        if step == 0:
            self.next.set_label('gtk-go-forward')
            self.next.set_sensitive(False)
            self.help.show()
            self.steps.next_page()
        # From Info to Part1
        elif step == 1:
            from ue import validation
            error_msg = ['\n']
            error = 0
            for result in validation.check_username(
                    self.username.get_property('text')):
                if (result == 1):
                    error_msg.append(
                        "· <b>username</b> contains dots (they're not allowed).\n"
                    )
                    error = 1
                elif (result == 2):
                    error_msg.append(
                        "· <b>username</b> contains uppercase characters (they're not allowed).\n"
                    )
                    error = 1
                elif (result == 3):
                    error_msg.append(
                        "· <b>username</b> wrong length (allowed between 3 and 24 chars).\n"
                    )
                    error = 1
                elif (result == 4):
                    error_msg.append(
                        "· <b>username</b> contains white spaces (they're not allowed).\n"
                    )
                    error = 1
                elif (result in [5, 6]):
                    error_msg.append(
                        "· <b>username</b> is already taken or prohibited.\n")
                    error = 1
            for result in validation.check_password(
                    self.password.get_property('text'),
                    self.verified_password.get_property('text')):
                if (result in [1, 2]):
                    error_msg.append(
                        "· <b>password</b> wrong length (allowed between 4 and 16 chars).\n"
                    )
                    error = 1
                elif (result == 3):
                    error_msg.append("· <b>passwords</b> don't match.\n")
                    error = 1
            for result in validation.check_hostname(
                    self.hostname.get_property('text')):
                if (result == 1):
                    error_msg.append(
                        "· <b>hostname</b> wrong length (allowed between 3 and 18 chars).\n"
                    )
                    error = 1
                elif (result == 2):
                    error_msg.append(
                        "· <b>hostname</b> contains white spaces (they're not allowed).\n"
                    )
                    error = 1
            if (error == 1):
                self.show_error(''.join(error_msg))
            else:
                self.gparted_loop()
                self.browser_vbox.destroy()
                self.help.hide()
                self.next.set_sensitive(False)
                self.steps.set_current_page(3)
                #self.back.show()
                #if not self.checked_partitions:
                #  if not self.check_partitions():
                #    return
                #self.steps.next_page()
        # From Part1 to part2
        elif step == 2 and self.gparted:
            self.next.set_sensitive(False)
            self.gparted_loop()
            self.steps.next_page()
        # From Part1 to Progress
        elif step == 2 and not self.gparted:
            self.progress_loop()
            self.steps.set_current_page(4)
        # From Part2 to Progress
        elif step == 3:
            self.embedded.destroy()
            self.next.set_sensitive(False)
            self.progress_loop()
            self.steps.next_page()
        # From Progress to Finish
        elif step == 4:
            self.next.set_label('Finish and Reboot')
            self.next.connect('clicked', lambda *x: gtk.main_quit())
            self.back.set_label('Just Finish')
            self.back.connect('clicked', lambda *x: gtk.main_quit())
            self.next.set_sensitive(True)
            self.back.show()
            self.cancel.hide()
            self.steps.next_page()

        step = self.steps.get_current_page()
        pre_log('info', 'Step_after = %d' % step)
예제 #6
0
    def info_to_peez(self):
        """Processing info to peez step tasks."""

        from ue import validation
        error_msg = ['\n']
        error = 0

        # Validation stuff

        # checking username entry
        for result in validation.check_username(
                self.username.get_property('text')):
            if (result == 1):
                error_msg.append(
                    "· El <b>nombre de usuario</b> contiene carácteres incorrectos (sólo letras y números están permitidos).\n"
                )
            elif (result == 2):
                error_msg.append(
                    "· El <b>nombre de usuario</b> contiene mayúsculas (no están permitidas).\n"
                )
            elif (result == 3):
                error_msg.append(
                    "· El <b>nombre de usuario</b> tiene tamaño incorrecto (permitido entre 3 y 24 caracteres).\n"
                )
            elif (result == 4):
                error_msg.append(
                    "· El <b>nombre de usuario</b> contiene espacios en blanco (no están permitidos).\n"
                )
            elif (result in [5, 6]):
                error_msg.append(
                    "· El <b>nombre de usuario</b> ya está en uso o está prohibido.\n"
                )

        # checking password entry
        for result in validation.check_password(
                self.password.get_property('text'),
                self.verified_password.get_property('text')):
            if (result in [1, 2]):
                error_msg.append(
                    "· La <b>contraseña</b> tiene tamaño incorrecto (permitido entre 4 y 16 caracteres).\n"
                )
            elif (result == 3):
                error_msg.append("· Las <b>contraseñas</b> no coinciden.\n")

        # checking hostname entry
        for result in validation.check_hostname(
                self.hostname.get_property('text')):
            if (result == 1):
                error_msg.append(
                    "· El <b>nombre del equipo</b> tiene tamaño incorrecto (permitido entre 3 y 18 caracteres).\n"
                )
            elif (result == 2):
                error_msg.append(
                    "· El <b>nombre del equipo</b> contiene espacios en blanco (no están permitidos).\n"
                )
            elif (result == 3):
                error_msg.append(
                    "· El <b>nombre del equipo</b> contiene carácteres incorrectos (sólo letras y números están permitidos).\n"
                )

        # showing warning message is error is set
        if (len(error_msg) > 1):
            self.show_error(self.resize_text(''.join(error_msg), '4'))
        else:
            # showing next step and destroying mozembed widget to release memory
            self.browser_vbox.destroy()
            self.back.show()
            self.help.hide()
            self.steps.next_page()