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

Method _adjust_validators

pyxrf/gui_module/useful_widgets.py:705–725  ·  view source on GitHub ↗

Set the range for validators based on full range and the selected range.

(self)

Source from the content-addressed store, hash-verified

703 self._range_min_diff = 1
704
705 def _adjust_validators(self):
706 """Set the range for validators based on full range and the selected range."""
707 if self._value_type == "float":
708 # Validator type: QDoubleValidator
709 # The range is set a little wider (1% wider) in order to cover the 'true'
710 # boundary value. 'decimals=-1' - it seems that the precision is getting ignored.
711 self.validator_low.setRange(
712 self._round_value(self._range_low),
713 self._round_value(self._value_high - self._range_min_diff * 0.99),
714 decimals=-1,
715 )
716 self.validator_high.setRange(
717 self._round_value(self._value_low + self._range_min_diff * 0.99),
718 self._round_value(self._range_high),
719 decimals=-1,
720 )
721 else:
722 # Validator type: QIntValidator
723 # With integer arithmetic we can set the range precisely
724 self.validator_low.setRange(round(self._range_low), round(self._value_high - self._range_min_diff))
725 self.validator_high.setRange(round(self._value_low + self._range_min_diff), round(self._range_high))
726
727 def setAlignment(self, flags):
728 """

Callers 1

set_selectionMethod · 0.95

Calls 1

_round_valueMethod · 0.95

Tested by

no test coverage detected