In a most widget files is not is used to check the error against an empty string (''). This doesn't work all the time to my knowledge, so it is best to replace it with "!=", which is an equality check.
Example
Before:
def syncUiState(self, state: FormField): # type: ignore
self.widget.setValue(state['value']) # type: ignore
self.error.SetLabel(state['error'] or '')
self.error.Show(state['error'] is not None and state['error'] is not '')
After:
def syncUiState(self, state: FormField): # type: ignore
self.widget.setValue(state['value']) # type: ignore
self.error.SetLabel(state['error'] or '')
self.error.Show(state['error'] is not None and state['error'] != '')
# --------------------------------------------------------------^^----
Checklist:
[x] You're opening this PR against the current release branch
[x] Works on both Python 2.7 & Python 3.x
[ ] Commits have been squashed and includes the relevant issue number
Squashing is not necessary (only one commit) and there is no relevant issue.
[x] Pull request description contains link to relevant issue or detailed notes on changes
[x] This must include example code demonstrating your feature or the bug being fixed
[x] All existing tests pass
[ ] Your bug fix / feature has associated test coverage
In a most widget files
is not
is used to check the error against an empty string (''
). This doesn't work all the time to my knowledge, so it is best to replace it with "!=", which is an equality check.Example
Before:
After:
Checklist:
[ ] Commits have been squashed and includes the relevant issue number
Squashing is not necessary (only one commit) and there is no relevant issue.
N/A
N/A