Exemplo n.º 1
0
    def info_loop(self, widget):
        """ User has introduced new information. Check it here. """

        if widget == self.entry['fullname']:
            fullname = self.entry['fullname'].get_text()
            if len(fullname) > 0:
                self.is_ok['fullname'].set_from_icon_name(ICON_OK, Gtk.IconSize.LARGE_TOOLBAR)
                self.is_ok['fullname'].show()
                self.is_false['fullname'].hide()
            else:
                self.is_false['fullname'].set_from_icon_name(ICON_WARNING, Gtk.IconSize.LARGE_TOOLBAR)
                self.is_false['fullname'].show()
                self.is_ok['fullname'].hide()

        if widget == self.entry['hostname']:
            hostname = self.entry['hostname'].get_text()
            self.validate('hostname', hostname)

        if widget == self.entry['username']:
            username = self.entry['username'].get_text()
            self.validate('username', username)

        if widget == self.entry['password'] or \
                widget == self.entry['verified_password']:
            validation.check_password(self.entry['password'],
                                      self.entry['verified_password'],
                                      self.is_ok['password'],
                                      self.is_false['password'],
                                      self.error_label['password'],
                                      self.password_strength,
                                      ICON_OK,
                                      ICON_WARNING)

        btn = self.ui.get_object('checkbutton_root_password')
        show = btn.get_active()
        if show:
            if widget == self.entry['root_password'] or \
                    widget == self.entry['verified_root_password']:
                validation.check_password(self.entry['root_password'],
                                          self.entry['verified_root_password'],
                                          self.is_ok['root_password'],
                                          self.is_false['root_password'],
                                          self.error_label['root_password'],
                                          self.root_password_strength,
                                          ICON_OK,
                                          ICON_WARNING)
        else:
            self.is_ok['root_password'].show()
            self.is_false['root_password'].hide()

        # Check if all fields are filled and ok
        all_ok = True
        ok_widgets = self.is_ok.values()
        for ok_widget in ok_widgets:
            widget = ok_widget.get_visible()
            if widget is False:
                all_ok = False

        self.forward_button.set_sensitive(all_ok)
Exemplo n.º 2
0
    def info_loop(self, widget):
        """ User has introduced new information. Check it here. """

        if widget == self.entry['fullname']:
            fullname = self.entry['fullname'].get_text()
            if len(fullname) > 0:
                self.is_ok['fullname'].set_from_icon_name(
                    ICON_OK, Gtk.IconSize.LARGE_TOOLBAR)
                self.is_ok['fullname'].show()
                self.is_false['fullname'].hide()
            else:
                self.is_false['fullname'].set_from_icon_name(
                    ICON_WARNING, Gtk.IconSize.LARGE_TOOLBAR)
                self.is_false['fullname'].show()
                self.is_ok['fullname'].hide()

        if widget == self.entry['hostname']:
            hostname = self.entry['hostname'].get_text()
            self.validate('hostname', hostname)

        if widget == self.entry['username']:
            username = self.entry['username'].get_text()
            self.validate('username', username)

        if widget == self.entry['password'] or \
                widget == self.entry['verified_password']:
            validation.check_password(
                self.entry['password'], self.entry['verified_password'],
                self.is_ok['password'], self.is_false['password'],
                self.error_label['password'], self.password_strength, ICON_OK,
                ICON_WARNING)

        btn = self.ui.get_object('checkbutton_root_password')
        show = btn.get_active()
        if show:
            if widget == self.entry['root_password'] or \
                    widget == self.entry['verified_root_password']:
                validation.check_password(self.entry['root_password'],
                                          self.entry['verified_root_password'],
                                          self.is_ok['root_password'],
                                          self.is_false['root_password'],
                                          self.error_label['root_password'],
                                          self.root_password_strength, ICON_OK,
                                          ICON_WARNING)
        else:
            self.is_ok['root_password'].show()
            self.is_false['root_password'].hide()

        # Check if all fields are filled and ok
        all_ok = True
        ok_widgets = self.is_ok.values()
        for ok_widget in ok_widgets:
            widget = ok_widget.get_visible()
            if widget is False:
                all_ok = False

        self.forward_button.set_sensitive(all_ok)
Exemplo n.º 3
0
    def info_loop(self, widget):
        """ User has introduced new information. Check it here. """

        if widget == self.entry['fullname']:
            fullname = self.entry['fullname'].get_text()
            if fullname:
                self.image_is_ok['fullname'].set_from_icon_name(
                    ICON_OK,
                    Gtk.IconSize.LARGE_TOOLBAR)
            else:
                self.image_is_ok['fullname'].set_from_icon_name(
                    ICON_WARNING,
                    Gtk.IconSize.LARGE_TOOLBAR)
            self.image_is_ok['fullname'].show()

        elif widget == self.entry['hostname']:
            hostname = self.entry['hostname'].get_text()
            self.validate('hostname', hostname)

        elif widget == self.entry['username']:
            username = self.entry['username'].get_text()
            self.validate('username', username)

        elif (widget == self.entry['password'] or
              widget == self.entry['verified_password']):
            validation.check_password(
                self.entry['password'],
                self.entry['verified_password'],
                self.image_is_ok['password'],
                self.error_label['password'],
                self.password_strength)

        # Check if all fields are filled and ok
        all_ok = True
        ok_widgets = self.image_is_ok.values()
        if not self.settings.get('z_hidden'):
            for ok_widget in ok_widgets:
                icon_name = ok_widget.get_property('icon-name')
                visible = ok_widget.is_visible()
                if not visible or icon_name == ICON_WARNING:
                    all_ok = False

        self.forward_button.set_sensitive(all_ok)
Exemplo n.º 4
0
    def info_loop(self, widget):
        """ User has introduced new information. Check it here. """

        if widget == self.entry['fullname']:
            fullname = self.entry['fullname'].get_text()
            if len(fullname) > 0:
                self.image_is_ok['fullname'].set_from_icon_name(
                    ICON_OK, Gtk.IconSize.LARGE_TOOLBAR)
                self.image_is_ok['fullname'].show()
            else:
                self.image_is_ok['fullname'].set_from_icon_name(
                    ICON_WARNING, Gtk.IconSize.LARGE_TOOLBAR)
                self.image_is_ok['fullname'].show()

        elif widget == self.entry['hostname']:
            hostname = self.entry['hostname'].get_text()
            self.validate('hostname', hostname)

        elif widget == self.entry['username']:
            username = self.entry['username'].get_text()
            self.validate('username', username)

        elif widget == self.entry['password'] or widget == self.entry[
                'verified_password']:
            validation.check_password(self.entry['password'],
                                      self.entry['verified_password'],
                                      self.image_is_ok['password'],
                                      self.error_label['password'],
                                      self.password_strength)

        # Check if all fields are filled and ok
        all_ok = True
        ok_widgets = self.image_is_ok.values()
        if not self.settings.get('z_hidden'):
            for ok_widget in ok_widgets:
                icon_name = ok_widget.get_property('icon-name')
                visible = ok_widget.is_visible()
                # logging.info('icon_name is: %s. visible is: %s', icon_name, visible)
                if not visible or icon_name == ICON_WARNING:
                    all_ok = False

        self.forward_button.set_sensitive(all_ok)