diff --git a/docs/Configuration.md b/docs/Configuration.md index f6eb31de..8a6d23b7 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -20,7 +20,7 @@ Write in the file only the options that need to be changed, and restart KlipperS ## Main Options -The options listed here are not changeable from within the ui. +The options listed here are not editable from within the user interface. ```{ .ini .no-copy } [main] @@ -37,7 +37,7 @@ The options listed here are not changeable from within the ui. # If multiple printers are defined, this can be set the name of the one to show at startup. # default_printer: MyPrinter -# To define a full set of custom menues (instead of merging user entries with default entries) +# To define a full set of custom menus (instead of merging user entries with default entries) # set this to False. See Menu section below. # use_default_menu: True @@ -106,6 +106,9 @@ moonraker_port: 7125 # extrude_distances: 5, 10, 15, 25 # extrude_speeds: 1, 2, 5, 25 +# Define distances for the move panel. comma-separated list with 2 to 7 floats and/or integers +# move_distances: 0.1, 0.5, 1, 5, 10, 25, 50 + # Camera needs to be configured in moonraker: # https://moonraker.readthedocs.io/en/latest/configuration/#webcam ``` diff --git a/ks_includes/config.py b/ks_includes/config.py index 01c3c948..766d92a5 100644 --- a/ks_includes/config.py +++ b/ks_includes/config.py @@ -173,7 +173,7 @@ class KlipperScreenConfig: strs = ( 'moonraker_api_key', 'moonraker_host', 'titlebar_name_type', 'screw_positions', 'power_devices', 'titlebar_items', 'z_babystep_values', - 'extrude_distances', "extrude_speeds", + 'extrude_distances', 'extrude_speeds', 'move_distances', ) numbers = ( 'moonraker_port', 'move_speed_xy', 'move_speed_z', 'screw_rotation', diff --git a/panels/move.py b/panels/move.py index 89091656..02b72e16 100644 --- a/panels/move.py +++ b/panels/move.py @@ -1,3 +1,4 @@ +import re import logging import gi @@ -13,6 +14,15 @@ class Panel(ScreenPanel): def __init__(self, screen, title): super().__init__(screen, title) + + if self.ks_printer_cfg is not None: + dis = self.ks_printer_cfg.get("move_distances", '0.1, 0.5, 1, 50, 10, 25, 50') + if re.match(r'^[0-9,\.\s]+$', dis): + dis = [str(i.strip()) for i in dis.split(',')] + if 1 < len(dis) <= 7 and len(dis) >= 2: + self.distances = dis + self.distance = self.distances[-2] + self.settings = {} self.menu = ['move_menu'] self.buttons = {