From 52a735347d6b156f89f31b009d20fc130dd2e2ba Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Wed, 17 Jan 2024 14:24:24 +0000 Subject: [PATCH 01/13] STEAPP-879: added get_status for support the placeholders --- klippy/extras/wizard/wizard_step.py | 15 +++++++++++++++ klippy/extras/wizard/wizard_step_button.py | 4 ++++ klippy/extras/wizard/wizard_step_jog.py | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/klippy/extras/wizard/wizard_step.py b/klippy/extras/wizard/wizard_step.py index 0d37fa8d6b73..65987b048dc9 100644 --- a/klippy/extras/wizard/wizard_step.py +++ b/klippy/extras/wizard/wizard_step.py @@ -7,6 +7,7 @@ def __init__(self, config): section_name = config.get_name().split() self.name = section_name[1].upper() self.in_script = False + self.loading = False # load objects self.printer = printer = config.get_printer() self.gcode_macro = printer.load_object(config, 'gcode_macro') @@ -19,12 +20,16 @@ def __init__(self, config): self.warning = config.get('warning', '') self.info = config.get('info', '') self.countdown = config.getint('countdown', 0) + self.placeholder = config.get('placeholder', '') # create template self.template_action = self.gcode_macro.load_template( config, 'action_gcode') self.template_cancel = self.gcode_macro.load_template( config, 'cancel_gcode') # register gcode commands + self.gcode.register_mux_command("WIZARD_STEP_CHANGE_STATE", 'STEP', + self.name, self.cmd_WIZARD_STEP_CHANGE_STATE, + desc=self.cmd_WIZARD_STEP_CHANGE_STATE_help) self.gcode.register_mux_command("EXECUTE_WIZARD_STEP", 'STEP', self.name, self.cmd_EXECUTE_WIZARD_STEP, desc=self.cmd_EXECUTE_WIZARD_STEP_help) @@ -32,6 +37,12 @@ def __init__(self, config): self.name, self.cmd_CANCEL_WIZARD_STEP, desc=self.cmd_CANCEL_WIZARD_STEP_help) + cmd_WIZARD_STEP_CHANGE_STATE_help = "change state for show the placeholder" + + def cmd_WIZARD_STEP_CHANGE_STATE(self, gcmd): + state = gcmd.get('LOADING', 0) + self.loading = True if state else False + cmd_EXECUTE_WIZARD_STEP_help = "Run gcode in the 'action_gcode' option" def cmd_EXECUTE_WIZARD_STEP(self, gcmd): @@ -62,6 +73,10 @@ def cmd(self, gcmd, gcode): finally: self.in_script = False + def get_status(self, eventtime): + return { + 'loading': self.loading, + 'placeholder': self.placeholder} def load_config_prefix(config): return WizardStep(config) diff --git a/klippy/extras/wizard/wizard_step_button.py b/klippy/extras/wizard/wizard_step_button.py index 6c76416fe19c..d6b938c2a0c7 100644 --- a/klippy/extras/wizard/wizard_step_button.py +++ b/klippy/extras/wizard/wizard_step_button.py @@ -41,6 +41,10 @@ def cmd_WIZARD_STEP_BUTTON(self, gcmd): finally: self.in_script = False + def get_status(self, eventtime): + status = WizardStep.get_status(self, eventtime) + return status + def load_config_prefix(config): return WizardStepButton(config) diff --git a/klippy/extras/wizard/wizard_step_jog.py b/klippy/extras/wizard/wizard_step_jog.py index 89498fcf3055..ae74364e9cca 100644 --- a/klippy/extras/wizard/wizard_step_jog.py +++ b/klippy/extras/wizard/wizard_step_jog.py @@ -57,7 +57,9 @@ def cmd_WIZARD_STEP_JOG(self, gcmd): self.in_script = False def get_status(self, eventtime): - return {'step': self.default_step} + status = WizardStep.get_status(self, eventtime) + status.update({'step': self.default_step}) + return status def load_config_prefix(config): From 04e88af7d7e7d51fed8a29c54deac8e98264a53a Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Wed, 17 Jan 2024 14:30:54 +0000 Subject: [PATCH 02/13] STEAPP-879: added get_status for support the placeholders --- stereotech_config/wizards/wizards.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stereotech_config/wizards/wizards.cfg b/stereotech_config/wizards/wizards.cfg index 50f03b071f3f..294b89e41fcb 100644 --- a/stereotech_config/wizards/wizards.cfg +++ b/stereotech_config/wizards/wizards.cfg @@ -49,9 +49,11 @@ description: description STEP_0 warning: warning STEP_0 countdown: 10 info: info about STSTEP_0 +placeholder: path/to/wizard/placeholder action_gcode: SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} {action_respond_info('-------------------start STEP_0')} + WIZARD_STEP_CHANGE_STATE STEP=STEP_0 LOADING=0 cancel_gcode: {action_respond_info('------------------CANCEL STEP_0')} RESET_WIZARD WIZARD={wizard.name} @@ -63,12 +65,14 @@ description: description STEP_BUTTON_1 warning: warning STEP_BUTTON_1 countdown: 20 info: info about STEP_BUTTON_1 +placeholder: path/to/wizard/placeholder button_button_1_gcode: {action_respond_info('-------------------button_button_1_gcode')} button_button2_gcode: {action_respond_info('-------------------button_button2_gcode')} action_gcode: {action_respond_info('-------------------action_gcode STEP_BUTTON_1')} + WIZARD_STEP_CHANGE_STATE STEP=STEP_BUTTON_1 LOADING=1 SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_BUTTON_1')} @@ -140,12 +144,14 @@ info: info about STEP_JOG_1 axes: x, y, z, a, c steps: 0.1, 1, 10, 20 default_step: 10 +placeholder: path/to/wizard/placeholder jog_gcode: {action_respond_info('-------------------jog_gcode STEP_JOG_1 (G1 %s%s, direction=%s)' % (axis|upper, step, direction))} action_gcode: {action_respond_info('-------------------action_gcode STEP_JOG_1')} SET_WIZARD_ENABLE WIZARD=CALIBRATE ENABLE=1 ERROR=error_message SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} + WIZARD_STEP_CHANGE_STATE STEP=STEP_JOG_1 LOADING=1 cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_JOG_1')} RESET_WIZARD WIZARD={wizard.name} From 71e85da7d06b2733b07a7ac327cead986fec986d Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Thu, 18 Jan 2024 06:32:06 +0000 Subject: [PATCH 03/13] STEAPP-877: added step the wizard_step_nozzle_offset --- docs/stereotech/error_list_guide.txt | 1 + .../wizard/wizard_step_nozzle_offset.py | 35 +++++++++++++ stereotech_config/wizards/wizards.cfg | 49 ++++++++++--------- 3 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 klippy/extras/wizard/wizard_step_nozzle_offset.py diff --git a/docs/stereotech/error_list_guide.txt b/docs/stereotech/error_list_guide.txt index ef1eadc4212d..18ef5638102f 100644 --- a/docs/stereotech/error_list_guide.txt +++ b/docs/stereotech/error_list_guide.txt @@ -123,6 +123,7 @@ config: 2058: error moved the axis:%s, the axis not availability 2059: Macro %s called recursively 2060: The button '%s' does not exist + 2061: Failure set value to step, value out of the range[0-%s] перефирия(mcu): 301: Timeout on wait for '%s' response diff --git a/klippy/extras/wizard/wizard_step_nozzle_offset.py b/klippy/extras/wizard/wizard_step_nozzle_offset.py new file mode 100644 index 000000000000..5746c20a9a75 --- /dev/null +++ b/klippy/extras/wizard/wizard_step_nozzle_offset.py @@ -0,0 +1,35 @@ +from wizard_step import WizardStep + + +class WizardStepNozzleOffset(WizardStep): + def __init__(self, config): + WizardStep.__init__(self, config) + # get options from config + self.step_x = self.step_y = config.getint('default_step', 7) + self.quantity_steps = config.getint('steps', 15) + self.step_value = config.getfloat('step_value', 0.1) + self.min_value = -config.getfloat('min_value', -0.7) + self.gcode.register_mux_command("WIZARD_STEP_NOZZLE_OFFSET", 'STEP', + self.name, self.cmd_WIZARD_STEP_NOZZLE_OFFSET, + desc=self.cmd_WIZARD_STEP_NOZZLE_OFFSET_help) + + cmd_WIZARD_STEP_NOZZLE_OFFSET_help = "update value to the slider data" + + def cmd_WIZARD_STEP_NOZZLE_OFFSET(self, gcmd): + step_x = gcmd.get_int('STEP_X', self.step_x) + step_y = gcmd.get_int('STEP_Y', self.step_y) + if min(step_x, step_y) < 0 or max(step_x, step_y) > self.quantity_steps: + raise gcmd.error( + "2060: Failure set value to step, value out of the range[0-%s]" % (self.quantity_steps)) + self.step_x = step_x + self.step_y = step_y + + def get_status(self, eventtime): + return { + 'step_x': self.step_x, + 'step_y': self.step_y, + } + + +def load_config_prefix(config): + return WizardStepNozzleOffset(config) diff --git a/stereotech_config/wizards/wizards.cfg b/stereotech_config/wizards/wizards.cfg index 294b89e41fcb..47cfde3904ce 100644 --- a/stereotech_config/wizards/wizards.cfg +++ b/stereotech_config/wizards/wizards.cfg @@ -35,10 +35,16 @@ # WIZARD_STEP_JOG WIZARD=CALIBRATE STEP=STEP_JOG_1 AXIS=z DIRECTION=0 # WIZARD_STEP_SET_STEP WIZARD=CALIBRATE STEP=STEP_JOG_1 VALUE=20 +# wizard_step_nozzle_offset +# CANCEL_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_NOZZLE_OFFSET_1 +# EXECUTE_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_NOZZLE_OFFSET_1 +# WIZARD_STEP_NOZZLE_OFFSET WIZARD=CALIBRATE STEP=STEP_NOZZLE_OFFSET_1 STEP_X=9 STEP_Y=10 + + [wizard CALIBRATE] image: path/to/image/wizard/CALIBRATE type: 3d, 5d, any -steps: STEP_0, STEP_BUTTON_1, STEP_WIZARDS_1, STEP_SELECTOR_1, STEP_SLIDER_1, STEP_JOG_1 +steps: STEP_0, STEP_BUTTON_1, STEP_WIZARDS_1, STEP_SELECTOR_1, STEP_SLIDER_1, STEP_JOG_1, STEP_NOZZLE_OFFSET_1 variable_a: 1 variable_b: 2 @@ -155,26 +161,23 @@ action_gcode: cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_JOG_1')} RESET_WIZARD WIZARD={wizard.name} - # HOME_POSITION ABORT=1 - -# ???????????????????????????????? - -# [wizard_step_material-selector material-selector_1] -# image: path/to/image/wizard/STEP_JOG_1 -# landscape: false -# description: description STEP_JOG_1 -# warning: warning STEP_JOG_1 -# countdown: 20 -# info: info about STEP_JOG_1 -# axes: x, y, z, a, c -# steps: 0.1, 1, 10, 20 -# default_step: 10 -# jog_gcode: -# {action_respond_info('-------------------jog_gcode STEP_JOG_1 axis=%s, step=%s,' % (axis, step))} -# action_gcode: -# {action_respond_info('-------------------start STEP_JOG_1')} -# cancel_gcode: -# {action_respond_info('------------------CANCEL STEP_JOG_1')} -# RESET_WIZARD WIZARD={wizard.name} -# # HOME_POSITION ABORT=1 \ No newline at end of file +[wizard_step_nozzle_offset STEP_NOZZLE_OFFSET_1] +image: path/to/image/wizard/STEP_NOZZLE_OFFSET_1 +landscape: false +description: description STEP_NOZZLE_OFFSET_1 +warning: warning STEP_NOZZLE_OFFSET_1 +countdown: 20 +info: info about STEP_NOZZLE_OFFSET_1 +steps: 15 +default_step: 7 +step_value: 0.1 +min_value: -0.7 +action_gcode: + {action_respond_info('-------------------action_gcode %s' % wizard.wizard_step_name)} + SET_WIZARD_ENABLE WIZARD={wizard.name} ENABLE=1 ERROR=error_message + SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} + WIZARD_STEP_CHANGE_STATE STEP={wizard.wizard_step_name} +cancel_gcode: + {action_respond_info('------------------cancel_gcode %s' % wizard.wizard_step_name)} + RESET_WIZARD WIZARD={wizard.name} From efa2306170f13334a8a8cb6d15570f931c0c6127 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Fri, 19 Jan 2024 09:35:58 +0000 Subject: [PATCH 04/13] STEAPP-879: added supporting the placeholders --- klippy/extras/wizard/wizard_step.py | 12 ++++++------ stereotech_config/wizards/wizards.cfg | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/klippy/extras/wizard/wizard_step.py b/klippy/extras/wizard/wizard_step.py index 65987b048dc9..f91f93fc6fef 100644 --- a/klippy/extras/wizard/wizard_step.py +++ b/klippy/extras/wizard/wizard_step.py @@ -27,9 +27,9 @@ def __init__(self, config): self.template_cancel = self.gcode_macro.load_template( config, 'cancel_gcode') # register gcode commands - self.gcode.register_mux_command("WIZARD_STEP_CHANGE_STATE", 'STEP', - self.name, self.cmd_WIZARD_STEP_CHANGE_STATE, - desc=self.cmd_WIZARD_STEP_CHANGE_STATE_help) + self.gcode.register_mux_command("WIZARD_STEP_LOADING_STATE", 'STEP', + self.name, self.cmd_WIZARD_STEP_LOADING_STATE, + desc=self.cmd_WIZARD_STEP_LOADING_STATE_help) self.gcode.register_mux_command("EXECUTE_WIZARD_STEP", 'STEP', self.name, self.cmd_EXECUTE_WIZARD_STEP, desc=self.cmd_EXECUTE_WIZARD_STEP_help) @@ -37,10 +37,10 @@ def __init__(self, config): self.name, self.cmd_CANCEL_WIZARD_STEP, desc=self.cmd_CANCEL_WIZARD_STEP_help) - cmd_WIZARD_STEP_CHANGE_STATE_help = "change state for show the placeholder" + cmd_WIZARD_STEP_LOADING_STATE_help = "Change state for show the placeholder" - def cmd_WIZARD_STEP_CHANGE_STATE(self, gcmd): - state = gcmd.get('LOADING', 0) + def cmd_WIZARD_STEP_LOADING_STATE(self, gcmd): + state = gcmd.get('ENABLE', 0) self.loading = True if state else False cmd_EXECUTE_WIZARD_STEP_help = "Run gcode in the 'action_gcode' option" diff --git a/stereotech_config/wizards/wizards.cfg b/stereotech_config/wizards/wizards.cfg index 47cfde3904ce..9d1801e4be2c 100644 --- a/stereotech_config/wizards/wizards.cfg +++ b/stereotech_config/wizards/wizards.cfg @@ -59,7 +59,7 @@ placeholder: path/to/wizard/placeholder action_gcode: SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} {action_respond_info('-------------------start STEP_0')} - WIZARD_STEP_CHANGE_STATE STEP=STEP_0 LOADING=0 + WIZARD_STEP_LOADING_STATE STEP=STEP_0 ENABLE=1 cancel_gcode: {action_respond_info('------------------CANCEL STEP_0')} RESET_WIZARD WIZARD={wizard.name} @@ -78,7 +78,7 @@ button_button2_gcode: {action_respond_info('-------------------button_button2_gcode')} action_gcode: {action_respond_info('-------------------action_gcode STEP_BUTTON_1')} - WIZARD_STEP_CHANGE_STATE STEP=STEP_BUTTON_1 LOADING=1 + WIZARD_STEP_LOADING_STATE STEP=STEP_BUTTON_1 ENABLE=1 SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_BUTTON_1')} @@ -157,7 +157,7 @@ action_gcode: {action_respond_info('-------------------action_gcode STEP_JOG_1')} SET_WIZARD_ENABLE WIZARD=CALIBRATE ENABLE=1 ERROR=error_message SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} - WIZARD_STEP_CHANGE_STATE STEP=STEP_JOG_1 LOADING=1 + WIZARD_STEP_LOADING_STATE STEP=STEP_JOG_1 ENABLE=1 cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_JOG_1')} RESET_WIZARD WIZARD={wizard.name} @@ -177,7 +177,7 @@ action_gcode: {action_respond_info('-------------------action_gcode %s' % wizard.wizard_step_name)} SET_WIZARD_ENABLE WIZARD={wizard.name} ENABLE=1 ERROR=error_message SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} - WIZARD_STEP_CHANGE_STATE STEP={wizard.wizard_step_name} + WIZARD_STEP_LOADING_STATE STEP={wizard.wizard_step_name} cancel_gcode: {action_respond_info('------------------cancel_gcode %s' % wizard.wizard_step_name)} RESET_WIZARD WIZARD={wizard.name} From 2e49e5b5cb6adb42a17f132a713496da6ff517ae Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Fri, 19 Jan 2024 13:07:30 +0000 Subject: [PATCH 05/13] STEAPP-879: added info about wizard and wizard_step --- docs/stereotech/error_list_guide.txt | 2 + docs/stereotech/guide_config/wizards.md | 334 ++++++++++++++++++++++++ 2 files changed, 336 insertions(+) create mode 100644 docs/stereotech/guide_config/wizards.md diff --git a/docs/stereotech/error_list_guide.txt b/docs/stereotech/error_list_guide.txt index 18ef5638102f..7a7fb63f628b 100644 --- a/docs/stereotech/error_list_guide.txt +++ b/docs/stereotech/error_list_guide.txt @@ -33,6 +33,7 @@ config: 0023: Option '%s' in section '%s' must be above %s 0024: Option '%s' in section '%s' must be below %s 0025: Unable to load module '%s' + 0026: file with data not exist печать/кинематика/движение: 101: Error loading kinematics @@ -124,6 +125,7 @@ config: 2059: Macro %s called recursively 2060: The button '%s' does not exist 2061: Failure set value to step, value out of the range[0-%s] + 2062: the key does not exist - %s, check the key перефирия(mcu): 301: Timeout on wait for '%s' response diff --git a/docs/stereotech/guide_config/wizards.md b/docs/stereotech/guide_config/wizards.md new file mode 100644 index 000000000000..7ddbcc672f75 --- /dev/null +++ b/docs/stereotech/guide_config/wizards.md @@ -0,0 +1,334 @@ +# [wizard] + +This object creates a manager that specifies all the steps that will be performed during execution. + +## configure + +``` +[wizard ] +image: /path/to/image/wizard/ + path to wizard image +type: 3d, 5d, any + type the modules supported this wizard +steps: step_1, step_2 + list the all steps for current wizard will be used +variable_: 1 +variable_: 2 + the wizard variables +``` + +## status + +``` +{'current_step': current wizard_step, +'enabled': 1/0, +'error': error_string, +'variables': variables, +'name': , +'steps': steps, +'type': type} +``` + +## commands + +#### SET_WIZARD_ENABLE + +`SET_WIZARD_ENABLE WIZARD= ENABLE=<1/0> ERROR=`: This command using for change the wizard state to the enable or disable. If need can set the error message. + +#### RESET_WIZARD + +`RESET_WIZARD WIZARD=`: The command reset current step to first and set set the wizard to the disabled. + +#### SET_WIZARD_STEP + +`SET_WIZARD_STEP WIZARD=: Set the step to wizard. + +#### SET_WIZARD_VARIABLE + +`SET_WIZARD_STEP WIZARD=`: Set the value to the wizard variables + +# [wizard_step] + +This is the base object that implements the template for creating the rest of the wizard steps. + +## configure + +``` +[wizard_step ] +image: path/to/image/wizard/ + path to wizard_step image +landscape: false + set True if this wizard_step can supported horizontal rendering +description: description_string + description for this wizard_step, this description the client will be rendered +warning: warning_string + warning msg for this wizard_step, this msg the client will be rendered +countdown: 0 + time until the end of the wizard +info: info_string + info about +placeholder: path/to/wizard/placeholder + path to placeholder image +action_gcode: + write gcode which will be running if send the cmd [EXECUTE_WIZARD_STEP] +cancel_gcode: + write gcode which will be running if send the cmd [CANCEL_WIZARD_STEP] +``` + +## status + +``` +{'loading':loading, +'placeholder': placeholder} +``` + +## commands + +#### EXECUTE_WIZARD_STEP + +`EXECUTE_WIZARD_STEP WIZARD= STEP=`: Run gcode in the 'action_gcode' option + +#### CANCEL_WIZARD_STEP + +`CANCEL_WIZARD_STEP WIZARD= STEP=`: Run gcode in the 'cancel_gcode' option + +#### WIZARD_STEP_LOADING_STATE + +`WIZARD_STEP_LOADING_STATE WIZARD= STEP= ENABLE=<1/0>`: Change state for show the placeholder, enable/disable loading state. + +# [wizard_step_wizards] + +this step allows you to display all the managers that can be performed in this step. (step to select a manager) + +## configure + +``` +[wizard_step_wizards ] +! Note all options of the [wizard_step] object are supported +wizards: wizard1, wizard2 + list the all wizards for current step +``` + +## status + +such as [wizard_step] + +## commands + +! Note all cmd of the [wizard_step] object are supported + +# [wizard_step_tree] + +step for support component the data-selector (material-selector), which send json to client and client can rendering items + +## configure + +``` +[wizard_step_tree ] +! Note all options of the [wizard_step] object are supported +tree_file_path: ./path/to/data.json + path to data.json +depth: 3 + depth tree, for client can rendering items +types: manufacturer, series, name + name for everyone node, for client can rendering items +``` + +## status + +``` +{ + 'tree': tree, + 'selected': selected, + 'value': value +} + ``` + +## commands + +! Note all cmd of the [wizard_step] object are supported + +#### WIZARD_STEP_TREE + +`WIZARD_STEP_TREE WIZARD= STEP=STEP_TREE_1 KEY=pla`: select key from tree for set the value + +# [wizard_step_slider] + +Step for support component slider. You can specify the required number of sliders for which this object will change its value and interact with the client. Note: by the number of sliders, the client understands how much to draw + +## configure + +``` +[wizard_step_slider ] +! Note all options of the [wizard_step] object are supported +slider__min: 0 +slider__max: 100 +slider__step: 1 +slider__default: 20 + slider data for used to klipper and for for client can rendering it. Can set more sliders + +... + +``` + +## status + +``` +{ + : current_value, + : current_value, + ... +} + ``` + +## commands + +! Note all cmd of the [wizard_step] object are supported + +#### WIZARD_STEP_TREE + +`WIZARD_STEP_SLIDER WIZARD= STEP= SLIDER= VALUE=`: update the value for the selected slider.. + +# [wizard_step_selector] + +Step for support component selector. + +## configure + +``` +[wizard_step_selector ] +! Note all options of the [wizard_step] object are supported +items: , , ... + list items which can select, client get info from this row for rendering items. You can specify the required number of item +select_gcode: + write gcode which will be running if send the cmd [WIZARD_STEP_SELECT] +... + +``` + +## status + +``` +{ + 'selected': +} + ``` + +## commands + +! Note all cmd of the [wizard_step] object are supported + +#### WIZARD_STEP_SELECT + +`WIZARD_STEP_SELECT WIZARD= STEP= ITEM=`: Run gcode in the 'select_gcode' section. + +# [wizard_step_nozzle_offset] + +This step is used for the nozzle_offset manager, it specifies all the necessary data for rendering and operation of the klipper application + +## configure + +``` +[wizard_step_selector ] +! Note all options of the [wizard_step] object are supported +steps: 15 + the number of steps so that the application can work with this data and the client can draw it +default_step: 7 + the step number so that the application can work with this data and the client can draw it +step_value: 0.1 + the step value so that the client can work with this data +min_value: -0.7 + the minimal value so that the client can work with this data +``` + +## status + +``` +{ + 'step_x': step_x, + 'step_y': step_y, +} + ``` + +## commands + +! Note all cmd of the [wizard_step] object are supported + +#### WIZARD_STEP_NOZZLE_OFFSET + +`WIZARD_STEP_NOZZLE_OFFSET WIZARD= STEP= STEP_X= STEP_Y=`: set current step for axis X or Y. This command is used to move along the calibration ruler (vernier scale) + +# [wizard_step_jog] + +Using this step, you can control the axes of the printer, as well as the data from this step is used by the client for rendering + +## configure + +``` +[wizard_step_jog ] +! Note all options of the [wizard_step] object are supported + +axes: x, y, z, a, c + axes that can be controlled. The client uses this information to display +steps: 0.1, 1, 10, 20 + values for steps, client uses this information to display +default_step: 10 + the default value with which movements will occur for a given axis +jog_gcode: + write gcode which will be running if send the cmd [WIZARD_STEP_JOG] + +``` + +## status + +``` +{ + 'loading':loading, + 'placeholder': placeholder + 'step': default_step + } +``` + +## commands + +! Note all cmd of the [wizard_step] object are supported + +#### WIZARD_STEP_SET_STEP + +`WIZARD_STEP_SET_STEP WIZARD= STEP= VALUE=`: Set step for moving the axis + +#### WIZARD_STEP_JOG + +`WIZARD_STEP_JOG WIZARD= STEP= AXIS= DIRECTION=<1/0>`: Perform axis movement + +# [wizard_step_button] + +A step to port the button component, with which you can respond to button clicks. You can specify the required number of buttons. Data on the name and number of buttons are read from the configuration. + +## configure + +``` +[wizard_step_button ] +! Note all options of the [wizard_step] object are supported + +button__gcode: + write gcode which will be running if send the cmd [WIZARD_STEP_BUTTON] +... +``` + +## status + +``` +{ + 'loading':loading, + 'placeholder': placeholder + } +``` + +## commands + +! Note all cmd of the [wizard_step] object are supported + +#### WIZARD_STEP_BUTTON + +`WIZARD_STEP_BUTTON WIZARD= STEP= BUTTON=`: Run gcode in the 'button_%s_gcode' section From c0d11f8e3e48a476e56c2274c272d9add7116027 Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Fri, 19 Jan 2024 13:09:42 +0000 Subject: [PATCH 06/13] STEAPP-875: added wizard_step_tree --- klippy/extras/wizard/wizard_step_tree.py | 63 ++++++++++ stereotech_config/wizards/data/materials.json | 113 ++++++++++++++++++ stereotech_config/wizards/wizards.cfg | 30 ++++- 3 files changed, 200 insertions(+), 6 deletions(-) create mode 100644 klippy/extras/wizard/wizard_step_tree.py create mode 100644 stereotech_config/wizards/data/materials.json diff --git a/klippy/extras/wizard/wizard_step_tree.py b/klippy/extras/wizard/wizard_step_tree.py new file mode 100644 index 000000000000..93c20c7f5b79 --- /dev/null +++ b/klippy/extras/wizard/wizard_step_tree.py @@ -0,0 +1,63 @@ +from wizard_step import WizardStep +import os +import json + + +class WizardStepTree(WizardStep): + def __init__(self, config): + WizardStep.__init__(self, config) + self.tree = [] + self.selected = '' + self.value = '' + # get options from config + self.depth = config.getint('depth', 1) + self.types = config.getlist('types', []) + path = config.get('tree_file_path', '') + filename = os.path.abspath(path) + if os.path.isfile(filename): + with open(filename, 'r') as f: + self.tree = json.load(f) + else: + raise config.error("0026: file with data not exist") + # register commands + self.gcode.register_mux_command("WIZARD_STEP_TREE", 'STEP', + self.name, self.cmd_WIZARD_STEP_TREE, + desc=self.cmd_WIZARD_STEP_TREE_help) + + cmd_WIZARD_STEP_TREE_help = "select key from tree for set the value" + + def cmd_WIZARD_STEP_TREE(self, gcmd): + selected = gcmd.get('KEY') + value = self.get_value(self.tree, selected) + if value: + self.value = value + self.selected = selected + else: + raise gcmd.error( + "2062: the key does not exist - %s, check the key" % (selected,)) + + def get_value(self, node, key): + if isinstance(node, list): + for item in node: + value = get_value(item, key) + if isinstance(value, int): + return value + elif isinstance(node, dict): + if node.get('key', '') == key: + return node['value'] + if node.get('children', ''): + for child in node['children']: + value = get_value(child, key) + if isinstance(value, int): + return value + + def get_status(self, eventtime): + return { + 'tree': self.tree, + 'selected': self.selected, + 'value': self.value + } + + +def load_config_prefix(config): + return WizardStepTree(config) diff --git a/stereotech_config/wizards/data/materials.json b/stereotech_config/wizards/data/materials.json new file mode 100644 index 000000000000..bec1e337db4b --- /dev/null +++ b/stereotech_config/wizards/data/materials.json @@ -0,0 +1,113 @@ +[ + { + "key": "stereotech1", + "children": [ + { + "key": "proto", + "children": [ + { + "key": "pla", + "value": 210 + }, + { + "key": "pva", + "value": 211 + } + ] + }, + { + "key": "proto1", + "children": [ + { + "key": "pla1", + "value": 212 + }, + { + "key": "pva1", + "value": 213 + } + ] + }, + ] + }, + { + "key": "stereotech2", + "children": [ + { + "key": "proto", + "children": [ + { + "key": "pla11", + "value": 221 + }, + { + "key": "pva11", + "value": 222 + } + ] + } + ] + }, + { + "key": "stereotech3", + "children": [ + { + "key": "proto", + "children": [ + { + "key": "pla111", + "value": 231 + }, + { + "key": "pva111", + "value": 232 + } + ] + }, + { + "key": "proto2", + "children": [ + { + "key": "pla222", + "children": [ + { + "key": "pla5555", + "value": 23355 + }, + { + "key": "pva6666", + "children": [ + { + "key": "pla22200000", + "value": 233000000000 + }, + { + "key": "pva22211111", + "value": 23411111111111 + } + ] + } + ] + }, + { + "key": "pva222", + "value": 234 + } + ] + }, + { + "key": "proto", + "children": [ + { + "key": "pla333", + "value": 235 + }, + { + "key": "pva333", + "value": 236 + } + ] + } + ] + } +] \ No newline at end of file diff --git a/stereotech_config/wizards/wizards.cfg b/stereotech_config/wizards/wizards.cfg index 9d1801e4be2c..a793362f8492 100644 --- a/stereotech_config/wizards/wizards.cfg +++ b/stereotech_config/wizards/wizards.cfg @@ -11,8 +11,8 @@ # wizard_step_button # CANCEL_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_BUTTON_1 # EXECUTE_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_BUTTON_1 -# WIZARD_STEP_BUTTON WIZARD=CALIBRATE STEP=STEP_BUTTON_1 BUTTON=button_button_1_gcode -# WIZARD_STEP_BUTTON WIZARD=CALIBRATE STEP=STEP_BUTTON_1 BUTTON=button_button2_gcode +# WIZARD_STEP_BUTTON WIZARD=CALIBRATE STEP=STEP_BUTTON_1 BUTTON=button_1 +# WIZARD_STEP_BUTTON WIZARD=CALIBRATE STEP=STEP_BUTTON_1 BUTTON=button2 # wizard_step_wizards # CANCEL_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_WIZARDS_1 @@ -40,6 +40,10 @@ # EXECUTE_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_NOZZLE_OFFSET_1 # WIZARD_STEP_NOZZLE_OFFSET WIZARD=CALIBRATE STEP=STEP_NOZZLE_OFFSET_1 STEP_X=9 STEP_Y=10 +# wizard_step_tree +# CANCEL_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_TREE_1 +# EXECUTE_WIZARD_STEP WIZARD=CALIBRATE STEP=STEP_TREE_1 +# WIZARD_STEP_TREE WIZARD=CALIBRATE STEP=STEP_TREE_1 KEY=pla [wizard CALIBRATE] image: path/to/image/wizard/CALIBRATE @@ -59,7 +63,7 @@ placeholder: path/to/wizard/placeholder action_gcode: SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} {action_respond_info('-------------------start STEP_0')} - WIZARD_STEP_LOADING_STATE STEP=STEP_0 ENABLE=1 + WIZARD_STEP_LOADING_STATE WIZARD={wizard.name} STEP=STEP_0 ENABLE=1 cancel_gcode: {action_respond_info('------------------CANCEL STEP_0')} RESET_WIZARD WIZARD={wizard.name} @@ -78,7 +82,7 @@ button_button2_gcode: {action_respond_info('-------------------button_button2_gcode')} action_gcode: {action_respond_info('-------------------action_gcode STEP_BUTTON_1')} - WIZARD_STEP_LOADING_STATE STEP=STEP_BUTTON_1 ENABLE=1 + WIZARD_STEP_LOADING_STATE WIZARD={wizard.name} STEP=STEP_BUTTON_1 ENABLE=1 SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_BUTTON_1')} @@ -157,7 +161,7 @@ action_gcode: {action_respond_info('-------------------action_gcode STEP_JOG_1')} SET_WIZARD_ENABLE WIZARD=CALIBRATE ENABLE=1 ERROR=error_message SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} - WIZARD_STEP_LOADING_STATE STEP=STEP_JOG_1 ENABLE=1 + WIZARD_STEP_LOADING_STATE WIZARD={wizard.name} STEP=STEP_JOG_1 ENABLE=1 cancel_gcode: {action_respond_info('------------------cancel_gcode STEP_JOG_1')} RESET_WIZARD WIZARD={wizard.name} @@ -177,7 +181,21 @@ action_gcode: {action_respond_info('-------------------action_gcode %s' % wizard.wizard_step_name)} SET_WIZARD_ENABLE WIZARD={wizard.name} ENABLE=1 ERROR=error_message SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} - WIZARD_STEP_LOADING_STATE STEP={wizard.wizard_step_name} +cancel_gcode: + {action_respond_info('------------------cancel_gcode %s' % wizard.wizard_step_name)} + RESET_WIZARD WIZARD={wizard.name} + +[wizard_step_tree STEP_TREE_1] +# tree_file_path: /home/ste/klippy_dev/klipper/klippy/data/materials.json +tree_file_path: ./klippy/data/materials.json +depth: 3 # (глубина дерева) +# (типы на каждой глубине) +types: manufacturer, series, name +action_gcode: + {action_respond_info('-------------------action_gcode %s' % wizard.wizard_step_name)} + SET_WIZARD_ENABLE WIZARD={wizard.name} ENABLE=1 ERROR=error_message + SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} + WIZARD_STEP_LOADING_STATE WIZARD={wizard.name} STEP={wizard.wizard_step_name} cancel_gcode: {action_respond_info('------------------cancel_gcode %s' % wizard.wizard_step_name)} RESET_WIZARD WIZARD={wizard.name} From f337349460f93ee5e52ef106cec5f9e9e0d9d30c Mon Sep 17 00:00:00 2001 From: sokolovjek Date: Fri, 19 Jan 2024 13:31:57 +0000 Subject: [PATCH 07/13] STEAPP-875: added wizard_step_tree --- docs/stereotech/error_list_guide.txt | 3 +- klippy/extras/wizard/wizard_step_tree.py | 11 ++- stereotech_config/wizards/data/materials.json | 88 +++---------------- stereotech_config/wizards/wizards.cfg | 2 +- 4 files changed, 23 insertions(+), 81 deletions(-) diff --git a/docs/stereotech/error_list_guide.txt b/docs/stereotech/error_list_guide.txt index 7a7fb63f628b..3d9f864f967d 100644 --- a/docs/stereotech/error_list_guide.txt +++ b/docs/stereotech/error_list_guide.txt @@ -33,7 +33,8 @@ config: 0023: Option '%s' in section '%s' must be above %s 0024: Option '%s' in section '%s' must be below %s 0025: Unable to load module '%s' - 0026: file with data not exist + 0026: do not parse .json file, error %s + 0027: file with data not exist печать/кинематика/движение: 101: Error loading kinematics diff --git a/klippy/extras/wizard/wizard_step_tree.py b/klippy/extras/wizard/wizard_step_tree.py index 93c20c7f5b79..d4e54d5bc162 100644 --- a/klippy/extras/wizard/wizard_step_tree.py +++ b/klippy/extras/wizard/wizard_step_tree.py @@ -15,8 +15,11 @@ def __init__(self, config): path = config.get('tree_file_path', '') filename = os.path.abspath(path) if os.path.isfile(filename): - with open(filename, 'r') as f: - self.tree = json.load(f) + try: + with open(filename, 'r') as f: + self.tree = json.load(f) + except Exception as e: + raise config.error("0026: do not parse .json file, error %s" % e) else: raise config.error("0026: file with data not exist") # register commands @@ -39,7 +42,7 @@ def cmd_WIZARD_STEP_TREE(self, gcmd): def get_value(self, node, key): if isinstance(node, list): for item in node: - value = get_value(item, key) + value = self.get_value(item, key) if isinstance(value, int): return value elif isinstance(node, dict): @@ -47,7 +50,7 @@ def get_value(self, node, key): return node['value'] if node.get('children', ''): for child in node['children']: - value = get_value(child, key) + value = self.get_value(child, key) if isinstance(value, int): return value diff --git a/stereotech_config/wizards/data/materials.json b/stereotech_config/wizards/data/materials.json index bec1e337db4b..c376353f11f2 100644 --- a/stereotech_config/wizards/data/materials.json +++ b/stereotech_config/wizards/data/materials.json @@ -1,66 +1,35 @@ [ { - "key": "stereotech1", + "key": "stereotech", "children": [ { "key": "proto", "children": [ { "key": "pla", - "value": 210 + "value": 205 }, { "key": "pva", - "value": 211 - } - ] - }, - { - "key": "proto1", - "children": [ - { - "key": "pla1", - "value": 212 - }, - { - "key": "pva1", - "value": 213 - } - ] - }, - ] - }, - { - "key": "stereotech2", - "children": [ - { - "key": "proto", - "children": [ - { - "key": "pla11", - "value": 221 - }, - { - "key": "pva11", - "value": 222 + "value": 206 } ] } ] }, { - "key": "stereotech3", + "key": "stereotech1", "children": [ { - "key": "proto", + "key": "proto1", "children": [ { - "key": "pla111", - "value": 231 + "key": "pla1", + "value": 207 }, { - "key": "pva111", - "value": 232 + "key": "pva1", + "value": 208 } ] }, @@ -68,43 +37,12 @@ "key": "proto2", "children": [ { - "key": "pla222", - "children": [ - { - "key": "pla5555", - "value": 23355 - }, - { - "key": "pva6666", - "children": [ - { - "key": "pla22200000", - "value": 233000000000 - }, - { - "key": "pva22211111", - "value": 23411111111111 - } - ] - } - ] + "key": "pla2", + "value": 209 }, { - "key": "pva222", - "value": 234 - } - ] - }, - { - "key": "proto", - "children": [ - { - "key": "pla333", - "value": 235 - }, - { - "key": "pva333", - "value": 236 + "key": "pva2", + "value": 210 } ] } diff --git a/stereotech_config/wizards/wizards.cfg b/stereotech_config/wizards/wizards.cfg index a793362f8492..ec43a4a274d1 100644 --- a/stereotech_config/wizards/wizards.cfg +++ b/stereotech_config/wizards/wizards.cfg @@ -187,7 +187,7 @@ cancel_gcode: [wizard_step_tree STEP_TREE_1] # tree_file_path: /home/ste/klippy_dev/klipper/klippy/data/materials.json -tree_file_path: ./klippy/data/materials.json +tree_file_path: /home/ste/klippy_dev/klipper/stereotech_config/wizards/data/materials.json depth: 3 # (глубина дерева) # (типы на каждой глубине) types: manufacturer, series, name From c288c842da0d4de67d0bfd0338abdc58cd43fe52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2=20=D0=95=D0=B2?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Mon, 22 Jan 2024 09:43:58 +0300 Subject: [PATCH 08/13] STEAPP-879: added get_status for support the placeholders --- docs/stereotech/guide_config/wizards.md | 4 ++-- stereotech_config/wizards/wizards.cfg | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/stereotech/guide_config/wizards.md b/docs/stereotech/guide_config/wizards.md index 7ddbcc672f75..335b6871aee2 100644 --- a/docs/stereotech/guide_config/wizards.md +++ b/docs/stereotech/guide_config/wizards.md @@ -67,8 +67,8 @@ countdown: 0 time until the end of the wizard info: info_string info about -placeholder: path/to/wizard/placeholder - path to placeholder image +placeholder: + placeholder component name action_gcode: write gcode which will be running if send the cmd [EXECUTE_WIZARD_STEP] cancel_gcode: diff --git a/stereotech_config/wizards/wizards.cfg b/stereotech_config/wizards/wizards.cfg index ec43a4a274d1..21f878c6c311 100644 --- a/stereotech_config/wizards/wizards.cfg +++ b/stereotech_config/wizards/wizards.cfg @@ -59,7 +59,7 @@ description: description STEP_0 warning: warning STEP_0 countdown: 10 info: info about STSTEP_0 -placeholder: path/to/wizard/placeholder +placeholder: wizard-step-preheat action_gcode: SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.wizard_step_name} {action_respond_info('-------------------start STEP_0')} @@ -75,7 +75,7 @@ description: description STEP_BUTTON_1 warning: warning STEP_BUTTON_1 countdown: 20 info: info about STEP_BUTTON_1 -placeholder: path/to/wizard/placeholder +placeholder: wizard-step-preheat button_button_1_gcode: {action_respond_info('-------------------button_button_1_gcode')} button_button2_gcode: @@ -154,7 +154,7 @@ info: info about STEP_JOG_1 axes: x, y, z, a, c steps: 0.1, 1, 10, 20 default_step: 10 -placeholder: path/to/wizard/placeholder +placeholder: wizard-step-preheat jog_gcode: {action_respond_info('-------------------jog_gcode STEP_JOG_1 (G1 %s%s, direction=%s)' % (axis|upper, step, direction))} action_gcode: From ee4c89ad7cd53a5ee5a65149e8825ab37e8ba05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2=20=D0=95=D0=B2?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Mon, 22 Jan 2024 09:44:50 +0300 Subject: [PATCH 09/13] STEAPP-875: added wizard_step_tree --- klippy/extras/wizard/wizard_step_tree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klippy/extras/wizard/wizard_step_tree.py b/klippy/extras/wizard/wizard_step_tree.py index d4e54d5bc162..6e3c626fe16f 100644 --- a/klippy/extras/wizard/wizard_step_tree.py +++ b/klippy/extras/wizard/wizard_step_tree.py @@ -8,7 +8,7 @@ def __init__(self, config): WizardStep.__init__(self, config) self.tree = [] self.selected = '' - self.value = '' + self.value = 0 # get options from config self.depth = config.getint('depth', 1) self.types = config.getlist('types', []) From 1b2fe635fce94b393a7a342697101d0057287031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2=20=D0=95=D0=B2?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Mon, 22 Jan 2024 11:14:08 +0300 Subject: [PATCH 10/13] STEAPP-875: added wizard_step_tree --- klippy/extras/wizard/wizard_step_tree.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/klippy/extras/wizard/wizard_step_tree.py b/klippy/extras/wizard/wizard_step_tree.py index 6e3c626fe16f..768471ea063f 100644 --- a/klippy/extras/wizard/wizard_step_tree.py +++ b/klippy/extras/wizard/wizard_step_tree.py @@ -9,14 +9,19 @@ def __init__(self, config): self.tree = [] self.selected = '' self.value = 0 + config_dir_name = 'config' # get options from config self.depth = config.getint('depth', 1) self.types = config.getlist('types', []) - path = config.get('tree_file_path', '') - filename = os.path.abspath(path) - if os.path.isfile(filename): + json_path = config.get('tree_file_path', '') + # read json file + filename = self.printer.get_start_args()['config_file'] + if 'printer.cfg' not in filename.split('/')[-1]: + config_dir_name = 'stereotech_config' + abs_json_path = os.path.join(os.path.abspath('.'), config_dir_name, json_path) + if os.path.isfile(abs_json_path): try: - with open(filename, 'r') as f: + with open(abs_json_path, 'r') as f: self.tree = json.load(f) except Exception as e: raise config.error("0026: do not parse .json file, error %s" % e) From 1e16097a2f947a7ef2ec232e731cc245729a1f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2=20=D0=95=D0=B2?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Mon, 22 Jan 2024 12:37:44 +0300 Subject: [PATCH 11/13] STEAPP-879: added get_status for support the placeholders --- klippy/extras/wizard/wizard_step.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klippy/extras/wizard/wizard_step.py b/klippy/extras/wizard/wizard_step.py index f91f93fc6fef..1fe79dd0e526 100644 --- a/klippy/extras/wizard/wizard_step.py +++ b/klippy/extras/wizard/wizard_step.py @@ -40,7 +40,7 @@ def __init__(self, config): cmd_WIZARD_STEP_LOADING_STATE_help = "Change state for show the placeholder" def cmd_WIZARD_STEP_LOADING_STATE(self, gcmd): - state = gcmd.get('ENABLE', 0) + state = gcmd.get_int('ENABLE', 0) self.loading = True if state else False cmd_EXECUTE_WIZARD_STEP_help = "Run gcode in the 'action_gcode' option" From edfff09351b66d45f708d1c7ef6bb703884be417 Mon Sep 17 00:00:00 2001 From: Sokolov Evgenii <81033310+SokolovJek@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:38:12 +0300 Subject: [PATCH 12/13] STEAPP-879: wizard_step_tree.py --- klippy/extras/wizard/wizard_step_tree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klippy/extras/wizard/wizard_step_tree.py b/klippy/extras/wizard/wizard_step_tree.py index 768471ea063f..48e04337909d 100644 --- a/klippy/extras/wizard/wizard_step_tree.py +++ b/klippy/extras/wizard/wizard_step_tree.py @@ -51,9 +51,9 @@ def get_value(self, node, key): if isinstance(value, int): return value elif isinstance(node, dict): - if node.get('key', '') == key: + if 'key' in node: return node['value'] - if node.get('children', ''): + if 'children' in node: for child in node['children']: value = self.get_value(child, key) if isinstance(value, int): From 18bae6e54cce542ea06b685d7c1632024edcea33 Mon Sep 17 00:00:00 2001 From: Sokolov Evgenii <81033310+SokolovJek@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:53:38 +0300 Subject: [PATCH 13/13] STEAPP-879: edited the code for readable --- klippy/extras/wizard/wizard_step_tree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klippy/extras/wizard/wizard_step_tree.py b/klippy/extras/wizard/wizard_step_tree.py index 48e04337909d..d54a17e7de09 100644 --- a/klippy/extras/wizard/wizard_step_tree.py +++ b/klippy/extras/wizard/wizard_step_tree.py @@ -51,9 +51,9 @@ def get_value(self, node, key): if isinstance(value, int): return value elif isinstance(node, dict): - if 'key' in node: + if key in node.values(): return node['value'] - if 'children' in node: + elif 'children' in node: for child in node['children']: value = self.get_value(child, key) if isinstance(value, int):