BF/ENH: Replace buggy template finding code for loops/form/counterbalance#6514
Merged
TEParsons merged 3 commits intopsychopy:devfrom Jun 3, 2024
Merged
BF/ENH: Replace buggy template finding code for loops/form/counterbalance#6514TEParsons merged 3 commits intopsychopy:devfrom
TEParsons merged 3 commits intopsychopy:devfrom
Conversation
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.
As identified in #6501, the xltx files for various templates weren't always being found.
We've gone back and forth fixing for one case & breaking for another with this, so this PR does away with the current system of "we climb the parent tree of the control until we find something with a reference to the Component/Routine/loop then check that name against an internal dict" as that method was prone to failure when using the control in a different context.
Instead, I just supply the path to the template in the Param. This is both less buggy and easier to understand for contributors - plus it makes it possible to add a new Excel template with a plugin rather than having to edit the base PsychoPy code.
To avoid cluttering the Param class too much, I've called the new attribute
ctrlParams(i.e. "parameters controlling how the control looks") so that we can use the same attribute for other UI specific stuff.The attached file contains one of each thing which uses the Excel templates, and also a loop containing a valid file link. Clicking on the Excel button for each of them seems to do the correct thing in this branch:
testXltFind.zip