aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/configfile.py
Commit message (Collapse)AuthorAgeFilesLines
* configfile: Expose options awaiting to be saved (#5270)Kurt Haenen2022-06-201-3/+22
| | | | | | | Adds a save_config_pending_items to the status reported by configfile reflecting the items and values that a future SAVE_CONFIG would actually persist. Signed-off-by: Kurt Haenen <kurt.haenen@gmail.com>
* configfile: Use Python2's ConfigParser when running on Python2Kevin O'Connor2021-10-091-4/+6
| | | | | | | | | The backport of Python3's configparser causes issues when there is unicode characters in the config file. To avoid introducing new errors, go back to using the Python2 version of ConfigParser when running on Python2. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Workaround for non-ascii comments on Python2Kevin O'Connor2021-10-081-1/+2
| | | | | | | | Explicitly specify the comment_prefixes as regular Python2 strings - otherwise the configparser wont ignore non-ascii characters in comments. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Ignore trailing comments starting with a semicolonKevin O'Connor2021-10-061-1/+2
| | | | | | | | Newer versions of configparser no longer default to ignoring trailing comments that start with a semicolon. Add that setting explicitly to avoid breaking existing config files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Add Python2 module wrappers and use Python3 module namingKevin O'Connor2021-10-041-4/+4
| | | | | | | Add wrappers for some common Python modules so that the code can run on both Python2 and Python3. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Convert to Python3 string encodingKevin O'Connor2021-10-011-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Add support for reporting deprecated optionsKevin O'Connor2021-09-161-0/+26
| | | | | | | Add a new printer.configfile.warnings with a list of config features that are deprecated. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Setup get_status() results after check_unused_options()Kevin O'Connor2021-09-161-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Support config.getchoice() with integer keysKevin O'Connor2021-08-251-1/+4
| | | | | | | | If the choice mapping uses integer keys then lookup the config option using self.getint(). This simplifies the callers and improves the encoding of the printer.configfile.settings export. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Add helpers for parsing list of parameters from the configKevin O'Connor2021-08-211-0/+28
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Add printer.configfile.settings command template parameterKevin O'Connor2021-01-201-7/+16
| | | | | | | Make available the parsed value (or default value) for config options to command templates and to the api server. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Improve error message when a required option is missingKevin O'Connor2020-12-221-3/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Minor line wrapping changesKevin O'Connor2020-12-221-18/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: report "save_config_pending" via get_status() (#3372)Eric Callahan2020-09-281-1/+5
| | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* configfile: Use "import ConfigParser as configparser"Kevin O'Connor2020-06-151-5/+5
| | | | | | This minor change makes it easier to port the code to Python3. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Fix check for unused config sections and optionsKevin O'Connor2020-05-211-16/+21
| | | | | | | | Commit c3899cef inadvertently broke the error check for unused config options. Add a new note_valid parameter to the config access wrappers and use that in get_status() to fix the check. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Use new GCodeCommand wrappersKevin O'Connor2020-05-051-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Add get_status() to export raw config file informationKevin O'Connor2020-02-131-3/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta_calibrate: Move stable position conversion to its own classKevin O'Connor2020-01-061-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Fix the exception raised when an included file is missing (#1931)Julien Lirochon2019-09-011-1/+1
| | | Signed-off-by: Julien Lirochon <julien@lirochon.net>
* configfile: Add "include" support (#1359)lauckhart2019-03-221-14/+65
| | | | | | | | | Allows configuration files to include other configuration files using [include filename.cfg] syntax. Klippy loads include files in the position of the include header; subsequent definitions override included values. Supports wildcards (e.g. [include macros/*.cfg). Allows included files to include other files but blocks recursion. Signed-off-by: Greg Lauckhart <greg@lauckhart.com>
* configfile: Strip trailing commentsKevin O'Connor2018-10-161-0/+8
| | | | | | | The Python 2.x ConfigParser doesn't support stripping of trailing '#' style comments. Do that manually before parsing the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: add get_prefix_options methodJanar Sööt2018-09-301-0/+3
| | | | Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* configfile: Add support for rewriting the printer config fileKevin O'Connor2018-09-251-17/+148
| | | | | | | Add support for writing back the main printer config file with additional calibration data stored in it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* configfile: Move config file code from klippy.py to new fileKevin O'Connor2018-09-251-0/+116
Add a klippy/configfile.py file with the code needed to read the main printer config file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>