aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/gcode_macro.py
Commit message (Collapse)AuthorAgeFilesLines
* gcode_macro: Catch variable encoding errorsJustin Schuh2023-04-191-8/+11
| | | | | | Catch parsing and json encoding errors at variable assignment. Signed-off-by: Justin Schuh <code@justinschuh.com>
* gcode_macro: Add "rawparams" pseudo-variablePedro Lamas2021-11-191-0/+1
| | | | Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
* gcode_macro: fix reference issues to the variables attribute (#4925)Eric Callahan2021-11-191-1/+3
| | | | | | | Create a copy of the dictionary prior to updating the the variable field. This fixes an issue where webhooks holds a reference to the variables dict returned by get_status(). Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode_macro: Remove support for deprecated featuresKevin O'Connor2021-11-021-13/+2
| | | | | | | Remove support for default_parameter_xxx config options. Remove support for direct access to command parameters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Add support for reporting deprecated optionsKevin O'Connor2021-09-161-2/+4
| | | | | | | Add a new printer.configfile.warnings with a list of config features that are deprecated. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: add description property (#4317)Alex Zellner2021-05-261-1/+1
| | | Signed-off-by: Alex Zellner <alexander.zellner@googlemail.com>
* gcode_macro: Disallow whitespace in macro name (#4312)Florian Heilmann2021-05-261-0/+4
| | | Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
* gcode_macro: Use deepcopy() on get_status() resultsKevin O'Connor2021-01-201-5/+4
| | | | | | | | | If a get_status() method returns a mutable object (such as a list or dict) then it would be possible for a gcode command template to incorrectly alter the program's internal state. Perform a deepcopy() operation on all get_status() return results to avoid that. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: implement "action_call_remote_method" context actionArksine2020-11-041-0/+8
| | | | | | Users may use this action to call methods registered by a webhooks client from a command template. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* gcode: Remove "action_" commands from get_status() callsKevin O'Connor2020-08-201-4/+19
| | | | | | | | | | | | Rename printer.gcode.action_emergency_stop() to action_emergency_stop(), printer.gcode.action_respond_info() to action_respond_info(), and printer.gcode.action_respond_error() to action_raise_error() in command templates. This simplifies the get_status() interface, as returning callable functions from that interface was confusing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename try_load_module() to load_object()Kevin O'Connor2020-05-081-1/+1
| | | | | | | | Rename try_load_module() so that it uses consistent naming for "printer objects". Change the function to raise an error by default if the specified module does not exist. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-7/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Create new wrapper class for gcode command parametersKevin O'Connor2020-05-051-3/+3
| | | | | | | | Instead of passing a dictionary to the command handlers, create a wrapper class and pass that class to the command handlers. This can simplify the command handler code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Support overriding of builtin g-code commandsKevin O'Connor2020-02-121-2/+23
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: add iterator to status wrapperJanar Sööt2019-07-011-0/+4
| | | | | | It really helps to see a snapshot of available printer variables when building menus and macros. The list of variables always depends on what printer config you have. Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* gcode_macro: Parse variable_X parameters using ast.literal_eval()Kevin O'Connor2019-06-071-4/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Add a default parameter to load_templateKevin O'Connor2019-06-071-3/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Add support "x in printer" to templatesKevin O'Connor2019-06-041-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Add support for SET_GCODE_VARIABLE commandKevin O'Connor2019-06-041-1/+22
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Rename "status" helper to "printer"Kevin O'Connor2019-06-041-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Evaluate macros using Jinja2 template engineKevin O'Connor2019-04-041-14/+79
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Raise a config error on invalid register_command()Kevin O'Connor2019-02-181-5/+1
| | | | | | | Raise a printer.config_error() on an invalid register_command() call. This error is easier to handle for the vast majority of callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Provide more information on a formatting errorKevin O'Connor2018-09-301-3/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: default parameter valuesJanar Sööt2018-09-301-1/+7
| | | | | Signed-off-by: Janar Sööt <janar.soot@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: 2 lines wrapped at 80 charsJanar Sööt2018-09-261-2/+4
| | | | Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* gcode_macro: macro improvement with parametersJanar Sööt2018-09-261-1/+9
| | | | Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* gcode: Rename run_script() to run_script_from_command()Kevin O'Connor2018-06-301-1/+1
| | | | | | | Emphasize that the run_script() method is only valid when run from a g-code command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode_macro: Add the ability to define custom g-code macrosKevin O'Connor2018-05-251-0/+29
Add the ability to add a custom g-code command that in turn executes one or more configured g-code commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>