def __init__(self, validators=None): self.default_validators = [ IntegerValidator(min_value=128, max_value=1024) ] self.all_validators = self.default_validators if isinstance(validators, list) and validators: self.all_validators = self.default_validators + validators
def __init__(self): super().__init__() self.ui = uic.loadUi('mainwin.ui', self) n_validator = NaturalValidator() z_validator = IntegerValidator() q_validator = RationalValidator() p_validator = PolynomValidator() self.line_n_n1.setValidator(n_validator) self.line_n_n2.setValidator(n_validator) self.line_n_k.setValidator(n_validator) self.line_z_z1.setValidator(z_validator) self.line_z_z2.setValidator(z_validator) self.line_q_q1.setValidator(q_validator) self.line_q_q2.setValidator(q_validator) self.line_q_z.setValidator(z_validator) self.line_p_p1.setValidator(p_validator) self.line_p_p2.setValidator(p_validator) self.line_p_q.setValidator(q_validator) self.line_p_k.setValidator(n_validator)
def __init__(self, name, window_manager): path = os.path.join(os.path.dirname(__file__), 'preparation.ui') super(PreparationTab, self).__init__(name, path, window_manager) self.setup_file_selectors() self.setup_radio_buttons() self.setup_objects_list() self.ligandChargeEdit.setValidator(QtGui.QIntValidator()) self.ligandChargeEdit.set_validator(IntegerValidator('Ligand charge')) self.ligandNameEdit.set_validator(NotEmptyValidator('Ligand name')) self.systemNameEdit.set_validator(NotEmptyValidator('System name'))
def is_valid(self, value): return all(IntegerValidator.is_valid(value) for IntegerValidator in self.all_validators)
def __init__(self, validators=None): self.default_validator = [IntegerValidator(128, 1024)] self.all_validators = self.default_validator if isinstance(validators, list) and validators: self.all_validators += validators super().__init__()
def validate(self): for rule, value in self.rules: IntegerValidator.__call__(rule, value)
def __init__(self, validators=None, *args, **kwargs): super().__init__(*args, **kwargs) self.default = [IntegerValidator(min_value=128, max_value=1024)] self.all_validators = self.default if isinstance(validators, list) and validators: self.all_validators += validators