Skip to content

BF/ENH: Replace buggy template finding code for loops/form/counterbalance#6514

Merged
TEParsons merged 3 commits intopsychopy:devfrom
TEParsons:dev-bf-xlt-finding
Jun 3, 2024
Merged

BF/ENH: Replace buggy template finding code for loops/form/counterbalance#6514
TEParsons merged 3 commits intopsychopy:devfrom
TEParsons:dev-bf-xlt-finding

Conversation

@TEParsons
Copy link
Contributor

@TEParsons TEParsons commented May 30, 2024

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

@TEParsons TEParsons requested a review from RebeccaHirst May 30, 2024 15:52
@TEParsons TEParsons requested a review from peircej May 31, 2024 15:57
@TEParsons TEParsons merged commit e10a110 into psychopy:dev Jun 3, 2024
@TEParsons TEParsons deleted the dev-bf-xlt-finding branch June 13, 2024 10:55
@peircej peircej added 🐞 bug Issue describes a bug (crash or error) or undefined behavior. 🌟 enhancement Proposed improvement or feature request. labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Issue describes a bug (crash or error) or undefined behavior. 🌟 enhancement Proposed improvement or feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants