macros: fix list not loading when there are extra spaces fixes #909
This commit is contained in:
parent
be473bf626
commit
dfe1ac8d2c
@ -153,7 +153,14 @@ class Printer:
|
||||
return []
|
||||
|
||||
def get_config_section(self, section):
|
||||
return self.config[section] if section in self.config else False
|
||||
return next(
|
||||
(
|
||||
self.config[key]
|
||||
for key in self.config.keys()
|
||||
if key.find(section) > -1
|
||||
),
|
||||
False,
|
||||
)
|
||||
|
||||
def get_fans(self):
|
||||
fans = []
|
||||
|
@ -83,7 +83,12 @@ class MacroPanel(ScreenPanel):
|
||||
"params": {},
|
||||
}
|
||||
pattern = r'params\.(?P<param>..*)\|default\((?P<default>..*)\).*'
|
||||
gcode = self._printer.get_config_section(f"gcode_macro {macro}")["gcode"].split("\n")
|
||||
gcode = self._printer.get_config_section(macro)
|
||||
if gcode and "gcode" in gcode:
|
||||
gcode = gcode["gcode"].split("\n")
|
||||
else:
|
||||
logging.debug(f"Couldn't load {macro}\n{gcode}")
|
||||
return
|
||||
i = 0
|
||||
for line in gcode:
|
||||
if line.startswith("{") and "params." in line:
|
||||
|
Loading…
x
Reference in New Issue
Block a user