def __init__(self, jobs_ctx, greeter): super().__init__() self.setupUi(self) self.jobs_ctx = jobs_ctx self.greeter = greeter self.get_requests_job = None self.create_user_job = None self.widget_info.hide() self.label_waiting.show() self.line_edit_user_full_name.validity_changed.connect(self.check_infos) self.line_edit_user_full_name.set_validator(validators.NotEmptyValidator()) self.line_edit_user_email.validity_changed.connect(self.check_infos) self.line_edit_user_email.set_validator(validators.EmailValidator()) self.line_edit_device.validity_changed.connect(self.check_infos) self.line_edit_device.set_validator(validators.DeviceNameValidator()) # self.combo_profile.addItem(_("TEXT_USER_PROFILE_OUTSIDER"), UserProfile.OUTSIDER) self.combo_profile.addItem(_("TEXT_USER_PROFILE_STANDARD"), UserProfile.STANDARD) self.combo_profile.addItem(_("TEXT_USER_PROFILE_ADMIN"), UserProfile.ADMIN) self.combo_profile.setCurrentIndex(0) self.get_requests_success.connect(self._on_get_requests_success) self.get_requests_error.connect(self._on_get_requests_error) self.create_user_success.connect(self._on_create_user_success) self.create_user_error.connect(self._on_create_user_error) self.button_create_user.clicked.connect(self._on_create_user_clicked) self.get_requests_job = self.jobs_ctx.submit_job( ThreadSafeQtSignal(self, "get_requests_success", QtToTrioJob), ThreadSafeQtSignal(self, "get_requests_error", QtToTrioJob), self.greeter.get_claim_requests, )
def __init__(self, jobs_ctx, claimer, user_email): super().__init__() self.setupUi(self) self.jobs_ctx = jobs_ctx self.claimer = claimer self.claim_job = None self.new_device = None self.line_edit_user_full_name.setFocus() self.line_edit_user_full_name.set_validator( validators.NotEmptyValidator()) self.line_edit_user_full_name.validity_changed.connect( self.check_infos) self.line_edit_user_email.setText(user_email) self.line_edit_user_email.set_validator(validators.EmailValidator()) self.line_edit_user_email.validity_changed.connect(self.check_infos) self.line_edit_device.setText(get_default_device()) self.line_edit_device.set_validator(validators.DeviceLabelValidator()) self.line_edit_device.validity_changed.connect(self.check_infos) self.claim_success.connect(self._on_claim_success) self.claim_error.connect(self._on_claim_error) self.label_wait.hide() self.button_ok.clicked.connect(self._on_claim_clicked) self.check_infos()
def __init__(self, jobs_ctx, greeter, user_profile_outsider_allowed=False): super().__init__() self.setupUi(self) self.jobs_ctx = jobs_ctx self.greeter = greeter self.get_requests_job = None self.create_user_job = None self.widget_info.hide() self.label_waiting.show() self.line_edit_user_full_name.validity_changed.connect( self.check_infos) self.line_edit_user_full_name.set_validator( validators.NotEmptyValidator()) self.line_edit_user_email.validity_changed.connect(self.check_infos) self.line_edit_user_email.set_validator(validators.EmailValidator()) self.line_edit_device.validity_changed.connect(self.check_infos) self.line_edit_device.set_validator(validators.DeviceLabelValidator()) self.combo_profile.currentIndexChanged.connect(self.check_infos) self.combo_profile.addItem(_("TEXT_SELECT_USER_PROFILE"), None) self.combo_profile.addItem(_("TEXT_USER_PROFILE_OUTSIDER"), UserProfile.OUTSIDER) self.combo_profile.addItem(_("TEXT_USER_PROFILE_STANDARD"), UserProfile.STANDARD) self.combo_profile.addItem(_("TEXT_USER_PROFILE_ADMIN"), UserProfile.ADMIN) item = self.combo_profile.model().item(2) item.setToolTip(_("TEXT_USER_PROFILE_STANDARD_TOOLTIP")) item = self.combo_profile.model().item(3) item.setToolTip(_("TEXT_USER_PROFILE_ADMIN_TOOLTIP")) if not user_profile_outsider_allowed: item = self.combo_profile.model().item(1) item.setEnabled(False) item.setToolTip(_("NOT_ALLOWED_OUTSIDER_PROFILE_TOOLTIP")) else: item = self.combo_profile.model().item(1) item.setToolTip(_("TEXT_USER_PROFILE_OUTSIDER_TOOLTIP")) # No profile by default, forcing the greeter to choose one self.combo_profile.setCurrentIndex(0) self.get_requests_success.connect(self._on_get_requests_success) self.get_requests_error.connect(self._on_get_requests_error) self.create_user_success.connect(self._on_create_user_success) self.create_user_error.connect(self._on_create_user_error) self.button_create_user.clicked.connect(self._on_create_user_clicked) self.get_requests_job = self.jobs_ctx.submit_job( self.get_requests_success, self.get_requests_error, self.greeter.get_claim_requests)
def __init__(self, pending, user_profile_outsider_allowed=False): super().__init__() self.setupUi(self) self.label_waiting.hide() self.line_edit_user_full_name.validity_changed.connect( self.check_infos) self.line_edit_user_full_name.set_validator( validators.NotEmptyValidator()) self.line_edit_user_email.validity_changed.connect(self.check_infos) self.line_edit_user_email.set_validator(validators.EmailValidator()) self.line_edit_device.validity_changed.connect(self.check_infos) self.line_edit_device.set_validator(validators.DeviceLabelValidator()) self.combo_profile.currentIndexChanged.connect(self.check_infos) self.line_edit_user_full_name.setText( pending.submitter_x509_certificate.subject_common_name) self.line_edit_user_email.setText( pending.submitter_x509_certificate.subject_email_address) self.line_edit_device.setText( pending.submit_payload.requested_device_label.str) self.combo_profile.addItem(translate("TEXT_SELECT_USER_PROFILE"), None) self.combo_profile.addItem(translate("TEXT_USER_PROFILE_OUTSIDER"), UserProfile.OUTSIDER) self.combo_profile.addItem(translate("TEXT_USER_PROFILE_STANDARD"), UserProfile.STANDARD) self.combo_profile.addItem(translate("TEXT_USER_PROFILE_ADMIN"), UserProfile.ADMIN) item = self.combo_profile.model().item(2) item.setToolTip(translate("TEXT_USER_PROFILE_STANDARD_TOOLTIP")) item = self.combo_profile.model().item(3) item.setToolTip(translate("TEXT_USER_PROFILE_ADMIN_TOOLTIP")) if not user_profile_outsider_allowed: item = self.combo_profile.model().item(1) item.setEnabled(False) item.setToolTip(translate("NOT_ALLOWED_OUTSIDER_PROFILE_TOOLTIP")) else: item = self.combo_profile.model().item(1) item.setToolTip(translate("TEXT_USER_PROFILE_OUTSIDER_TOOLTIP")) # No profile by default, forcing the greeter to choose one self.combo_profile.setCurrentIndex(0) self.button_create_user.clicked.connect(self._on_create_user_clicked)