MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / DoubleValidatorStrict

Class DoubleValidatorStrict

pyxrf/gui_module/useful_widgets.py:437–449  ·  view source on GitHub ↗

`DoubleValidatorStrict` verifies additional condition: double number can not contain commas, since it can't be converted to floating point number directly.

Source from the content-addressed store, hash-verified

435
436
437class DoubleValidatorStrict(DoubleValidator):
438 """
439 `DoubleValidatorStrict` verifies additional condition: double number can not
440 contain commas, since it can't be converted to floating point number directly.
441 """
442
443 def validate(self, text, pos):
444 result = super().validate(text, pos)
445 # Additional condition: the number can not contain ",". For some reason
446 # the standard validators ignore commas at the end of the number.
447 if "," in text[pos:]:
448 result = (QDoubleValidator.Invalid, result[1], result[2])
449 return result
450
451
452class DoubleValidatorRelaxed(DoubleValidatorStrict):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected