Merge commit '24ca655de97ff09758970c4e056309332b390a3b' into devel

This commit is contained in:
thelastWallE 2021-04-28 15:16:09 +02:00
commit 0dd67f01e3
3 changed files with 44 additions and 11 deletions

View File

@ -568,6 +568,30 @@ class KlipperPlugin(
dataToValidated.readfp(buf)
else:
dataToValidated.read_string(dataToBeValidated)
sections_search_list = ["bltouch",
"probe"]
value_search_list = [ "x_offset",
"y_offset",
"z_offset"]
try:
# cycle through sections and then values
for y in sections_search_list:
for x in value_search_list:
if dataToValidated.has_option(y, x):
a_float = dataToValidated.getfloat(y, x)
except ValueError as error:
self.log_error(
"Error: Invalid Value for <b>"+x+"</b> in Section: <b>"+y+"</b>\n" +
"{}".format(str(error))
)
self.send_message("PopUp", "warning", "OctoKlipper: Invalid Config\n",
"Config got not saved!\n" +
"You can reload your last changes\n" +
"on the 'Klipper Configuration' tab.\n\n" +
"Invalid Value for <b>"+x+"</b> in Section: <b>"+y+"</b>\n" + "{}".format(str(error)))
self._parsing_check_response = False
return False
except configparser.Error as error:
if sys.version_info[0] < 3:
error.message = error.message.replace("\\n","")
@ -588,9 +612,10 @@ class KlipperPlugin(
"You can reload your last changes\n" +
"on the 'Klipper Configuration' tab.\n\n" + str(error))
self._parsing_check_response = False
return False
else:
self._parsing_check_response = True
return
return True
#incorrectlines = []
# for section in dataToValidated.sections():

View File

@ -28,14 +28,14 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
regex: /;.*$/
}, {
token: "comment.line.number-sign",
regex: /(#\*#)/
regex: /^(#\*#)/
}],
"#number": [{
token: "constant.numeric",
regex: /\-?\d+(?:[\.,]\d+)?\b/
regex: /\-?\d+(?:[\.]\d+)?\b/
}, {
token: "constant.numeric",
regex: /\-?[\.,]\d+?\b/
regex: /\-?[\.]\d+?\b/
}],
"#boolean": [{
token: "constant.language",
@ -112,6 +112,11 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
regex: /\b(?:cartesian|delta|corexy|corexz|polar|rotary_delta|winch|none)\b/,
caseInsensitive: true
}],
"#known_screws_type": [{
token: "support.type",
regex: /\b(?:CW-M3|CCW-M3|CW-M4|CCW-M4|CW-M5|CCW-M5)\b/,
caseInsensitive: true
}],
"#known_algo_type": [{
token: "support.type",
regex: /\b(?:lagrange|bicubic)\b/,
@ -119,7 +124,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}],
"#known_display_type": [{
token: "support.type",
regex: /\b(?:hd44780|st7920|uc1701|ssd1306|sh1106)\b/,
regex: /\b(?:hd44780|st7920|uc1701|ssd1306|emulated_st7920|sh1106)\b/,
caseInsensitive: true
}],
"#serial": [{
@ -128,7 +133,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}],
"#pin": [{
token: "support.type",
regex: /[\^~!]*(?:EXP|ar|analog)\d{1,2}/,
regex: /[\^~!]*(?:EXP|ar|analog)\d{1,2}|(?:probe:z_virtual_endstop)/,
caseInsensitive: true
}, {
token: "support.type",
@ -169,6 +174,8 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
include: "#known_display_type"
}, {
include: "#known_kinematics_type"
}, {
include: "#known_screws_type"
}, {
include: "#known_algo_type"
}, {
@ -183,6 +190,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
include: "#single_line_comment"
}]
}],
// For multiple keys on one line eg.: ^EXP1_5, ^EXP1_3
"#config_line_display": [{
token: ["variable.name", "text"],
regex: /(?!(gcode))(\w+)(\s*[=]\s*)/,
@ -231,7 +239,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
caseInsensitive: true,
push: [{
token: "text",
regex: /(\s|$)/,
regex: /(?=(\s|$|;))/,
next: "pop"
}, {
include: "#number"
@ -241,11 +249,11 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}],
"#gcode_parameter": [{
token: "variable.parameter",
regex: /\b[A-z]+(?![a-z])/,
regex: /\b[A-z]+(?![a-z])|(?:<---------------------- SAVE_CONFIG ---------------------->)|(?:\sDO NOT EDIT THIS BLOCK OR BELOW\. The contents are auto\-generated\.)/,
caseInsensitive: true,
push: [{
token: "text",
regex: /(?=(\s|$))/,
regex: /(?=(\s|$|;))|^/,
next: "pop"
}, {
include: "#number"
@ -272,7 +280,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
next: "pop"
}, {
token: "constant.language",
regex: /5V|average|command|echo|error|manual|median|OD|output_mode_store|pin_down|pin_up|reset|self_test|set_5V_output_mode|set_5V_output_mode|set_OD_output_mode|touch_mode/,
regex: /$|5V|average|command|echo|error|manual|median|OD|output_mode_store|pin_down|pin_up|reset|self_test|set_5V_output_mode|set_5V_output_mode|set_OD_output_mode|touch_mode/,
caseInsensitive: true
}, {
include: "#number"

View File

@ -19,7 +19,7 @@ plugin_package = "octoprint_klipper"
plugin_name = "OctoKlipper"
plugin_version = "0.3.8rc3"
plugin_version = "0.3.8rc5"
plugin_description = """A plugin for OctoPrint to configure,control and monitor the Klipper 3D printer software."""