Enhance testing for creating parameters from saved states#2319
Merged
j9ac9k merged 4 commits intopyqtgraph:masterfrom Sep 14, 2022
Merged
Enhance testing for creating parameters from saved states#2319j9ac9k merged 4 commits intopyqtgraph:masterfrom
j9ac9k merged 4 commits intopyqtgraph:masterfrom
Conversation
3b7a8d3 to
7c21f05
Compare
Revealed bug in Calendar item when no initial value was set, so that was changed too
- Previously, no code checked for proper conditions to enable the default button for a checklist. Note that this implementation still doesn't define behavior for comparing to default when changing exclusive from "false" to "true" - When a button changes param to default, all, or none selected, make sure this isn't overridden by a pending proxy signal from child changes
When set to "exclusive", the comparison logic failed to set only one parameter to "True"!
7c21f05 to
21fde92
Compare
j9ac9k
reviewed
Jun 5, 2022
| created = _buildParamTypes.makeAllParamTypes() | ||
| state = created.saveState() | ||
| created2 = pt.Parameter.create(**state) | ||
| assert pg.eq(state, created2.saveState()) No newline at end of file |
j9ac9k
reviewed
Jun 5, 2022
| state = super().saveState(filter) | ||
| fmt = self._interpretFormat() | ||
| state['value'] = state['value'].toString(fmt) | ||
| if state['value'] is not None: |
Member
There was a problem hiding this comment.
under what conditions would this be None? Also is there a case where the key value would be missing and we should use state.get('value') instead?
Contributor
Author
There was a problem hiding this comment.
value is guaranteed to exist in the state and is None if nothing is initially specified.
I see two easy options for a better initial value if the user doesn't specify anything:
QDate()would give a null/invalid (but date-like) valueQDate.currentDate()is what the calendar widget's selected day defaults to. I'd lean toward this one since it's intuitive based on the calendar being displayed. Of course, a minor downside is potentially non-reproducible results overtime due to a changing default value.
Member
There was a problem hiding this comment.
I think QDate.currentDate() is a pretty good default, but I think changing this might be a bit out of scope for this PR.
Member
|
Going to close/re-open to trigger a new CI test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Before this PR, parameters like e.g. checklist would save states that couldn't reproduce their parameter layout. Fix this for the specific fail types of checklist and calendar while ensuring all other parameter types can successfully recreate themselves.
During testing, a few other issues with checklists came up and were resolved, so the branch name is a bit of a misnomer now
exclusivechecklists now propagate changing values correctlyClear All,Select All, and default buttons now force changes even when there is a pending proxy signal