Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions plugins/PostProcessingPlugin/scripts/AddCoolingProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def getSettingDataString(self):
"description": "If you have 2 or more instances of 'Advanced Cooling Fan Control' running (to cool a portion of a print differently), then you must uncheck this box or the followup instances will remove all the lines inserted by the first instance. Pay attention to the Start and Stop layers. Regardless of this setting: The script always removes M106 lines starting with the lowest layer number (when 'By Layer') or the starting layer number (when 'By Feature'). If you want to keep the M106 lines that Cura inserted up to the point where this post-processor will start making insertions, then un-check the box.",
"type": "bool",
"enabled": true,
"value": true,
"default_value": true,
"read_only": true
"default_value": true
},
"feature_fan_start_layer":
{
Expand Down Expand Up @@ -280,13 +278,21 @@ def getSettingDataString(self):
"unit": "% ",
"enabled": "fan_enable_raft"
},
"enable_off_fan_speed_enable":
{
"label": "Hidden setting",
"description": "For dual extruder printers, this enables 'enable_off_fan_speed'.",
"type": "bool",
"default_value": false,
"enabled": false
},
"enable_off_fan_speed":
{
"label": "Enable 'Off speed' of the idle fan",
"description": "For machines with independent layer cooling fans. Leaving a fan running while the other nozzle is printing can help with oozing. You can pick the speed % for the idle nozzle layer cooling fan to hold at.",
"type": "bool",
"default_value": false,
"enabled": "enable_off_fan_speed_enable and self.extruder_count > 1"
"enabled": "enable_off_fan_speed_enable"
},
"off_fan_speed":
{
Expand All @@ -297,15 +303,7 @@ def getSettingDataString(self):
"minimum_value": 0,
"maximum_value": 100,
"unit": "% ",
"enabled": "enable_off_fan_speed_enable and enable_off_fan_speed and self.extruder_count > 1"
},
"enable_off_fan_speed_enable":
{
"label": "Hidden setting",
"description": "For dual extruder printers, this enables 'enable_off_fan_speed'.",
"type": "bool",
"default_value": false,
"enabled": false
"enabled": "enable_off_fan_speed_enable and enable_off_fan_speed"
},
"bv_fan_speed_control_enable":
{
Expand Down
12 changes: 6 additions & 6 deletions plugins/PostProcessingPlugin/scripts/ColorMix.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def getSettingDataString(self):
"description": "Select model to apply to for print one at a time print sequence. 0 = everything",
"type": "int",
"default_value": 0,
"minimum_value": "0"
"minimum_value": 0
},
"start_height":
{
"label": "Start Height",
"description": "Value to start at (mm or layer)",
"type": "float",
"default_value": 0,
"minimum_value": "0"
"minimum_value": 0
},
"behavior":
{
Expand All @@ -74,7 +74,7 @@ def getSettingDataString(self):
"description": "Value to stop at (mm or layer)",
"type": "float",
"default_value": 0,
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "start_height",
"enabled": "behavior == 'blend_value'"
},
Expand All @@ -84,7 +84,7 @@ def getSettingDataString(self):
"description": "First extruder percentage 0-100",
"type": "float",
"default_value": 100,
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "0",
"maximum_value_warning": "100"
},
Expand All @@ -94,7 +94,7 @@ def getSettingDataString(self):
"description": "First extruder percentage 0-100 to finish blend",
"type": "float",
"default_value": 0,
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "0",
"maximum_value_warning": "100",
"enabled": "behavior == 'blend_value'"
Expand All @@ -112,7 +112,7 @@ def getValue(self, line, key, default = None): #replace default getvalue due to
m = re.search("^[+-]?[0-9]*", subPart)
else:
#the minus at the beginning allows for negative values, e.g. for delta printers
m = re.search("^[-]?[0-9]*\.?[0-9]*", subPart)
m = re.search("^[-]?[0-9]*\\.?[0-9]*", subPart)
if m == None:
return default
try:
Expand Down
4 changes: 2 additions & 2 deletions plugins/PostProcessingPlugin/scripts/CreateThumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def getSettingDataString(self):
"unit": "px",
"type": "int",
"default_value": 32,
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "12",
"maximum_value_warning": "800"
},
Expand All @@ -81,7 +81,7 @@ def getSettingDataString(self):
"unit": "px",
"type": "int",
"default_value": 32,
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "12",
"maximum_value_warning": "600"
},
Expand Down
1 change: 1 addition & 0 deletions plugins/PostProcessingPlugin/scripts/DisplayInfoOnLCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def getSettingDataString(self):
"label": "Enable Countdown to Pauses",
"description": "If print sequence is 'one_at_a_time' this is false. This setting is always hidden.",
"type": "bool",
"default_value": false,
"value": false,
"enabled": false
},
Expand Down
10 changes: 8 additions & 2 deletions plugins/PostProcessingPlugin/scripts/FilamentChange.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def getSettingDataString(self):
"type": "enum",
"options": {"U": "Marlin (M600 U)", "L": "Reprap (M600 L)"},
"default_value": "U",
"value": "\\\"L\\\" if machine_gcode_flavor==\\\"RepRap (RepRap)\\\" else \\\"U\\\"",
"enabled": "enabled and not firmware_config"
},
"machine_gcode_flavor":
Expand All @@ -122,7 +121,7 @@ def getSettingDataString(self):
"Repetier": "Repetier"
},
"default_value": "RepRap (Marlin/Sprinter)",
"enabled": "false"
"enabled": false
},
"enable_before_macro":
{
Expand Down Expand Up @@ -172,6 +171,13 @@ def initialize(self) -> None:
for key in ["machine_gcode_flavor"]:
self._instance.setProperty(key, "value", global_container_stack.getProperty(key, "value"))

# Set retract method based on gcode flavor
gcode_flavor = global_container_stack.getProperty("machine_gcode_flavor", "value")
if gcode_flavor == "RepRap (RepRap)":
self._instance.setProperty("retract_method", "value", "L")
else:
self._instance.setProperty("retract_method", "value", "U")

def execute(self, data: List[str]):
"""Inserts the filament change g-code at specific layer numbers.

Expand Down
6 changes: 3 additions & 3 deletions plugins/PostProcessingPlugin/scripts/PauseAtHeight.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def getSettingDataString(self) -> str:
"unit": "mm",
"type": "float",
"default_value": 5.0,
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "0.27",
"enabled": "pause_at == 'height'"
},
Expand All @@ -49,7 +49,7 @@ def getSettingDataString(self) -> str:
"description": "Enter the Number of the LAST layer you want to finish prior to the pause. Note that 0 is the first layer printed.",
"type": "int",
"value": "math.floor((pause_height - 0.27) / 0.1) + 1",
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "1",
"enabled": "pause_at == 'layer_no'"
},
Expand All @@ -76,7 +76,7 @@ def getSettingDataString(self) -> str:
"description": "After this time steppers are going to disarm (meaning that they can easily lose their positions). Set this to 0 if you don't want to set any duration and disarm immediately.",
"type": "int",
"value": "0",
"minimum_value": "0",
"minimum_value": 0,
"minimum_value_warning": "0",
"maximum_value_warning": "1800",
"unit": "s",
Expand Down
12 changes: 9 additions & 3 deletions resources/qml/Settings/SettingCategory.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Cura.CategoryButton
anchors.left: parent.left
anchors.right: parent.right

categoryIcon: UM.Theme.getIcon(definition.icon)
expanded: definition.expanded
labelText: definition.label
categoryIcon: definition ? UM.Theme.getIcon(definition.icon) : ""
expanded: definition ? definition.expanded : false
labelText: definition ? definition.label : ""

signal showTooltip(string text)
signal hideTooltip()
Expand All @@ -28,6 +28,8 @@ Cura.CategoryButton

onClicked:
{
if (!definition) return

if (definition.expanded)
{
settingDefinitionsModel.collapseRecursive(definition.key)
Expand Down Expand Up @@ -84,6 +86,8 @@ Cura.CategoryButton

visible:
{
if (!definition) return false

if (Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0)
{
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(definition.key)
Expand All @@ -104,6 +108,8 @@ Cura.CategoryButton

onClicked:
{
if (!definition) return

settingDefinitionsModel.expandRecursive(definition.key)
base.showAllHiddenInheritedSettings(definition.key)
}
Expand Down
6 changes: 4 additions & 2 deletions resources/qml/Settings/SettingComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SettingItem
{
id: control

model: definition.options
model: definition ? definition.options : []
textRole: "value"
forceHighlight: base.hovered

Expand All @@ -25,7 +25,9 @@ SettingItem
onActivated:
{
forceActiveFocus()
propertyProvider.setPropertyValue("value", definition.options[index].key)
if (definition && definition.options && index >= 0 && index < definition.options.length) {
propertyProvider.setPropertyValue("value", definition.options[index].key)
}
}

onActiveFocusChanged:
Expand Down
20 changes: 11 additions & 9 deletions resources/qml/Settings/SettingItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Item
property bool showLinkedSettingIcon: true
property bool doDepthIndentation: true
property bool doQualityUserSettingEmphasis: true
property var settingKey: definition.key //Used to detect each individual setting more easily in Squish GUI tests.
property var settingKey: definition ? definition.key : "" //Used to detect each individual setting more easily in Squish GUI tests.

// Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
property var state: propertyProvider.properties.state
Expand Down Expand Up @@ -57,6 +57,8 @@ Item

function createTooltipText()
{
if (!definition) return ""

var affects = settingDefinitionsModel.getRequiredBy(definition.key, "value")
var affected_by = settingDefinitionsModel.getRequires(definition.key, "value")

Expand All @@ -78,7 +80,7 @@ Item
}
}

var tooltip = "<b>%1</b>\n<p>%2</p>".arg(definition.label).arg(definition.description)
var tooltip = "<b>%1</b>\n<p>%2</p>".arg(definition ? definition.label : "").arg(definition ? definition.description : "")

if(!propertyProvider.isValueUsed)
{
Expand Down Expand Up @@ -147,16 +149,16 @@ Item
id: label

anchors.left: parent.left
anchors.leftMargin: doDepthIndentation ? Math.round(UM.Theme.getSize("thin_margin").width + ((definition.depth - 1) * UM.Theme.getSize("default_margin").width)) : 0
anchors.leftMargin: doDepthIndentation ? Math.round(UM.Theme.getSize("thin_margin").width + ((definition ? definition.depth : 0) - 1) * UM.Theme.getSize("default_margin").width) : 0
anchors.right: settingControls.left
anchors.verticalCenter: parent.verticalCenter

text: definition.label
text: definition ? definition.label : ""
elide: Text.ElideMiddle
textFormat: Text.PlainText

color: UM.Theme.getColor("setting_control_text")
opacity: (definition.visible) ? 1 : 0.5
opacity: (definition && definition.visible) ? 1 : 0.5
// Emphasize the setting if it has a value in the user or quality profile
font: base.doQualityUserSettingEmphasis && base.stackLevel !== undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default")
}
Expand All @@ -179,7 +181,7 @@ Item
{
id: linkedSettingIcon;

visible: (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
visible: (!definition || !definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon

anchors.top: parent.top
anchors.bottom: parent.bottom
Expand All @@ -198,7 +200,7 @@ Item
if ((resolve !== "None") && (stackLevel !== 0))
{
// We come here if a setting has a resolve and the setting is not manually edited.
tooltipText += " " + catalog.i18nc("@label", "This setting is resolved from conflicting extruder-specific values:") + " [" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "]."
tooltipText += " " + catalog.i18nc("@label", "This setting is resolved from conflicting extruder-specific values:") + " [" + Cura.ExtruderManager.getInstanceExtruderValues(definition ? definition.key : "") + "]."
}
base.showTooltip(tooltipText)
}
Expand Down Expand Up @@ -280,11 +282,11 @@ Item
// If the setting does not have a limit_to_extruder property (or is -1), use the active stack.
if (globalPropertyProvider.properties.limit_to_extruder === null || globalPropertyProvider.properties.limit_to_extruder === "-1")
{
return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0
return definition && Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0
}

// Setting does have a limit_to_extruder property, so use that one instead.
if (definition.key === undefined) {
if (!definition || definition.key === undefined) {
// Observed when loading workspace, probably when SettingItems are removed.
return false
}
Expand Down
8 changes: 5 additions & 3 deletions resources/qml/Settings/SettingTextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ SettingItem
verticalCenter: parent.verticalCenter
}

text: definition.unit
text: definition ? definition.unit : ""
//However the setting value is aligned, align the unit opposite. That way it stays readable with right-to-left languages.
horizontalAlignment: (input.effectiveHorizontalAlignment == Text.AlignLeft) ? Text.AlignRight : Text.AlignLeft
textFormat: Text.PlainText
Expand Down Expand Up @@ -175,16 +175,18 @@ SettingItem
selectionColor: UM.Theme.getColor("text_selection")
selectByMouse: true

maximumLength: (definition.type == "str" || definition.type == "[int]") ? -1 : 12
maximumLength: (definition && (definition.type == "str" || definition.type == "[int]")) ? -1 : 12

// Since [int] & str don't have a max length, they need to be clipped (since clipping is expensive, this
// should be done as little as possible)
clip: definition.type == "str" || definition.type == "[int]"
clip: definition && (definition.type == "str" || definition.type == "[int]")

validator: RegularExpressionValidator
{
regularExpression:
{
if (!definition) return /.*/ // Allow anything if definition is null

switch (definition.type)
{
case "[int]":
Expand Down
Loading