From b6199a4f24beb02dc0f8956f60c88e3ba3468927 Mon Sep 17 00:00:00 2001 From: alfrix Date: Sun, 8 Oct 2023 11:51:48 -0300 Subject: [PATCH] config: deprecate old configs --- ks_includes/config.py | 16 ++++++---------- panels/bed_level.py | 4 +--- panels/zcalibrate.py | 4 ---- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ks_includes/config.py b/ks_includes/config.py index 04effa8d..4056016b 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", "camera_url", "spoolman", + 'extrude_distances', "extrude_speeds", ) numbers = ( 'moonraker_port', 'move_speed_xy', 'move_speed_z', @@ -184,17 +184,10 @@ class KlipperScreenConfig: numbers = [f'{option}' for option in config[section] if option != 'gcode'] elif section.startswith('menu '): strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style') - elif section == 'bed_screws': - # This section may be deprecated in favor of moving this options under the printer section - numbers = ('rotation', '') - strs = ('screw_positions', '') elif section.startswith('graph')\ or section.startswith('displayed_macros')\ or section.startswith('spoolman'): bools = [f'{option}' for option in config[section]] - elif section.startswith('z_calibrate_position'): - # This section may be deprecated in favor of moving this options under the printer section - numbers = ('calibrate_x_position', 'calibrate_y_position') else: self.errors.append(f'Section [{section}] not recognized') @@ -202,8 +195,11 @@ class KlipperScreenConfig: if key not in bools and key not in strs and key not in numbers: msg = f'Option "{key}" not recognized for section "[{section}]"' if key == "camera_url": - msg = "camera_url has been deprecated in favor of moonraker cameras" - msg += "\n\n https://moonraker.readthedocs.io/en/latest/configuration/#webcam" + msg = ( + "camera_url has been deprecated in favor of moonraker cameras\n\n" + + "https://moonraker.readthedocs.io/en/latest/configuration/#webcam\n\n" + + "remove camera_url from KlipperScreen config file" + ) if remove: # This should only be called for the auto-generated section self.config.remove_option(section, key) diff --git a/panels/bed_level.py b/panels/bed_level.py index 1bd5fd0f..12e84623 100644 --- a/panels/bed_level.py +++ b/panels/bed_level.py @@ -80,9 +80,7 @@ class Panel(ScreenPanel): self.screws = new_screws logging.info(f"screws with offset: {self.screws}") - elif "bed_screws" in self._printer.get_config_section_list(): - self.screws = self._get_screws("bed_screws") - logging.info(f"bed_screws: {self.screws}") + nscrews = len(self.screws) # KS config valid_positions = True diff --git a/panels/zcalibrate.py b/panels/zcalibrate.py index f5146b3a..ce5a1bbc 100644 --- a/panels/zcalibrate.py +++ b/panels/zcalibrate.py @@ -147,10 +147,6 @@ class Panel(ScreenPanel): if self.ks_printer_cfg is not None: x_position = self.ks_printer_cfg.getfloat("calibrate_x_position", None) y_position = self.ks_printer_cfg.getfloat("calibrate_y_position", None) - elif 'z_calibrate_position' in self._config.get_config(): - # OLD global way, this should be deprecated - x_position = self._config.get_config()['z_calibrate_position'].getfloat("calibrate_x_position", None) - y_position = self._config.get_config()['z_calibrate_position'].getfloat("calibrate_y_position", None) if self.probe: if "sample_retract_dist" in self.probe: