ActionPrompts: More flexibility for selection_command #3287
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.
to a large audience (ideally all users of OctoPrint)
made sure your changes don't interfere with current development by
talking it through with the maintainers, e.g. through a
Brainstorming ticket
new feature, or maintenance if it's a bug fix or improvement of
existing functionality for the current stable version (no PRs
against master or anything else please)
(no PRs from your version of master, maintenance or devel please),
e.g. dev/my_new_feature or fix/my_bugfix
no dead code, ideally only one commit - rebase and squash your PR
if necessary!
.less source files, not the .css files (those are generated with
lessc)
have added unit tests
nothing broke
What does this PR do and why is it necessary?
I'm currently playing with klipper and octoprints action prompts and ran into the following issue:
I wanted to have a custom
selection_command
in the shape ofHANDLE_PROMPT_RETURN CHOICE={choice}
to call one of my klipper macros. Unfortunately, Octoprint simply appendsS{choice}
to whatever you put into the settings/config.yaml, so my command would end up looking like this:HANDLE_PROMPT_RETURN CHOICE={choice} S0
This PR changes how the action prompt plugin forms the command, by checking if the user put
{choice}
into the respective configuration himself. If that is the case, it simply replaces{choice}
with the choice. Otherwise, it behaves as it previously has.How was it tested? How can it be tested by the reviewer?
Tested with both
M867
andHANDLE_PROMPT_RETURN CHOICE={choice}
as value forselection_command
. Both variants yield the expected resultI didn't want to fiddle with my octoprint pi too bad so I jerry-rigged it into the Octopi install (which may give me more trouble in the future I admit). Therefore I have not run the test suite against this.
Hope this PR is appropriate
-Florian