mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 07:38:58 +08:00
Merge branch 'main' into CURA-10901-warn-if-formulas-are-NOK
This commit is contained in:
commit
37c177fe04
@ -26,27 +26,40 @@ class InsertAtLayerChange(Script):
|
|||||||
},
|
},
|
||||||
"gcode_to_add":
|
"gcode_to_add":
|
||||||
{
|
{
|
||||||
"label": "G-code to insert.",
|
"label": "G-code to insert",
|
||||||
"description": "G-code to add before or after layer change.",
|
"description": "G-code to add before or after layer change.",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": ""
|
"default_value": ""
|
||||||
|
},
|
||||||
|
"skip_layers":
|
||||||
|
{
|
||||||
|
"label": "Skip layers",
|
||||||
|
"description": "Number of layers to skip between insertions (0 for every layer).",
|
||||||
|
"type": "int",
|
||||||
|
"default_value": 0,
|
||||||
|
"minimum_value": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\n"
|
gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\n"
|
||||||
|
skip_layers = self.getSettingValueByKey("skip_layers")
|
||||||
|
count = 0
|
||||||
for layer in data:
|
for layer in data:
|
||||||
# Check that a layer is being printed
|
# Check that a layer is being printed
|
||||||
lines = layer.split("\n")
|
lines = layer.split("\n")
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if ";LAYER:" in line:
|
if ";LAYER:" in line:
|
||||||
index = data.index(layer)
|
index = data.index(layer)
|
||||||
if self.getSettingValueByKey("insert_location") == "before":
|
if count == 0:
|
||||||
layer = gcode_to_add + layer
|
if self.getSettingValueByKey("insert_location") == "before":
|
||||||
else:
|
layer = gcode_to_add + layer
|
||||||
layer = layer + gcode_to_add
|
else:
|
||||||
|
layer = layer + gcode_to_add
|
||||||
|
|
||||||
data[index] = layer
|
data[index] = layer
|
||||||
|
|
||||||
|
count = (count + 1) % (skip_layers + 1)
|
||||||
break
|
break
|
||||||
return data
|
return data
|
||||||
|
@ -129,7 +129,7 @@ ScrollView
|
|||||||
{
|
{
|
||||||
id: bedTemperature
|
id: bedTemperature
|
||||||
containerStack: Cura.MachineManager.activeMachine
|
containerStack: Cura.MachineManager.activeMachine
|
||||||
key: "material_bed_temperature"
|
key: "material_bed_temperature_layer_0"
|
||||||
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ Item
|
|||||||
{
|
{
|
||||||
id: extruderTemperature
|
id: extruderTemperature
|
||||||
containerStackId: Cura.ExtruderManager.extruderIds[position]
|
containerStackId: Cura.ExtruderManager.extruderIds[position]
|
||||||
key: "material_print_temperature"
|
key: "material_print_temperature_layer_0"
|
||||||
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import Cura 1.1 as Cura
|
|||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
property bool hasSearchFilter: false
|
||||||
// The currently selected machine item in the local machine list.
|
// The currently selected machine item in the local machine list.
|
||||||
property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null
|
property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null
|
||||||
// The currently active (expanded) section/category, where section/category is the grouping of local machine items.
|
// The currently active (expanded) section/category, where section/category is the grouping of local machine items.
|
||||||
@ -32,7 +32,7 @@ Item
|
|||||||
|
|
||||||
onCurrentItemChanged:
|
onCurrentItemChanged:
|
||||||
{
|
{
|
||||||
printerName = currentItem == null ? "" : currentItem.name
|
printerName = currentItem && currentItem.name? currentItem.name: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCurrentItemUponSectionChange(section)
|
function updateCurrentItemUponSectionChange(section)
|
||||||
@ -43,25 +43,28 @@ Item
|
|||||||
const item = machineList.model.getItem(i);
|
const item = machineList.model.getItem(i);
|
||||||
if (item.section == section)
|
if (item.section == section)
|
||||||
{
|
{
|
||||||
machineList.currentIndex = i;
|
updateCurrentItem(i)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMachineName()
|
function updateCurrentItem(index)
|
||||||
{
|
{
|
||||||
return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : "";
|
machineList.currentIndex = index;
|
||||||
}
|
currentItem = machineList.model.getItem(index);
|
||||||
|
if (currentItem && currentItem.name)
|
||||||
function getMachineMetaDataEntry(key)
|
|
||||||
{
|
|
||||||
var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined;
|
|
||||||
if (metadata)
|
|
||||||
{
|
{
|
||||||
return metadata[key];
|
machineName.text = currentItem.name
|
||||||
|
manufacturer.text = currentItem.metadata["manufacturer"]
|
||||||
|
author.text = currentItem.metadata["author"]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
machineName.text = "No printers Found"
|
||||||
|
manufacturer.text = ""
|
||||||
|
author.text = ""
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
@ -78,98 +81,204 @@ Item
|
|||||||
id: localPrinterSelectionItem
|
id: localPrinterSelectionItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
//Selecting a local printer to add from this list.
|
Column
|
||||||
ListView
|
|
||||||
{
|
{
|
||||||
id: machineList
|
id: root
|
||||||
width: Math.floor(parent.width * 0.48)
|
width: Math.floor(parent.width * 0.48)
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
Item
|
||||||
clip: true
|
|
||||||
ScrollBar.vertical: UM.ScrollBar {}
|
|
||||||
|
|
||||||
model: UM.DefinitionContainersModel
|
|
||||||
{
|
{
|
||||||
id: machineDefinitionsModel
|
width: root.width
|
||||||
filter: { "visible": true }
|
height: filter.height
|
||||||
sectionProperty: "manufacturer"
|
Cura.TextField
|
||||||
preferredSections: preferredCategories
|
|
||||||
}
|
|
||||||
|
|
||||||
section.property: "section"
|
|
||||||
section.delegate: Button
|
|
||||||
{
|
|
||||||
id: button
|
|
||||||
width: machineList.width
|
|
||||||
height: UM.Theme.getSize("action_button").height
|
|
||||||
text: section
|
|
||||||
|
|
||||||
property bool isActive: base.currentSections.has(section)
|
|
||||||
|
|
||||||
background: Rectangle
|
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
id: filter
|
||||||
color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent"
|
width: parent.width
|
||||||
}
|
implicitHeight: parent.height
|
||||||
|
background: Rectangle {
|
||||||
contentItem: Item
|
id: background
|
||||||
{
|
color: UM.Theme.getColor("main_background")
|
||||||
width: childrenRect.width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
height: UM.Theme.getSize("action_button").height
|
border.color: UM.Theme.getColor("primary_button")
|
||||||
|
}
|
||||||
|
height: UM.Theme.getSize("small_button_icon").height * 2
|
||||||
|
placeholderText: catalog.i18nc("@label:textbox", "Search Printer")
|
||||||
|
placeholderTextColor: UM.Theme.getColor("primary_button")
|
||||||
|
font: UM.Theme.getFont("medium_italic")
|
||||||
|
leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2
|
||||||
|
|
||||||
UM.ColorImage
|
UM.ColorImage
|
||||||
{
|
{
|
||||||
id: arrow
|
id: searchIcon
|
||||||
anchors.left: parent.left
|
source: UM.Theme.getIcon("Magnifier")
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
anchors
|
||||||
height: UM.Theme.getSize("standard_arrow").height
|
{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
|
height: UM.Theme.getSize("small_button_icon").height
|
||||||
|
width: height
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
source: isActive ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
onTextChanged: editingFinished()
|
||||||
|
onEditingFinished:
|
||||||
{
|
{
|
||||||
id: label
|
machineDefinitionsModel.filter = {"name" : "*" + text.toLowerCase() + "*", "visible": true}
|
||||||
anchors.left: arrow.right
|
base.hasSearchFilter = (text.length > 0)
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
updateDefinitionModel()
|
||||||
text: button.text
|
}
|
||||||
font: UM.Theme.getFont("default_bold")
|
|
||||||
|
Keys.onEscapePressed: filter.text = ""
|
||||||
|
function updateDefinitionModel()
|
||||||
|
{
|
||||||
|
if (base.hasSearchFilter)
|
||||||
|
{
|
||||||
|
base.currentSections.clear()
|
||||||
|
for (var i = 0; i < machineDefinitionsModel.count; i++)
|
||||||
|
{
|
||||||
|
var sectionexpanded = machineDefinitionsModel.getItem(i)["section"]
|
||||||
|
if (!base.currentSections.has(sectionexpanded))
|
||||||
|
{
|
||||||
|
base.currentSections.add(sectionexpanded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.updateCurrentItem(0)
|
||||||
|
|
||||||
|
// Trigger update on base.currentSections
|
||||||
|
base.currentSections = base.currentSections;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const initialSection = "Ultimaker B.V.";
|
||||||
|
base.currentSections.clear();
|
||||||
|
base.currentSections.add(initialSection);
|
||||||
|
updateCurrentItemUponSectionChange(initialSection);
|
||||||
|
updateCurrentItem(0)
|
||||||
|
// Trigger update on base.currentSections
|
||||||
|
base.currentSections = base.currentSections;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked:
|
UM.SimpleButton
|
||||||
{
|
{
|
||||||
if (base.currentSections.has(section))
|
id: clearFilterButton
|
||||||
|
iconSource: UM.Theme.getIcon("Cancel")
|
||||||
|
visible: base.hasSearchFilter
|
||||||
|
|
||||||
|
height: Math.round(filter.height * 0.5)
|
||||||
|
width: visible ? height : 0
|
||||||
|
|
||||||
|
anchors.verticalCenter: filter.verticalCenter
|
||||||
|
anchors.right: filter.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("setting_control_button")
|
||||||
|
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
||||||
|
|
||||||
|
onClicked:
|
||||||
{
|
{
|
||||||
base.currentSections.delete(section);
|
filter.text = ""
|
||||||
|
filter.forceActiveFocus()
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
base.currentSections.add(section);
|
|
||||||
base.updateCurrentItemUponSectionChange(section);
|
|
||||||
}
|
|
||||||
// Trigger update on base.currentSections
|
|
||||||
base.currentSections = base.currentSections;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Cura.RadioButton
|
//Selecting a local printer to add from this list.
|
||||||
|
ListView
|
||||||
{
|
{
|
||||||
id: radioButton
|
id: machineList
|
||||||
anchors
|
width: root.width
|
||||||
|
height: root.height - filter.height
|
||||||
|
clip: true
|
||||||
|
ScrollBar.vertical: UM.ScrollBar {}
|
||||||
|
|
||||||
|
model: UM.DefinitionContainersModel
|
||||||
{
|
{
|
||||||
left: parent !== null ? parent.left : undefined
|
id: machineDefinitionsModel
|
||||||
leftMargin: UM.Theme.getSize("standard_list_lineheight").width
|
filter: { "visible": true }
|
||||||
|
sectionProperty: "manufacturer"
|
||||||
right: parent !== null ? parent.right : undefined
|
preferredSections: preferredCategories
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
}
|
}
|
||||||
height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 //This causes the scrollbar to vary in length due to QTBUG-76830.
|
|
||||||
|
|
||||||
checked: machineList.currentIndex == index
|
section.property: "section"
|
||||||
text: name
|
section.delegate: Button
|
||||||
visible: base.currentSections.has(section)
|
{
|
||||||
onClicked: machineList.currentIndex = index
|
id: button
|
||||||
|
width: machineList.width
|
||||||
|
height: UM.Theme.getSize("action_button").height
|
||||||
|
text: section
|
||||||
|
|
||||||
|
property bool isActive: base.currentSections.has(section)
|
||||||
|
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent"
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Item
|
||||||
|
{
|
||||||
|
width: childrenRect.width
|
||||||
|
height: UM.Theme.getSize("action_button").height
|
||||||
|
|
||||||
|
UM.ColorImage
|
||||||
|
{
|
||||||
|
id: arrow
|
||||||
|
anchors.left: parent.left
|
||||||
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
source: isActive ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight")
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.Label
|
||||||
|
{
|
||||||
|
id: label
|
||||||
|
anchors.left: arrow.right
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
text: button.text
|
||||||
|
font: UM.Theme.getFont("default_bold")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
if (base.currentSections.has(section))
|
||||||
|
{
|
||||||
|
base.currentSections.delete(section);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.currentSections.add(section);
|
||||||
|
base.updateCurrentItemUponSectionChange(section);
|
||||||
|
}
|
||||||
|
// Trigger update on base.currentSections
|
||||||
|
base.currentSections = base.currentSections;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: Cura.RadioButton
|
||||||
|
{
|
||||||
|
id: radioButton
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
left: parent !== null ? parent.left : undefined
|
||||||
|
leftMargin: UM.Theme.getSize("standard_list_lineheight").width
|
||||||
|
|
||||||
|
right: parent !== null ? parent.right : undefined
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
|
height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 //This causes the scrollbar to vary in length due to QTBUG-76830.
|
||||||
|
|
||||||
|
checked: machineList.currentIndex == index
|
||||||
|
text: name
|
||||||
|
visible: base.currentSections.has(section)
|
||||||
|
onClicked: base.updateCurrentItem(index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,8 +302,8 @@ Item
|
|||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
|
id: machineName
|
||||||
width: parent.width - (2 * UM.Theme.getSize("default_margin").width)
|
width: parent.width - (2 * UM.Theme.getSize("default_margin").width)
|
||||||
text: base.getMachineName()
|
|
||||||
color: UM.Theme.getColor("primary_button")
|
color: UM.Theme.getColor("primary_button")
|
||||||
font: UM.Theme.getFont("huge")
|
font: UM.Theme.getFont("huge")
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
@ -215,7 +324,7 @@ Item
|
|||||||
}
|
}
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
text: base.getMachineMetaDataEntry("manufacturer")
|
id: manufacturer
|
||||||
width: parent.width - manufacturerLabel.width
|
width: parent.width - manufacturerLabel.width
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
@ -226,7 +335,7 @@ Item
|
|||||||
}
|
}
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
text: base.getMachineMetaDataEntry("author")
|
id: author
|
||||||
width: parent.width - profileAuthorLabel.width
|
width: parent.width - profileAuthorLabel.width
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,12 @@
|
|||||||
"italic": true,
|
"italic": true,
|
||||||
"family": "Noto Sans"
|
"family": "Noto Sans"
|
||||||
},
|
},
|
||||||
|
"medium_italic": {
|
||||||
|
"size": 1.16,
|
||||||
|
"weight": 400,
|
||||||
|
"italic": true,
|
||||||
|
"family": "Noto Sans"
|
||||||
|
},
|
||||||
"default_italic_ja_JP": {
|
"default_italic_ja_JP": {
|
||||||
"size": 1.0,
|
"size": 1.0,
|
||||||
"weight": 400,
|
"weight": 400,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user