Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionPrompts: More flexibility for selection_command #3287

Merged
merged 3 commits into from Oct 8, 2019

Conversation

FHeilmann
Copy link
Contributor

@FHeilmann FHeilmann commented Sep 25, 2019

  • Your changes are not possible to do through a plugin and relevant
    to a large audience (ideally all users of OctoPrint)
  • If your changes are large or otherwise disruptive: You have
    made sure your changes don't interfere with current development by
    talking it through with the maintainers, e.g. through a
    Brainstorming ticket
  • Your PR targets OctoPrint's devel branch if it's a completely
    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)
  • Your PR was opened from a custom branch on your repository
    (no PRs from your version of master, maintenance or devel please),
    e.g. dev/my_new_feature or fix/my_bugfix
  • Your PR only contains relevant changes: no unrelated files,
    no dead code, ideally only one commit - rebase and squash your PR
    if necessary!
  • Your changes follow the existing coding style
  • If your changes include style sheets: You have modified the
    .less source files, not the .css files (those are generated with
    lessc)
  • You have tested your changes (please state how!) - ideally you
    have added unit tests
  • You have run the existing unit tests against your changes and
    nothing broke
  • You have added yourself to the AUTHORS.md file :)

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 of HANDLE_PROMPT_RETURN CHOICE={choice} to call one of my klipper macros. Unfortunately, Octoprint simply appends S{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 and HANDLE_PROMPT_RETURN CHOICE={choice} as value for selection_command . Both variants yield the expected result

I 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

Allow users to control how and where the choice is inserted into the response by explicitly including "{choice}" in the selection_command
@FHeilmann FHeilmann changed the title Patch 2 ActionPrompts: More flexibility for selection_command Sep 25, 2019
@foosel foosel merged commit e20a992 into OctoPrint:maintenance Oct 8, 2019
@foosel
Copy link
Member

foosel commented Oct 8, 2019

👍

@foosel foosel added this to the 1.4.0 milestone Nov 13, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants