Update DisplayFilenameAndLayerOnLCD.py:

- Fixed filename appearing in middle of text when scrolling is disabled and displaying max layer.
- Fixed filename appearing twice when scrolling is enabled and displaying max layers.
This commit is contained in:
Johnathan Chu 2020-01-06 21:45:43 -08:00
parent 2a09404235
commit 1f2e079185

View file

@ -72,7 +72,7 @@ class DisplayFilenameAndLayerOnLCD(Script):
lcd_text = "M117 Printing " + name + " - Layer "
i = self.getSettingValueByKey("startNum")
for layer in data:
display_text = lcd_text + str(i) + " " + name
display_text = lcd_text + str(i)
layer_index = data.index(layer)
lines = layer.split("\n")
for line in lines:
@ -82,8 +82,13 @@ class DisplayFilenameAndLayerOnLCD(Script):
if line.startswith(";LAYER:"):
if self.getSettingValueByKey("maxlayer"):
display_text = display_text + " of " + max_layer
if not self.getSettingValueByKey("scroll"):
display_text = display_text + " " + name
else:
display_text = display_text + "!"
if not self.getSettingValueByKey("scroll"):
display_text = display_text + " " + name + "!"
else:
display_text = display_text + "!"
line_index = lines.index(line)
lines.insert(line_index + 1, display_text)
i += 1