Merge branch 'script' of github.com:brunohenriquy/Cura

This commit is contained in:
Jaime van Kessel 2023-01-20 11:20:45 +01:00
commit e8528e6735
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4

View file

@ -4,10 +4,12 @@
# Modified: November 16, 2018 by Joshua Pope-Lewis # Modified: November 16, 2018 by Joshua Pope-Lewis
# Description: This plugin shows custom messages about your print on the Status bar... # Description: This plugin shows custom messages about your print on the Status bar...
# Please look at the 3 options # Please look at the 5 options
# - Scrolling (SCROLL_LONG_FILENAMES) if enabled in Marlin and you aren't printing a small item select this option. # - Scrolling (SCROLL_LONG_FILENAMES) if enabled in Marlin and you aren't printing a small item select this option.
# - Name: By default it will use the name generated by Cura (EG: TT_Test_Cube) - Type a custom name in here # - Name: By default it will use the name generated by Cura (EG: TT_Test_Cube) - Type a custom name in here
# - Start Num: Choose which number you prefer for the initial layer, 0 or 1
# - Max Layer: Enabling this will show how many layers are in the entire print (EG: Layer 1 of 265!) # - Max Layer: Enabling this will show how many layers are in the entire print (EG: Layer 1 of 265!)
# - Add prefix 'Printing': Enabling this will add the prefix 'Printing'
from ..Script import Script from ..Script import Script
from UM.Application import Application from UM.Application import Application
@ -53,23 +55,30 @@ class DisplayFilenameAndLayerOnLCD(Script):
"description": "Display how many layers are in the entire print on status bar?", "description": "Display how many layers are in the entire print on status bar?",
"type": "bool", "type": "bool",
"default_value": true "default_value": true
} },
"addPrefixPrinting":
{
"label": "Add prefix 'Printing'?",
"description": "This will add the prefix 'Printing'",
"type": "bool",
"default_value": true
},
} }
}""" }"""
def execute(self, data): def execute(self, data):
max_layer = 0 max_layer = 0
lcd_text = "M117 "
if self.getSettingValueByKey("name") != "": if self.getSettingValueByKey("name") != "":
name = self.getSettingValueByKey("name") name = self.getSettingValueByKey("name")
else: else:
name = Application.getInstance().getPrintInformation().jobName name = Application.getInstance().getPrintInformation().jobName
if self.getSettingValueByKey("addPrefixPrinting"):
lcd_text += "Printing "
if not self.getSettingValueByKey("scroll"): if not self.getSettingValueByKey("scroll"):
if self.getSettingValueByKey("maxlayer"): lcd_text += "Layer "
lcd_text = "M117 Layer "
else: else:
lcd_text = "M117 Printing Layer " lcd_text += name + " - Layer "
else:
lcd_text = "M117 Printing " + name + " - Layer "
i = self.getSettingValueByKey("startNum") i = self.getSettingValueByKey("startNum")
for layer in data: for layer in data:
display_text = lcd_text + str(i) display_text = lcd_text + str(i)