-
Notifications
You must be signed in to change notification settings - Fork 80
Added extra functionality to FloatEdit #3889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Tested manually with |
t20100
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a bit of duplicated code between AdvancedDoubleValidator and AdvancedDoublePintValidator. If possible that'd be best to share it.
Also why providing 2 classes (e.g., DoubleValidator and AdvancedDoubleValidator) rather than only the advanced one which by default provides what the default one does?
| def keyPressEvent(self, event: qt.QEvent): | ||
| result = super(FloatEdit, self).keyPressEvent(event) | ||
| if event.isAccepted(): | ||
| self.__wasModified = True | ||
| return result | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to be useless (__wasModified is never used)
| def keyPressEvent(self, event: qt.QEvent): | |
| result = super(FloatEdit, self).keyPressEvent(event) | |
| if event.isAccepted(): | |
| self.__wasModified = True | |
| return result |
| """ | ||
| self.__allowEmpty = allow | ||
|
|
||
| def setIncludedBound(self, minBoundIncluded: bool, maxBoundIncluded: bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a getter
| self.__allowEmpty = False | ||
| self.__boundIncluded = True, True | ||
|
|
||
| def setAllowEmpty(self, allow: bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a getter
| """ | ||
| self.__allowEmpty = allow | ||
|
|
||
| def setIncludedBound(self, minBoundIncluded: bool, maxBoundIncluded: bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a getter
| self.__allowEmpty: bool = False | ||
| self.__boundIncluded: Tuple[bool, bool] = (True, True) | ||
|
|
||
| def setAllowEmpty(self, allow: bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a getter
| inputText = inputText[0:pos] + locale.decimalPoint() + inputText[pos:] | ||
| pos = pos + 1 | ||
|
|
||
| print(pos, inputText, inputText[pos - 1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| print(pos, inputText, inputText[pos - 1]) |
| from silx.gui import qt | ||
|
|
||
|
|
||
| class CustomValidator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use a name with more meaning, e.g. ConverterValidatorMixIn
Closes #3888
This PR mostly provides extra validators that i have designed during the years.
It allows configurable behaviours like:
None.from the inputThis PR also add some tests to the
FloatEdit.Changelog:
FloatEditwidget