def __init__(self, jobs_ctx, config,
                 addr: BackendOrganizationBootstrapAddr):
        super().__init__()
        self.setupUi(self)
        self.dialog = None
        self.jobs_ctx = jobs_ctx
        self.config = config
        self.addr = addr
        self.label_instructions.setText(
            _("TEXT_BOOTSTRAP_ORG_INSTRUCTIONS_url-organization").format(
                url=self.addr.to_url(),
                organization=self.addr.organization_id))
        self.bootstrap_job = None
        self.button_bootstrap.clicked.connect(self.bootstrap_clicked)
        pwd_str_widget = PasswordStrengthWidget()
        self.layout_password_strength.addWidget(pwd_str_widget)
        self.line_edit_password.textChanged.connect(
            pwd_str_widget.on_password_change)
        self.line_edit_login.textChanged.connect(self.check_infos)
        self.line_edit_device.textChanged.connect(self.check_infos)
        self.line_edit_password.textChanged.connect(self.check_infos)
        self.line_edit_password_check.textChanged.connect(self.check_infos)
        self.line_edit_login.setValidator(validators.UserIDValidator())
        self.line_edit_device.setValidator(validators.DeviceNameValidator())
        self.bootstrap_success.connect(self.on_bootstrap_success)
        self.bootstrap_error.connect(self.on_bootstrap_error)

        self.line_edit_device.setText(get_default_device())

        self.status = None

        self.check_infos()
예제 #2
0
def test_not_empty_validator(qtbot, core_config):
    switch_language(core_config, "en")

    le = ValidatedLineEdit()
    le.set_validator(validators.UserIDValidator())
    qtbot.add_widget(le)
    le.show()

    assert not le.is_input_valid()
    assert le.property("validity") is None

    qtbot.keyClicks(le, "Reynholm")
    qtbot.wait_until(lambda: le.text() == "Reynholm")
    assert le.is_input_valid()
    assert le.property("validity") == QtGui.QValidator.Acceptable
 def __init__(self, portal, core, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.setupUi(self)
     self.core = core
     self.portal = portal
     self.cancel_scope = None
     self.register_thread = None
     self.register_queue = queue.Queue(1)
     self.widget_registration.hide()
     self.button_cancel.hide()
     self.button_register.clicked.connect(self.register_user)
     self.button_cancel.clicked.connect(self.cancel_register_user)
     self.button_copy_username.clicked.connect(
         self.copy_field(self.line_edit_user))
     self.button_copy_token.clicked.connect(
         self.copy_field(self.line_edit_token))
     self.button_copy_url.clicked.connect(
         self.copy_field(self.line_edit_url))
     self.on_registered.connect(self.user_registered)
     self.on_register_error.connect(self.registration_error)
     self.line_edit_username.setValidator(validators.UserIDValidator())
     self.closing_allowed = True
 def __init__(self, core_config, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.setupUi(self)
     self.core_config = core_config
     self.button_cancel.hide()
     self.button_claim.clicked.connect(self.claim_clicked)
     self.button_cancel.clicked.connect(self.cancel_claim)
     self.line_edit_login.textChanged.connect(self.check_infos)
     self.line_edit_device.textChanged.connect(self.check_infos)
     self.line_edit_token.textChanged.connect(self.check_infos)
     self.line_edit_url.textChanged.connect(self.check_infos)
     self.line_edit_password.textChanged.connect(self.password_changed)
     self.claim_successful.connect(self.claim_finished)
     self.on_claim_error.connect(self.claim_error)
     self.line_edit_login.setValidator(validators.UserIDValidator())
     self.line_edit_device.setValidator(validators.DeviceNameValidator())
     self.line_edit_url.setValidator(
         validators.BackendOrganizationAddrValidator())
     self.claim_thread = None
     self.cancel_scope = None
     self.trio_portal = None
     self.claim_queue = queue.Queue(1)
    def __init__(self, core, jobs_ctx, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setupUi(self)
        self.core = core
        self.dialog = None
        self.jobs_ctx = jobs_ctx
        self.registration_job = None
        self.widget_registration.hide()
        self.button_register.clicked.connect(self.register_user)
        self.button_copy_username.clicked.connect(
            self.copy_field(self.button_copy_username, self.line_edit_user))
        self.button_copy_token.clicked.connect(
            self.copy_field(self.button_copy_token, self.line_edit_token))
        self.button_copy_url.clicked.connect(
            self.copy_field(self.button_copy_url, self.line_edit_url))
        self.button_copy_username.apply_style()
        self.button_copy_token.apply_style()
        self.button_copy_url.apply_style()

        self.registration_success.connect(self.on_registration_success)
        self.registration_error.connect(self.on_registration_error)
        self.line_edit_username.setValidator(validators.UserIDValidator())