Ejemplo n.º 1
0
    def __init__(self, backend, signaler, parent=None):
        """
        Constructs the LoginWidget.

        :param backend: Backend being used
        :type backend: Backend
        :param signaler: Object in charge of handling communication
                         back to the frontend
        :type signaler: Signaler
        :param parent: The parent widget for this widget
        :type parent: QWidget or None
        """
        QtGui.QWidget.__init__(self, parent)
        SignalTracker.__init__(self)

        self.ui = Ui_LoginWidget()
        self.ui.setupUi(self)

        self.ui.chkRemember.stateChanged.connect(self._remember_state_changed)
        self.ui.chkRemember.setEnabled(has_keyring())

        self.ui.lnUser.textChanged.connect(self._credentials_changed)
        self.ui.lnPassword.textChanged.connect(self._credentials_changed)

        self.ui.btnLogin.clicked.connect(self._do_login)
        self.ui.btnLogout.clicked.connect(self.do_logout)

        self.ui.lnUser.setValidator(
            QtGui.QRegExpValidator(QtCore.QRegExp(USERNAME_REGEX), self))

        self.ui.clblErrorMsg.hide()
        self.ui.clblErrorMsg.clicked.connect(self.ui.clblErrorMsg.hide)

        self.ui.lnUser.textEdited.connect(self.ui.clblErrorMsg.hide)
        self.ui.lnPassword.textEdited.connect(self.ui.clblErrorMsg.hide)

        self._settings = LeapSettings()
        self._backend = backend
        self._leap_signaler = signaler

        # the selected provider that we'll use to login
        self._provider = None

        self._state = LoginState()

        self._set_logged_out()
Ejemplo n.º 2
0
    def __init__(self, backend, signaler, parent=None):
        """
        Constructs the LoginWidget.

        :param backend: Backend being used
        :type backend: Backend
        :param signaler: Object in charge of handling communication
                         back to the frontend
        :type signaler: Signaler
        :param parent: The parent widget for this widget
        :type parent: QWidget or None
        """
        QtGui.QWidget.__init__(self, parent)
        SignalTracker.__init__(self)

        self.ui = Ui_LoginWidget()
        self.ui.setupUi(self)

        self.ui.chkRemember.stateChanged.connect(self._remember_state_changed)
        self.ui.chkRemember.setEnabled(has_keyring())

        self.ui.lnUser.textChanged.connect(self._credentials_changed)
        self.ui.lnPassword.textChanged.connect(self._credentials_changed)

        self.ui.btnLogin.clicked.connect(self._do_login)
        self.ui.btnLogout.clicked.connect(self.do_logout)

        self.ui.lnUser.setValidator(
            QtGui.QRegExpValidator(QtCore.QRegExp(USERNAME_REGEX), self))

        self.ui.clblErrorMsg.hide()
        self.ui.clblErrorMsg.clicked.connect(self.ui.clblErrorMsg.hide)

        self.ui.lnUser.textEdited.connect(self.ui.clblErrorMsg.hide)
        self.ui.lnPassword.textEdited.connect(self.ui.clblErrorMsg.hide)

        self._settings = LeapSettings()
        self._backend = backend
        self._leap_signaler = signaler

        # the selected provider that we'll use to login
        self._provider = None

        self._state = LoginState()

        self._set_logged_out()
Ejemplo n.º 3
0
    def __init__(self, backend, leap_signaler):
        """
        Constructor for the main Wizard.

        :param backend: Backend being used
        :type backend: Backend
        """
        QtGui.QWizard.__init__(self)
        SignalTracker.__init__(self)

        self.ui = Ui_Wizard()
        self.ui.setupUi(self)

        self.setPixmap(QtGui.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/images/mask-icon.png"))

        self.QUESTION_ICON = QtGui.QPixmap(":/images/black/22/question.png")
        self.ERROR_ICON = QtGui.QPixmap(":/images/black/22/off.png")
        self.OK_ICON = QtGui.QPixmap(":/images/black/22/on.png")

        self._selected_services = set()
        self._shown_services = set()

        self._show_register = False

        self._use_existing_provider = False

        self.ui.grpCheckProvider.setVisible(False)
        self.ui.btnCheck.clicked.connect(self._check_provider)
        self.ui.lnProvider.returnPressed.connect(self._check_provider)

        self._leap_signaler = leap_signaler

        self._backend = backend
        self._backend_connect()

        self._domain = None

        # this details are set when the provider download is complete.
        self._provider_details = None

        self.currentIdChanged.connect(self._current_id_changed)

        self.ui.lnProvider.textChanged.connect(self._enable_check)
        self.ui.rbNewProvider.toggled.connect(lambda x: self._enable_check())
        self.ui.cbProviders.currentIndexChanged[int].connect(
            self._reset_provider_check)

        self.ui.lblUser.returnPressed.connect(self._focus_password)
        self.ui.lblPassword.returnPressed.connect(self._focus_second_password)
        self.ui.lblPassword2.returnPressed.connect(self._register)
        self.ui.btnRegister.clicked.connect(self._register)

        self.ui.rbExistingProvider.toggled.connect(self._skip_provider_checks)

        usernameRe = QtCore.QRegExp(USERNAME_REGEX)
        self.ui.lblUser.setValidator(
            QtGui.QRegExpValidator(usernameRe, self))

        self.page(self.REGISTER_USER_PAGE).setCommitPage(True)

        self._username = None
        self._password = None

        self.page(self.REGISTER_USER_PAGE).setButtonText(
            QtGui.QWizard.CommitButton, self.tr("&Next >"))
        self.page(self.SERVICES_PAGE).setButtonText(
            QtGui.QWizard.FinishButton, self.tr("Connect"))

        # XXX: Temporary removal for enrollment policy
        # https://leap.se/code/issues/2922
        self.ui.label_12.setVisible(False)
        self.ui.lblProviderPolicy.setVisible(False)

        self._load_configured_providers()

        self._provider_checks_ok = False
        self._provider_setup_ok = False
        self.finished.connect(self._wizard_finished)
Ejemplo n.º 4
0
    def __init__(self, backend, leap_signaler):
        """
        Constructor for the main Wizard.

        :param backend: Backend being used
        :type backend: Backend
        """
        QtGui.QWizard.__init__(self)
        SignalTracker.__init__(self)

        self.ui = Ui_Wizard()
        self.ui.setupUi(self)

        self.setPixmap(QtGui.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/images/mask-icon.png"))

        self.QUESTION_ICON = QtGui.QPixmap(":/images/black/22/question.png")
        self.ERROR_ICON = QtGui.QPixmap(":/images/black/22/off.png")
        self.OK_ICON = QtGui.QPixmap(":/images/black/22/on.png")

        self._selected_services = set()
        self._shown_services = set()

        self._show_register = False

        self._use_existing_provider = False

        self.ui.grpCheckProvider.setVisible(False)
        self.ui.btnCheck.clicked.connect(self._check_provider)
        self.ui.lnProvider.returnPressed.connect(self._check_provider)

        self._leap_signaler = leap_signaler

        self._backend = backend
        self._backend_connect()

        self._domain = None

        # this details are set when the provider download is complete.
        self._provider_details = None

        self.currentIdChanged.connect(self._current_id_changed)

        self.ui.lnProvider.textChanged.connect(self._enable_check)
        self.ui.rbNewProvider.toggled.connect(lambda x: self._enable_check())
        self.ui.cbProviders.currentIndexChanged[int].connect(
            self._reset_provider_check)

        self.ui.lblUser.returnPressed.connect(self._focus_password)
        self.ui.lblPassword.returnPressed.connect(self._focus_second_password)
        self.ui.lblPassword2.returnPressed.connect(self._register)
        self.ui.btnRegister.clicked.connect(self._register)

        self.ui.rbExistingProvider.toggled.connect(self._skip_provider_checks)

        usernameRe = QtCore.QRegExp(USERNAME_REGEX)
        self.ui.lblUser.setValidator(QtGui.QRegExpValidator(usernameRe, self))

        self.page(self.REGISTER_USER_PAGE).setCommitPage(True)

        self._username = None
        self._password = None

        self.page(self.REGISTER_USER_PAGE).setButtonText(
            QtGui.QWizard.CommitButton, self.tr("&Next >"))
        self.page(self.SERVICES_PAGE).setButtonText(QtGui.QWizard.FinishButton,
                                                    self.tr("Connect"))

        # XXX: Temporary removal for enrollment policy
        # https://leap.se/code/issues/2922
        self.ui.label_12.setVisible(False)
        self.ui.lblProviderPolicy.setVisible(False)

        self._load_configured_providers()

        self._provider_checks_ok = False
        self._provider_setup_ok = False
        self.finished.connect(self._wizard_finished)