FIX: Allow the user to set the range of PyDMSpinbox, instead of always taking it from the channel #935
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #903
Context
The PyDMSpinBox will always set the maximum and minimum values to display based on the HOPR/LOPR fields of the PV. This happens even if the user tries to set their own limits. And in the case HOPR/LOPR are not defined then it will set minimum and maximum both to zero so that the spinbox cannot display anything other than zero.
As an example, connect a spinbox to MTEST:XPos from the testing ioc and try to use it.
Fix
This will fix the issue by adding the option to set user-defined limits and use those instead of the ones received from the channel. The default options remains to use the ones from the channel so as to not impact existing uses of the spinbox.
Testing
Tested with some local examples, modified the existing spin box test for updating limits, added a new one for the new code.