From 56fa7036b3545ebdfad420fa28e8efc3b35bfcfa Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 23 Oct 2017 20:55:08 +0200 Subject: [PATCH 01/30] Add controls for jogging the head/bed --- resources/qml/PrintMonitor.qml | 277 +++++++++++++++++++++ resources/themes/cura-light/icons/home.svg | 56 +++++ 2 files changed, 333 insertions(+) create mode 100644 resources/themes/cura-light/icons/home.svg diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index a2626e53de..e8ab76a264 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -677,6 +677,192 @@ Column watchedProperties: ["value"] } + Loader + { + sourceComponent: monitorSection + property string label: catalog.i18nc("@label", "Printer control") + } + + Row + { + width: base.width - 2 * UM.Theme.getSize("default_margin").width + height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + spacing: UM.Theme.getSize("default_margin").width + + Label + { + text: catalog.i18nc("@label", "Position") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + + width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + } + + GridLayout + { + columns: 3 + rows: 4 + rowSpacing: UM.Theme.getSize("default_lining").width + columnSpacing: UM.Theme.getSize("default_lining").height + + Label + { + text: catalog.i18nc("@label", "X/Y") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + width: parent.width + horizontalAlignment: Text.AlignHCenter + + Layout.row: 1 + Layout.column: 2 + Layout.preferredWidth: UM.Theme.getSize("section").height + } + + Button + { + Layout.row: 2 + Layout.column: 2 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_top"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, 10, 0) + } + } + + Button + { + Layout.row: 3 + Layout.column: 1 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_left"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(-10, 0, 0) + } + } + + Button + { + Layout.row: 3 + Layout.column: 3 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_right"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(10, 0, 0) + } + } + + Button + { + Layout.row: 4 + Layout.column: 2 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_bottom"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, -10, 0) + } + } + + Button + { + Layout.row: 3 + Layout.column: 2 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("home"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.homeHead() + } + } + } + + + Column + { + spacing: UM.Theme.getSize("default_lining").height + + Label + { + text: catalog.i18nc("@label", "Z") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + width: UM.Theme.getSize("section").height + + horizontalAlignment: Text.AlignHCenter + } + + Button + { + iconSource: UM.Theme.getIcon("arrow_top"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, 0, 10) + } + } + + Button + { + iconSource: UM.Theme.getIcon("home"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.homeBed() + } + } + + Button + { + iconSource: UM.Theme.getIcon("arrow_bottom"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, 0, -10) + } + } + } + } + Loader { sourceComponent: monitorSection @@ -754,4 +940,95 @@ Column } } } + + Component + { + id: monitorButtonStyle + + ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_border"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border"); + } + else + { + return UM.Theme.getColor("action_button_border"); + } + } + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered"); + } + else + { + return UM.Theme.getColor("action_button"); + } + } + Behavior on color + { + ColorAnimation + { + duration: 50 + } + } + } + + label: Item + { + UM.RecolorImage + { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: Math.floor(control.width / 2) + height: Math.floor(control.height / 2) + sourceSize.width: width + sourceSize.height: width + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_text"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + else + { + return UM.Theme.getColor("action_button_text"); + } + } + source: control.iconSource + } + } + } + } } \ No newline at end of file diff --git a/resources/themes/cura-light/icons/home.svg b/resources/themes/cura-light/icons/home.svg new file mode 100644 index 0000000000..617c3ce9da --- /dev/null +++ b/resources/themes/cura-light/icons/home.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + From 9cd88693825de607be097a0935723d7f8fc04e7e Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 23 Oct 2017 22:27:05 +0200 Subject: [PATCH 02/30] Add settable jog distance --- resources/qml/PrintMonitor.qml | 95 +++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 7 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index e8ab76a264..84097798bf 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -694,7 +694,7 @@ Column Label { - text: catalog.i18nc("@label", "Position") + text: catalog.i18nc("@label", "Jog position") color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") @@ -734,7 +734,7 @@ Column onClicked: { - connectedPrinter.moveHead(0, 10, 0) + connectedPrinter.moveHead(0, distancesRow.currentDistance, 0) } } @@ -751,7 +751,7 @@ Column onClicked: { - connectedPrinter.moveHead(-10, 0, 0) + connectedPrinter.moveHead(-distancesRow.currentDistance, 0, 0) } } @@ -768,7 +768,7 @@ Column onClicked: { - connectedPrinter.moveHead(10, 0, 0) + connectedPrinter.moveHead(distancesRow.currentDistance, 0, 0) } } @@ -785,7 +785,7 @@ Column onClicked: { - connectedPrinter.moveHead(0, -10, 0) + connectedPrinter.moveHead(0, -distancesRow.currentDistance, 0) } } @@ -831,7 +831,7 @@ Column onClicked: { - connectedPrinter.moveHead(0, 0, 10) + connectedPrinter.moveHead(0, 0, distancesRow.currentDistance) } } @@ -857,12 +857,93 @@ Column onClicked: { - connectedPrinter.moveHead(0, 0, -10) + connectedPrinter.moveHead(0, 0, -distancesRow.currentDistance) } } } } + Row + { + id: distancesRow + + width: base.width - 2 * UM.Theme.getSize("default_margin").width + height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + spacing: UM.Theme.getSize("default_margin").width + + property real currentDistance: 10 + + Label + { + text: catalog.i18nc("@label", "Jog distance") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + + width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + } + + Row + { + Repeater + { + model: distancesModel + delegate: Button + { + height: UM.Theme.getSize("setting_control").height + width: height + UM.Theme.getSize("default_margin").width + + text: model.label + exclusiveGroup: distanceGroup + checkable: true + checked: distancesRow.currentDistance == model.value + onClicked: distancesRow.currentDistance = model.value + + style: ButtonStyle { + background: Rectangle { + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : + UM.Theme.getColor("action_button_border") + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : + UM.Theme.getColor("action_button") + Behavior on color { ColorAnimation { duration: 50; } } + Label { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 + anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : + UM.Theme.getColor("action_button_text") + font: UM.Theme.getFont("default") + text: control.text + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideMiddle + } + } + label: Item { } + } + } + } + } + + ListModel + { + id: distancesModel + ListElement { label: "0.1"; value: 0.1 } + ListElement { label: "1"; value: 1 } + ListElement { label: "10"; value: 10 } + ListElement { label: "100"; value: 100 } + } + ExclusiveGroup { id: distanceGroup } + } + + Loader { sourceComponent: monitorSection From 6294900bc72f4b791ccf6c820a69bc488d68faef Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 24 Oct 2017 10:23:07 +0200 Subject: [PATCH 03/30] Disable controls when manual control is not available --- resources/qml/PrintMonitor.qml | 470 +++++++++++++++++---------------- 1 file changed, 245 insertions(+), 225 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 84097798bf..412b6e9a59 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -683,250 +683,270 @@ Column property string label: catalog.i18nc("@label", "Printer control") } - Row + Column { - width: base.width - 2 * UM.Theme.getSize("default_margin").width - height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - - spacing: UM.Theme.getSize("default_margin").width - - Label + enabled: { - text: catalog.i18nc("@label", "Jog position") - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - - width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width - } - - GridLayout - { - columns: 3 - rows: 4 - rowSpacing: UM.Theme.getSize("default_lining").width - columnSpacing: UM.Theme.getSize("default_lining").height - - Label + if (connectedPrinter == null) { - text: catalog.i18nc("@label", "X/Y") - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - width: parent.width - horizontalAlignment: Text.AlignHCenter - - Layout.row: 1 - Layout.column: 2 - Layout.preferredWidth: UM.Theme.getSize("section").height + return false; //Can't control the printer if not connected. } - - Button + if (!connectedPrinter.acceptsCommands) { - Layout.row: 2 - Layout.column: 2 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("arrow_top"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.moveHead(0, distancesRow.currentDistance, 0) - } + return false; //Not allowed to do anything. } - - Button + if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline") { - Layout.row: 3 - Layout.column: 1 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("arrow_left"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.moveHead(-distancesRow.currentDistance, 0, 0) - } + return false; //Printer is in a state where it can't react to manual control } - - Button - { - Layout.row: 3 - Layout.column: 3 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("arrow_right"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.moveHead(distancesRow.currentDistance, 0, 0) - } - } - - Button - { - Layout.row: 4 - Layout.column: 2 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("arrow_bottom"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.moveHead(0, -distancesRow.currentDistance, 0) - } - } - - Button - { - Layout.row: 3 - Layout.column: 2 - Layout.preferredWidth: width - Layout.preferredHeight: height - iconSource: UM.Theme.getIcon("home"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.homeHead() - } - } - } - - - Column - { - spacing: UM.Theme.getSize("default_lining").height - - Label - { - text: catalog.i18nc("@label", "Z") - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - width: UM.Theme.getSize("section").height - - horizontalAlignment: Text.AlignHCenter - } - - Button - { - iconSource: UM.Theme.getIcon("arrow_top"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.moveHead(0, 0, distancesRow.currentDistance) - } - } - - Button - { - iconSource: UM.Theme.getIcon("home"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.homeBed() - } - } - - Button - { - iconSource: UM.Theme.getIcon("arrow_bottom"); - style: monitorButtonStyle - width: height - height: UM.Theme.getSize("setting_control").height - - onClicked: - { - connectedPrinter.moveHead(0, 0, -distancesRow.currentDistance) - } - } - } - } - - Row - { - id: distancesRow - - width: base.width - 2 * UM.Theme.getSize("default_margin").width - height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - - spacing: UM.Theme.getSize("default_margin").width - - property real currentDistance: 10 - - Label - { - text: catalog.i18nc("@label", "Jog distance") - color: UM.Theme.getColor("setting_control_text") - font: UM.Theme.getFont("default") - - width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + return true; } Row { - Repeater + width: base.width - 2 * UM.Theme.getSize("default_margin").width + height: childrenRect.height + UM.Theme.getSize("default_margin").width + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + spacing: UM.Theme.getSize("default_margin").width + + Label { - model: distancesModel - delegate: Button + text: catalog.i18nc("@label", "Jog position") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + + width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + } + + GridLayout + { + columns: 3 + rows: 4 + rowSpacing: UM.Theme.getSize("default_lining").width + columnSpacing: UM.Theme.getSize("default_lining").height + + Label { + text: catalog.i18nc("@label", "X/Y") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + width: parent.width + horizontalAlignment: Text.AlignHCenter + + Layout.row: 1 + Layout.column: 2 + Layout.preferredWidth: UM.Theme.getSize("section").height + } + + Button + { + Layout.row: 2 + Layout.column: 2 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_top"); + style: monitorButtonStyle + width: height height: UM.Theme.getSize("setting_control").height - width: height + UM.Theme.getSize("default_margin").width - text: model.label - exclusiveGroup: distanceGroup - checkable: true - checked: distancesRow.currentDistance == model.value - onClicked: distancesRow.currentDistance = model.value + onClicked: + { + connectedPrinter.moveHead(0, distancesRow.currentDistance, 0) + } + } - style: ButtonStyle { - background: Rectangle { - border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : - UM.Theme.getColor("action_button_border") - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : - UM.Theme.getColor("action_button") - Behavior on color { ColorAnimation { duration: 50; } } - Label { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : - control.hovered ? UM.Theme.getColor("action_button_hovered_text") : - UM.Theme.getColor("action_button_text") - font: UM.Theme.getFont("default") - text: control.text - horizontalAlignment: Text.AlignHCenter - elide: Text.ElideMiddle + Button + { + Layout.row: 3 + Layout.column: 1 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_left"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(-distancesRow.currentDistance, 0, 0) + } + } + + Button + { + Layout.row: 3 + Layout.column: 3 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_right"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(distancesRow.currentDistance, 0, 0) + } + } + + Button + { + Layout.row: 4 + Layout.column: 2 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("arrow_bottom"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, -distancesRow.currentDistance, 0) + } + } + + Button + { + Layout.row: 3 + Layout.column: 2 + Layout.preferredWidth: width + Layout.preferredHeight: height + iconSource: UM.Theme.getIcon("home"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.homeHead() + } + } + } + + + Column + { + spacing: UM.Theme.getSize("default_lining").height + + Label + { + text: catalog.i18nc("@label", "Z") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + width: UM.Theme.getSize("section").height + + horizontalAlignment: Text.AlignHCenter + } + + Button + { + iconSource: UM.Theme.getIcon("arrow_top"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, 0, distancesRow.currentDistance) + } + } + + Button + { + iconSource: UM.Theme.getIcon("home"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.homeBed() + } + } + + Button + { + iconSource: UM.Theme.getIcon("arrow_bottom"); + style: monitorButtonStyle + width: height + height: UM.Theme.getSize("setting_control").height + + onClicked: + { + connectedPrinter.moveHead(0, 0, -distancesRow.currentDistance) + } + } + } + } + + Row + { + id: distancesRow + + width: base.width - 2 * UM.Theme.getSize("default_margin").width + height: childrenRect.height + UM.Theme.getSize("default_margin").width + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + spacing: UM.Theme.getSize("default_margin").width + + property real currentDistance: 10 + + Label + { + text: catalog.i18nc("@label", "Jog distance") + color: UM.Theme.getColor("setting_control_text") + font: UM.Theme.getFont("default") + + width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + } + + Row + { + Repeater + { + model: distancesModel + delegate: Button + { + height: UM.Theme.getSize("setting_control").height + width: height + UM.Theme.getSize("default_margin").width + + text: model.label + exclusiveGroup: distanceGroup + checkable: true + checked: distancesRow.currentDistance == model.value + onClicked: distancesRow.currentDistance = model.value + + style: ButtonStyle { + background: Rectangle { + border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width + border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : + UM.Theme.getColor("action_button_border") + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : + UM.Theme.getColor("action_button") + Behavior on color { ColorAnimation { duration: 50; } } + Label { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 + anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 + color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : + UM.Theme.getColor("action_button_text") + font: UM.Theme.getFont("default") + text: control.text + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideMiddle + } } + label: Item { } } - label: Item { } } } } From a9f2ad7ca348f974949d811b913f01e53d7ffa81 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 24 Oct 2017 11:03:51 +0200 Subject: [PATCH 04/30] Hide manual controls for outputdevices that don't support it --- cura/PrinterOutputDevice.py | 6 ++++++ .../NetworkClusterPrinterOutputDevice.py | 1 + resources/qml/PrintMonitor.qml | 13 +++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index c6e98257ba..837ecc97c6 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -74,6 +74,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self._can_pause = True self._can_abort = True self._can_pre_heat_bed = True + self._can_control_manually = True def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None): raise NotImplementedError("requestWrite needs to be implemented") @@ -144,6 +145,11 @@ class PrinterOutputDevice(QObject, OutputDevice): def canAbort(self): return self._can_abort + # Does the printer support manual control at all + @pyqtProperty(bool, constant=True) + def canControlManually(self): + return self._can_control_manually + @pyqtProperty(QObject, constant=True) def monitorItem(self): # Note that we specifically only check if the monitor component is created. diff --git a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py index cfa793996b..dee6b30e4b 100644 --- a/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkClusterPrinterOutputDevice.py @@ -103,6 +103,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte self._can_pause = True self._can_abort = True self._can_pre_heat_bed = False + self._can_control_manually = False self._cluster_size = int(properties.get(b"cluster_size", 0)) self._cleanupRequest() diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 412b6e9a59..f926444847 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -677,14 +677,9 @@ Column watchedProperties: ["value"] } - Loader - { - sourceComponent: monitorSection - property string label: catalog.i18nc("@label", "Printer control") - } - Column { + visible: connectedPrinter != null ? connectedPrinter.canControlManually : false enabled: { if (connectedPrinter == null) @@ -702,6 +697,12 @@ Column return true; } + Loader + { + sourceComponent: monitorSection + property string label: catalog.i18nc("@label", "Printer control") + } + Row { width: base.width - 2 * UM.Theme.getSize("default_margin").width From 46fc478f9d0974d50208d5cee3936db357d67970 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 24 Oct 2017 11:15:33 +0200 Subject: [PATCH 05/30] Tweak disabled appearance --- resources/qml/PrintMonitor.qml | 72 ++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index f926444847..b0b68d0338 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -924,12 +924,38 @@ Column style: ButtonStyle { background: Rectangle { border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width - border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : - UM.Theme.getColor("action_button_border") - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : - UM.Theme.getColor("action_button") + border.color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_border"); + } + else if (control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border"); + } + return UM.Theme.getColor("action_button_border"); + } + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled"); + } + else if (control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } + else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered"); + } + return UM.Theme.getColor("action_button"); + } Behavior on color { ColorAnimation { duration: 50; } } Label { anchors.left: parent.left @@ -937,9 +963,22 @@ Column anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2 anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") : - control.hovered ? UM.Theme.getColor("action_button_hovered_text") : - UM.Theme.getColor("action_button_text") + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_text"); + } + else if (control.checked || control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if (control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + return UM.Theme.getColor("action_button_text"); + } font: UM.Theme.getFont("default") text: control.text horizontalAlignment: Text.AlignHCenter @@ -1066,10 +1105,7 @@ Column { return UM.Theme.getColor("action_button_hovered_border"); } - else - { - return UM.Theme.getColor("action_button_border"); - } + return UM.Theme.getColor("action_button_border"); } color: { @@ -1085,10 +1121,7 @@ Column { return UM.Theme.getColor("action_button_hovered"); } - else - { - return UM.Theme.getColor("action_button"); - } + return UM.Theme.getColor("action_button"); } Behavior on color { @@ -1123,10 +1156,7 @@ Column { return UM.Theme.getColor("action_button_hovered_text"); } - else - { - return UM.Theme.getColor("action_button_text"); - } + return UM.Theme.getColor("action_button_text"); } source: control.iconSource } From 7dc4975b361570759ee602231f2efbf09d3afa61 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 24 Oct 2017 11:33:47 +0200 Subject: [PATCH 06/30] Tweak layout and texts --- resources/qml/PrintMonitor.qml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index b0b68d0338..ce169ba714 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -714,11 +714,13 @@ Column Label { - text: catalog.i18nc("@label", "Jog position") + text: catalog.i18nc("@label", "Jog Position") color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("setting_control").height + verticalAlignment: Text.AlignVCenter } GridLayout @@ -733,12 +735,15 @@ Column text: catalog.i18nc("@label", "X/Y") color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") - width: parent.width + width: height + height: UM.Theme.getSize("setting_control").height + verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter Layout.row: 1 Layout.column: 2 - Layout.preferredWidth: UM.Theme.getSize("section").height + Layout.preferredWidth: width + Layout.preferredHeight: height } Button @@ -838,7 +843,8 @@ Column color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") width: UM.Theme.getSize("section").height - + height: UM.Theme.getSize("setting_control").height + verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } @@ -898,11 +904,13 @@ Column Label { - text: catalog.i18nc("@label", "Jog distance") + text: catalog.i18nc("@label", "Jog Distance") color: UM.Theme.getColor("setting_control_text") font: UM.Theme.getFont("default") width: Math.floor(parent.width * 0.4) - UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("setting_control").height + verticalAlignment: Text.AlignVCenter } Row From 15abbe6d6b72c1dd274bd27e83e71b7cecb061c5 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 24 Oct 2017 12:50:53 +0200 Subject: [PATCH 07/30] Optimise icon --- resources/themes/cura-light/icons/home.svg | 57 +--------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/resources/themes/cura-light/icons/home.svg b/resources/themes/cura-light/icons/home.svg index 617c3ce9da..a355aa07f6 100644 --- a/resources/themes/cura-light/icons/home.svg +++ b/resources/themes/cura-light/icons/home.svg @@ -1,56 +1,3 @@ - - - - - - image/svg+xml - - - - - - - - + + From 0f807cd03e377118e671c4e8e5ab57f7c11f5fbb Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 24 Oct 2017 17:38:06 +0200 Subject: [PATCH 08/30] Wfter changing the view the old view is removed from rendering CURA-4062 --- plugins/LayerView/LayerView.py | 1 + plugins/XRayView/XRayView.py | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index d23dd90915..7543907780 100755 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -335,6 +335,7 @@ class LayerView(View): if self._global_container_stack: self._global_container_stack.propertyChanged.disconnect(self._onPropertyChanged) + self.getRenderer().removeRenderPass(self._layer_pass) self._composite_pass.setLayerBindings(self._old_layer_bindings) self._composite_pass.setCompositeShader(self._old_composite_shader) diff --git a/plugins/XRayView/XRayView.py b/plugins/XRayView/XRayView.py index ed8d14b8b4..e7715209d0 100644 --- a/plugins/XRayView/XRayView.py +++ b/plugins/XRayView/XRayView.py @@ -74,5 +74,6 @@ class XRayView(View): self._composite_pass.setCompositeShader(self._xray_composite_shader) if event.type == Event.ViewDeactivateEvent: + self.getRenderer().removeRenderPass(self._xray_pass) self._composite_pass.setLayerBindings(self._old_layer_bindings) self._composite_pass.setCompositeShader(self._old_composite_shader) From d2873dc65a7e553555e44b5faf6c781d6a04eaaa Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 25 Oct 2017 11:06:12 +0200 Subject: [PATCH 09/30] The view class were not added after to the rendering list after changing them CURA-4062 --- plugins/LayerView/LayerView.py | 5 +++-- plugins/XRayView/XRayView.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 7543907780..a7dbb88209 100755 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -112,7 +112,7 @@ class LayerView(View): self._layer_pass = LayerPass.LayerPass(1, 1) self._compatibility_mode = OpenGLContext.isLegacyOpenGL() or bool(Preferences.getInstance().getValue("view/force_layer_view_compatibility_mode")) self._layer_pass.setLayerView(self) - self.getRenderer().addRenderPass(self._layer_pass) + #self.getRenderer().addRenderPass(self._layer_pass) return self._layer_pass def getCurrentLayer(self): @@ -310,7 +310,8 @@ class LayerView(View): if event.type == Event.ViewActivateEvent: # Make sure the LayerPass is created - self.getLayerPass() + layer_pass = self.getLayerPass() + self.getRenderer().addRenderPass(layer_pass) Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged) self._onGlobalStackChanged() diff --git a/plugins/XRayView/XRayView.py b/plugins/XRayView/XRayView.py index e7715209d0..2983772647 100644 --- a/plugins/XRayView/XRayView.py +++ b/plugins/XRayView/XRayView.py @@ -56,6 +56,8 @@ class XRayView(View): # Currently the RenderPass constructor requires a size > 0 # This should be fixed in RenderPass's constructor. self._xray_pass = XRayPass.XRayPass(1, 1) + + if self._xray_pass: self.getRenderer().addRenderPass(self._xray_pass) if not self._xray_composite_shader: From 938ae5af1deaffe53ef3244f6ff0f59e06442f12 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Thu, 26 Oct 2017 14:36:23 +0200 Subject: [PATCH 10/30] Added function to catch prepare and monitor button click CURA-4062 --- resources/qml/Topbar.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 5dacfc72ea..c69c786d5a 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -30,9 +30,11 @@ Rectangle Component.onCompleted: { startMonitoringPrint.connect(function () { base.monitoringPrint = true + UM.Controller.disableModelRendering() }) stopMonitoringPrint.connect(function () { base.monitoringPrint = false + UM.Controller.enableModelRendering() }) } From ee228155af1677f3f375fb0b28b53ecef744d4d2 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 27 Oct 2017 09:24:31 +0200 Subject: [PATCH 11/30] Remove unnecessary properties which after update triggered view rendering CURA-4062 --- resources/qml/Cura.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index cb0211f29f..934fc58017 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -344,9 +344,6 @@ UM.MainWindow { id: toolbar; - property int mouseX: base.mouseX - property int mouseY: base.mouseY - anchors { top: openFileButton.bottom; topMargin: UM.Theme.getSize("window_margin").height; From 177295999b3e81e116442d0cc17eea8a76046a38 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 29 Oct 2017 09:19:50 +0100 Subject: [PATCH 12/30] Allow richer markup in tooltips --- resources/qml/SidebarTooltip.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/SidebarTooltip.qml b/resources/qml/SidebarTooltip.qml index 60d01dd6f6..07b95777b5 100644 --- a/resources/qml/SidebarTooltip.qml +++ b/resources/qml/SidebarTooltip.qml @@ -54,6 +54,7 @@ UM.PointingRectangle { rightMargin: UM.Theme.getSize("tooltip_margins").width; } wrapMode: Text.Wrap; + textFormat: Text.RichText font: UM.Theme.getFont("default"); color: UM.Theme.getColor("tooltip_text"); } From 208d365d51b61b077a0f6a627ddca91f524a5707 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 29 Oct 2017 09:20:59 +0100 Subject: [PATCH 13/30] Make sure saveRow does not extend sidebar --- resources/qml/SaveButton.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index acc97ebf11..63c44a6720 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -18,6 +18,8 @@ Item { property var backend: CuraApplication.getBackend(); property bool activity: CuraApplication.platformActivity; + property alias buttonRowWidth: saveRow.width + property string fileBaseName property string statusText: { @@ -89,11 +91,12 @@ Item { Item { id: saveRow - width: base.width + width: Math.min(childrenRect.width + UM.Theme.getSize("sidebar_margin").width, base.width - UM.Theme.getSize("sidebar_margin").width) height: saveToButton.height anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height - anchors.left: parent.left + anchors.right: parent.right + clip: true Row { id: additionalComponentsRow From 6a0ba435084d9b5a2007183828fae1c70dfdf07f Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 29 Oct 2017 10:07:42 +0100 Subject: [PATCH 14/30] Make sure monitor buttons do not extend sidebar --- resources/qml/MonitorButton.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 29b00f50e6..7a620c42ea 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -185,17 +185,20 @@ Item anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width; } - Row { + Item { id: buttonsRow height: abortButton.height + width: Math.min(childrenRect.width, base.width - 2 * UM.Theme.getSize("sidebar_margin").width) anchors.top: progressBar.bottom anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width - spacing: UM.Theme.getSize("default_margin").width + clip: true Row { id: additionalComponentsRow + anchors.right: pauseResumeButton.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width } @@ -215,6 +218,8 @@ Item { id: pauseResumeButton + anchors.right: abortButton.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("save_button_save_to_button").height property bool userClicked: false @@ -261,6 +266,8 @@ Item { id: abortButton + anchors.right: parent.right + visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].canAbort enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands && (["paused", "printing", "pre_print"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0) From 03724755604a31f2adc6e9293645ea9586bbe149 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 29 Oct 2017 10:09:52 +0100 Subject: [PATCH 15/30] Rearrange print specs area * remove superfluous "Print time" label * format print time tooltip * add elide to cost spec * add (empty) cost spec tooltip --- resources/qml/Sidebar.qml | 64 +++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 403c18a4ff..ed6b07cc4e 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -313,31 +313,32 @@ Rectangle anchors.bottomMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 2 + UM.Theme.getSize("progressbar").height + UM.Theme.getFont("default_bold").pixelSize) } - Rectangle + Item { id: printSpecs anchors.left: parent.left anchors.bottom: parent.bottom anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height - height: timeDetails.height + timeSpecDescription.height + lengthSpec.height + height: timeDetails.height + costSpec.height + width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width) visible: !monitoringPrint + clip: true Label { id: timeDetails anchors.left: parent.left - anchors.bottom: timeSpecDescription.top + anchors.bottom: costSpec.top font: UM.Theme.getFont("large") color: UM.Theme.getColor("text_subtext") text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) MouseArea { - id: infillMouseArea + id: timeDetailsMouseArea anchors.fill: parent hoverEnabled: true - //enabled: base.settingsEnabled onEntered: { @@ -345,19 +346,24 @@ Rectangle if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) { // All the time information for the different features is achieved - var print_time = PrintInformation.getFeaturePrintTimes() + var print_time = PrintInformation.getFeaturePrintTimes(); + var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds)) // A message is created and displayed when the user hover the time label - var content = catalog.i18nc("@tooltip", "Time information") + var content = catalog.i18nc("@tooltip", "Time specification
"); for(var feature in print_time) { if(!print_time[feature].isTotalDurationZero) { - content += "
" + feature + ": " + print_time[feature].getDisplayString(UM.DurationFormat.Short) + content += ""; } } + content += "
" + feature + + "  " + print_time[feature].getDisplayString(UM.DurationFormat.Short) + + "  " + Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds) + "%" + + "
"; - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content) + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content); } } onExited: @@ -369,20 +375,13 @@ Rectangle Label { - id: timeSpecDescription - anchors.left: parent.left - anchors.bottom: lengthSpec.top - font: UM.Theme.getFont("very_small") - color: UM.Theme.getColor("text_subtext") - text: catalog.i18nc("@description", "Print time") - } - Label - { - id: lengthSpec + id: costSpec anchors.left: parent.left anchors.bottom: parent.bottom font: UM.Theme.getFont("very_small") color: UM.Theme.getColor("text_subtext") + elide: Text.ElideMiddle + width: parent.width text: { var lengths = []; @@ -421,6 +420,33 @@ Rectangle return catalog.i18nc("@label Print estimates: m for meters, g for grams", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + ")); } } + MouseArea + { + id: costSpecMouseArea + anchors.fill: parent + hoverEnabled: true + + onEntered: + { + + if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) + { + // All the time information for the different features is achieved + var print_time = PrintInformation.getFeaturePrintTimes(); + var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds)) + + // A message is created and displayed when the user hover the time label + var content = catalog.i18nc("@tooltip", "Cost specification
"); + content += "
"; + + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content); + } + } + onExited: + { + base.hideTooltip(); + } + } } } From 6d4ea381f0b9420b2ae89805915a985b743eb4c9 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 29 Oct 2017 11:44:36 +0100 Subject: [PATCH 16/30] Create cost specification tooltip --- resources/qml/Sidebar.qml | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index ed6b07cc4e..582fb346c5 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -355,7 +355,7 @@ Rectangle { if(!print_time[feature].isTotalDurationZero) { - content += "" + feature + + content += "" + feature + ":" + "  " + print_time[feature].getDisplayString(UM.DurationFormat.Short) + "  " + Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds) + "%" + ""; @@ -382,12 +382,16 @@ Rectangle color: UM.Theme.getColor("text_subtext") elide: Text.ElideMiddle width: parent.width + property string tooltipText: "test" text: { var lengths = []; + var total_length = 0; var weights = []; + var total_weight = 0; var costs = []; - var someCostsKnown = false; + var total_cost = 0; + var some_costs_known = false; if(base.printMaterialLengths) { for(var index = 0; index < base.printMaterialLengths.length; index++) { @@ -399,8 +403,12 @@ Rectangle costs.push(cost); if(cost > 0) { - someCostsKnown = true; + some_costs_known = true; } + + total_length += base.printMaterialLengths[index]; + total_weight += base.printMaterialWeights[index]; + total_cost += base.printMaterialCosts[index]; } } } @@ -410,10 +418,21 @@ Rectangle weights = ["0"]; costs = ["0.00"]; } - if(someCostsKnown) + + tooltipText = catalog.i18nc("@tooltip", "Cost specification
"); + for(var index = 0; index < lengths.length; index++) + { + tooltipText += catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "").arg(index + 1).arg(lengths[index]) + .arg(weights[index]).arg(costs[index]).arg(UM.Preferences.getValue("cura/currency")); + } + tooltipText += catalog.i18nc("@label Print totals: m for meters, g for grams, %4 is currency and %3 is print cost", "").arg(total_length.toFixed(2)) + .arg(Math.round(total_weight)).arg(total_cost.toFixed(2)).arg(UM.Preferences.getValue("cura/currency")); + tooltipText += "
Extruder %0:  %1m  %2g  %4 %3
Total:  %1m  %2g  %4 %3
"; + + if(some_costs_known) { return catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); + .arg(Math.round(total_weight)).arg(total_cost.toFixed(2)).arg(UM.Preferences.getValue("cura/currency")); } else { @@ -431,15 +450,7 @@ Rectangle if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) { - // All the time information for the different features is achieved - var print_time = PrintInformation.getFeaturePrintTimes(); - var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds)) - - // A message is created and displayed when the user hover the time label - var content = catalog.i18nc("@tooltip", "Cost specification
"); - content += "
"; - - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), content); + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), costSpec.tooltipText); } } onExited: From 84002a70d0462ff44d98b90fd9144b98a2e7e8f1 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 30 Oct 2017 11:50:57 +0100 Subject: [PATCH 17/30] Remove binding loop by cleaning up tooltipText creation --- resources/qml/Sidebar.qml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 582fb346c5..14179d388d 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -382,7 +382,7 @@ Rectangle color: UM.Theme.getColor("text_subtext") elide: Text.ElideMiddle width: parent.width - property string tooltipText: "test" + property string tooltipText text: { var lengths = []; @@ -419,15 +419,32 @@ Rectangle costs = ["0.00"]; } - tooltipText = catalog.i18nc("@tooltip", "Cost specification
"); + var tooltip_html = "%1
".arg(catalog.i18nc("@label", "Cost specification")); for(var index = 0; index < lengths.length; index++) { - tooltipText += catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "").arg(index + 1).arg(lengths[index]) - .arg(weights[index]).arg(costs[index]).arg(UM.Preferences.getValue("cura/currency")); + var item_strings = [ + catalog.i18nc("@label", "Extruder %1:").arg(index + 1), + catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]), + catalog.i18nc("@label g for grams", "%1g").arg(weights[index]), + "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]), + ]; + tooltip_html += ""; + for(var item = 0; item < item_strings.length; item++) { + tooltip_html += "".arg(item_strings[item]); + } } - tooltipText += catalog.i18nc("@label Print totals: m for meters, g for grams, %4 is currency and %3 is print cost", "").arg(total_length.toFixed(2)) - .arg(Math.round(total_weight)).arg(total_cost.toFixed(2)).arg(UM.Preferences.getValue("cura/currency")); - tooltipText += "
Extruder %0:  %1m  %2g  %4 %3
%1  
Total:  %1m  %2g  %4 %3
"; + var item_strings = [ + catalog.i18nc("@label", "Total:"), + catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)), + catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)), + "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)), + ]; + tooltip_html += ""; + for(var item = 0; item < item_strings.length; item++) { + tooltip_html += "%1  ".arg(item_strings[item]); + } + tooltip_html += ""; + tooltipText = tooltip_html; if(some_costs_known) { From 6fa4dd0a977634f5693c759ea87ae8411399c629 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 30 Oct 2017 12:26:02 +0100 Subject: [PATCH 18/30] Fix qml binding loops --- resources/qml/MonitorButton.qml | 6 +++++- resources/qml/SaveButton.qml | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 7a620c42ea..67ca2e708e 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -188,7 +188,11 @@ Item Item { id: buttonsRow height: abortButton.height - width: Math.min(childrenRect.width, base.width - 2 * UM.Theme.getSize("sidebar_margin").width) + width: { + // using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect + var children_width = additionalComponentsRow.width + pauseResumeButton.width + abortButton.width + 3 * UM.Theme.getSize("default_margin").width; + return Math.min(children_width, base.width - 2 * UM.Theme.getSize("sidebar_margin").width); + } anchors.top: progressBar.bottom anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.right: parent.right diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 63c44a6720..e2890a6b49 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -91,7 +91,19 @@ Item { Item { id: saveRow - width: Math.min(childrenRect.width + UM.Theme.getSize("sidebar_margin").width, base.width - UM.Theme.getSize("sidebar_margin").width) + width: { + // using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect + var children_width = UM.Theme.getSize("default_margin").width; + for (var index in children) + { + var child = children[index]; + if(child.visible) + { + children_width += child.width + child.anchors.rightMargin; + } + } + return Math.min(children_width, base.width - UM.Theme.getSize("sidebar_margin").width); + } height: saveToButton.height anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height @@ -102,7 +114,7 @@ Item { id: additionalComponentsRow anchors.top: parent.top anchors.right: saveToButton.visible ? saveToButton.left : parent.right - anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width + anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width } From fc7d1210cf660147a4650a69df884e844f5f3fc8 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 30 Oct 2017 12:31:46 +0100 Subject: [PATCH 19/30] Fix qml binding loop --- resources/qml/JobSpecs.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 308316d3e9..5e892a34bc 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -18,7 +18,6 @@ Item { UM.I18nCatalog { id: catalog; name:"cura"} height: childrenRect.height - width: childrenRect.width Connections { From 2d109090bc29ab79af81322c3ac9f2fd92c4fa3a Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 30 Oct 2017 12:40:41 +0100 Subject: [PATCH 20/30] Show material name instead of extruder number --- cura/PrintInformation.py | 10 ++++++++++ resources/qml/Sidebar.qml | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index f3b178c356..c709bec20a 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -56,6 +56,7 @@ class PrintInformation(QObject): self._material_lengths = [] self._material_weights = [] self._material_costs = [] + self._material_names = [] self._pre_sliced = False @@ -139,6 +140,12 @@ class PrintInformation(QObject): def materialCosts(self): return self._material_costs + materialNamesChanged = pyqtSignal() + + @pyqtProperty("QVariantList", notify = materialNamesChanged) + def materialNames(self): + return self._material_names + def _onPrintDurationMessage(self, print_time, material_amounts): self._updateTotalPrintTimePerFeature(print_time) @@ -170,6 +177,7 @@ class PrintInformation(QObject): self._material_lengths = [] self._material_weights = [] self._material_costs = [] + self._material_names = [] material_preference_values = json.loads(Preferences.getInstance().getValue("cura/material_settings")) @@ -208,10 +216,12 @@ class PrintInformation(QObject): self._material_weights.append(weight) self._material_lengths.append(length) self._material_costs.append(cost) + self._material_names.append(material.getName()) self.materialLengthsChanged.emit() self.materialWeightsChanged.emit() self.materialCostsChanged.emit() + self.materialNamesChanged.emit() def _onPreferencesChanged(self, preference): if preference != "cura/material_settings": diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 14179d388d..32dceb6078 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -30,6 +30,7 @@ Rectangle property variant printMaterialLengths: PrintInformation.materialLengths property variant printMaterialWeights: PrintInformation.materialWeights property variant printMaterialCosts: PrintInformation.materialCosts + property variant printMaterialNames: PrintInformation.materialNames color: UM.Theme.getColor("sidebar") UM.I18nCatalog { id: catalog; name:"cura"} @@ -392,11 +393,13 @@ Rectangle var costs = []; var total_cost = 0; var some_costs_known = false; + var names = []; if(base.printMaterialLengths) { for(var index = 0; index < base.printMaterialLengths.length; index++) { if(base.printMaterialLengths[index] > 0) { + names.push(base.printMaterialNames[index]); lengths.push(base.printMaterialLengths[index].toFixed(2)); weights.push(String(Math.floor(base.printMaterialWeights[index]))); var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); @@ -423,7 +426,7 @@ Rectangle for(var index = 0; index < lengths.length; index++) { var item_strings = [ - catalog.i18nc("@label", "Extruder %1:").arg(index + 1), + "%1:".arg(names[index]), catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]), catalog.i18nc("@label g for grams", "%1g").arg(weights[index]), "%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]), From 7a9dda4022eb82acf4b100b46ad13839e396235d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 30 Oct 2017 14:46:31 +0100 Subject: [PATCH 21/30] Disable jogging for UM3 NetworkPrinterOutputDevice does not have the API to control jogging --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 9dedc87df4..d8dd780ed5 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -102,6 +102,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._target_bed_temperature = 0 self._processing_preheat_requests = True + self._can_control_manually = False + self.setPriority(3) # Make sure the output device gets selected above local file output self.setName(key) self.setShortDescription(i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print over network")) From c85e10f4c5b124767002fafd8666c3236437960f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 1 Nov 2017 13:31:17 +0100 Subject: [PATCH 22/30] CURA-4062 Minor changes --- plugins/LayerView/LayerView.py | 1 - plugins/XRayView/XRayView.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index a7dbb88209..04be97b747 100755 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -112,7 +112,6 @@ class LayerView(View): self._layer_pass = LayerPass.LayerPass(1, 1) self._compatibility_mode = OpenGLContext.isLegacyOpenGL() or bool(Preferences.getInstance().getValue("view/force_layer_view_compatibility_mode")) self._layer_pass.setLayerView(self) - #self.getRenderer().addRenderPass(self._layer_pass) return self._layer_pass def getCurrentLayer(self): diff --git a/plugins/XRayView/XRayView.py b/plugins/XRayView/XRayView.py index 2983772647..35509a9715 100644 --- a/plugins/XRayView/XRayView.py +++ b/plugins/XRayView/XRayView.py @@ -57,8 +57,7 @@ class XRayView(View): # This should be fixed in RenderPass's constructor. self._xray_pass = XRayPass.XRayPass(1, 1) - if self._xray_pass: - self.getRenderer().addRenderPass(self._xray_pass) + self.getRenderer().addRenderPass(self._xray_pass) if not self._xray_composite_shader: self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("XRayView"), "xray_composite.shader")) From e2c62a460902b2f32c7f9abcde95a90f740155c9 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 1 Nov 2017 15:50:23 +0100 Subject: [PATCH 23/30] Revert "Remove unnecessary properties which after update triggered view rendering" This reverts commit ee228155af1677f3f375fb0b28b53ecef744d4d2. --- resources/qml/Cura.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index fdb1380950..2fd19a8a03 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -344,6 +344,9 @@ UM.MainWindow { id: toolbar; + property int mouseX: base.mouseX + property int mouseY: base.mouseY + anchors { top: openFileButton.bottom; topMargin: UM.Theme.getSize("window_margin").height; From 87a7bf72a8a7c4d9e3eaf5c93b91edb551cd8036 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 1 Nov 2017 15:57:30 +0100 Subject: [PATCH 24/30] Monitor view, "connect" button position CURA-4509 --- resources/qml/MonitorButton.qml | 15 +------ resources/qml/Sidebar.qml | 74 ++++++++++++++++++++++++++------- 2 files changed, 62 insertions(+), 27 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 67ca2e708e..29b00f50e6 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -185,24 +185,17 @@ Item anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width; } - Item { + Row { id: buttonsRow height: abortButton.height - width: { - // using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect - var children_width = additionalComponentsRow.width + pauseResumeButton.width + abortButton.width + 3 * UM.Theme.getSize("default_margin").width; - return Math.min(children_width, base.width - 2 * UM.Theme.getSize("sidebar_margin").width); - } anchors.top: progressBar.bottom anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width - clip: true + spacing: UM.Theme.getSize("default_margin").width Row { id: additionalComponentsRow - anchors.right: pauseResumeButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width } @@ -222,8 +215,6 @@ Item { id: pauseResumeButton - anchors.right: abortButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("save_button_save_to_button").height property bool userClicked: false @@ -270,8 +261,6 @@ Item { id: abortButton - anchors.right: parent.right - visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].canAbort enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands && (["paused", "printing", "pre_print"].indexOf(Cura.MachineManager.printerOutputDevices[0].jobState) >= 0) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 32dceb6078..383c599da8 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -356,7 +356,18 @@ Rectangle { if(!print_time[feature].isTotalDurationZero) { - content += "" + feature + ":" + + var feature_name = ""; + + if (feature.length <= 11) + { + feature_name = feature + } + else{ + feature_name = feature.substring(0, 8) + "..." + } + + + content += "" + feature_name + ":" + "  " + print_time[feature].getDisplayString(UM.DurationFormat.Short) + "  " + Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds) + "%" + ""; @@ -376,16 +387,9 @@ Rectangle Label { - id: costSpec - anchors.left: parent.left - anchors.bottom: parent.bottom - font: UM.Theme.getFont("very_small") - color: UM.Theme.getColor("text_subtext") - elide: Text.ElideMiddle - width: parent.width - property string tooltipText - text: - { + + function getSpecsData(){ + var lengths = []; var total_length = 0; var weights = []; @@ -449,10 +453,50 @@ Rectangle tooltip_html += ""; tooltipText = tooltip_html; - if(some_costs_known) + + return tooltipText + } + + id: costSpec + anchors.left: parent.left + anchors.bottom: parent.bottom + font: UM.Theme.getFont("very_small") + color: UM.Theme.getColor("text_subtext") + elide: Text.ElideMiddle + width: parent.width + property string tooltipText + text: + { + var lengths = []; + var weights = []; + var costs = []; + var someCostsKnown = false; + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) + { + if(base.printMaterialLengths[index] > 0) + { + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.floor(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) + { + someCostsKnown = true; + } + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + if(someCostsKnown) { return catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(Math.round(total_weight)).arg(total_cost.toFixed(2)).arg(UM.Preferences.getValue("cura/currency")); + .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); } else { @@ -470,7 +514,9 @@ Rectangle if(base.printDuration.valid && !base.printDuration.isTotalDurationZero) { - base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), costSpec.tooltipText); + var show_data = costSpec.getSpecsData() + + base.showTooltip(parent, Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0), show_data); } } onExited: From d503283089d44e2a1c9a6798b8399e750f87edc5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 2 Nov 2017 09:51:57 +0100 Subject: [PATCH 25/30] CURA-4509 Minor fix that avoids crashes when there is no specified material (such as in UM2) --- cura/PrintInformation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index c709bec20a..d3bcc10781 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -196,8 +196,10 @@ class PrintInformation(QObject): weight = float(amount) * float(density) / 1000 cost = 0 + material_name = catalog.i18nc("@label unknown material", "Unknown") if material: material_guid = material.getMetaDataEntry("GUID") + material_name = material.getName() if material_guid in material_preference_values: material_values = material_preference_values[material_guid] @@ -216,7 +218,7 @@ class PrintInformation(QObject): self._material_weights.append(weight) self._material_lengths.append(length) self._material_costs.append(cost) - self._material_names.append(material.getName()) + self._material_names.append(material_name) self.materialLengthsChanged.emit() self.materialWeightsChanged.emit() From 25c41062e10a4871afe29ddbf69151222aa9e5e6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 2 Nov 2017 12:58:52 +0100 Subject: [PATCH 26/30] Fix material upgrade and version checking CURA-4519 Less duplicated code, but it's still one of the worst parts... --- .../XmlMaterialProfile/XmlMaterialProfile.py | 14 ++++++++------ .../XmlMaterialProfile/XmlMaterialUpgrader.py | 18 +++++------------- plugins/XmlMaterialProfile/__init__.py | 2 +- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 51a3c51a8b..86f90e8970 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -33,9 +33,10 @@ class XmlMaterialProfile(InstanceContainer): # # \param xml_version: The version number found in an XML file. # \return The corresponding setting_version. - def xmlVersionToSettingVersion(self, xml_version: str) -> int: + @classmethod + def xmlVersionToSettingVersion(cls, xml_version: str) -> int: if xml_version == "1.3": - return 4 + return CuraApplication.SettingVersion return 0 #Older than 1.3. def getInheritedFiles(self): @@ -407,15 +408,16 @@ class XmlMaterialProfile(InstanceContainer): def getConfigurationTypeFromSerialized(self, serialized: str) -> Optional[str]: return "materials" - def getVersionFromSerialized(self, serialized: str) -> Optional[int]: + @classmethod + def getVersionFromSerialized(cls, serialized: str) -> Optional[int]: data = ET.fromstring(serialized) - version = 1 + version = XmlMaterialProfile.Version # get setting version if "version" in data.attrib: - setting_version = self.xmlVersionToSettingVersion(data.attrib["version"]) + setting_version = XmlMaterialProfile.xmlVersionToSettingVersion(data.attrib["version"]) else: - setting_version = self.xmlVersionToSettingVersion("1.2") + setting_version = XmlMaterialProfile.xmlVersionToSettingVersion("1.2") return version * 1000000 + setting_version diff --git a/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py b/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py index c882239dba..167a9f2849 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py +++ b/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py @@ -5,24 +5,16 @@ import xml.etree.ElementTree as ET from UM.VersionUpgrade import VersionUpgrade +from cura.CuraApplication import CuraApplication +from .XmlMaterialProfile import XmlMaterialProfile + class XmlMaterialUpgrader(VersionUpgrade): def getXmlVersion(self, serialized): - data = ET.fromstring(serialized) - - version = 1 - # get setting version - if "version" in data.attrib: - setting_version = self._xmlVersionToSettingVersion(data.attrib["version"]) - else: - setting_version = self._xmlVersionToSettingVersion("1.2") - - return version * 1000000 + setting_version + return XmlMaterialProfile.getVersionFromSerialized(serialized) def _xmlVersionToSettingVersion(self, xml_version: str) -> int: - if xml_version == "1.3": - return 2 - return 0 #Older than 1.3. + return XmlMaterialProfile.xmlVersionToSettingVersion(xml_version) def upgradeMaterial(self, serialised, filename): data = ET.fromstring(serialised) diff --git a/plugins/XmlMaterialProfile/__init__.py b/plugins/XmlMaterialProfile/__init__.py index 8173e9dd04..70a359ee76 100644 --- a/plugins/XmlMaterialProfile/__init__.py +++ b/plugins/XmlMaterialProfile/__init__.py @@ -19,7 +19,7 @@ def getMetaData(): "mimetype": "application/x-ultimaker-material-profile" }, "version_upgrade": { - ("materials", 1000000): ("materials", 1000003, upgrader.upgradeMaterial), + ("materials", 1000000): ("materials", 1000004, upgrader.upgradeMaterial), }, "sources": { "materials": { From a4441e2bdbe2b6d86c46e17efd23a7f373b28fd1 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 2 Nov 2017 13:20:25 +0100 Subject: [PATCH 27/30] CURA-4481 Setting description improved --- resources/definitions/fdmprinter.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 4afc184e18..cffaa1df3d 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3978,7 +3978,7 @@ "remove_empty_first_layers": { "label": "Remove Empty First Layers", - "description": "Remove empty layers beneath the first printed layer if they are present.", + "description": "Remove empty layers beneath the first printed layer if they are present. Disabling this setting can cause empty first layers if the Slicing Tolerance setting is set to Exclusive or Middle.", "type": "bool", "default_value": true, "enabled": "not support_enable", From 0d71443bd29ba43290f11eec3e0443f0711413e0 Mon Sep 17 00:00:00 2001 From: Ruben D Date: Sun, 5 Nov 2017 23:24:07 +0100 Subject: [PATCH 28/30] Move 'Remove Empty First Layers' setting to mesh fixes category It used to be in 'support' since it's something you may want to decide on depending on whether you have support or not. It could also go in 'Special Modes', but I think this is more specified. --- resources/definitions/fdmprinter.def.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index cffaa1df3d..88e02fc1c6 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3974,16 +3974,6 @@ "limit_to_extruder": "support_infill_extruder_nr", "enabled": "support_enable and support_use_towers", "settable_per_mesh": true - }, - "remove_empty_first_layers": - { - "label": "Remove Empty First Layers", - "description": "Remove empty layers beneath the first printed layer if they are present. Disabling this setting can cause empty first layers if the Slicing Tolerance setting is set to Exclusive or Middle.", - "type": "bool", - "default_value": true, - "enabled": "not support_enable", - "settable_per_mesh": false, - "settable_per_extruder": false } } }, @@ -4894,6 +4884,16 @@ "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": true + }, + "remove_empty_first_layers": + { + "label": "Remove Empty First Layers", + "description": "Remove empty layers beneath the first printed layer if they are present. Disabling this setting can cause empty first layers if the Slicing Tolerance setting is set to Exclusive or Middle.", + "type": "bool", + "default_value": true, + "enabled": "not support_enable", + "settable_per_mesh": false, + "settable_per_extruder": false } } }, From c61b9c41ab03e7b0a723cd1f70a4cfd5bbf88b81 Mon Sep 17 00:00:00 2001 From: Ruben D Date: Mon, 6 Nov 2017 03:55:49 +0100 Subject: [PATCH 29/30] Fix translation of Unable to slice message Previously the {0} would be filled in at runtime, causing the translation to no longer be found in the catalogue. Contributes to issue CURA-4091. --- plugins/CuraEngineBackend/CuraEngineBackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 914aa1dee0..0c1fc6f4ad 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -293,7 +293,7 @@ class CuraEngineBackend(QObject, Backend): error_labels.add(definitions[0].label) error_labels = ", ".join(error_labels) - self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}".format(error_labels)), + self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}").format(error_labels), title = catalog.i18nc("@info:title", "Unable to slice")) self._error_message.show() self.backendStateChange.emit(BackendState.Error) From 28ce2b1dc6d3382a5d146fa2aa928af18541ce68 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 6 Nov 2017 09:49:13 +0100 Subject: [PATCH 30/30] Ignore VariSlice plugin --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 570c932d28..ac1e8eba92 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ plugins/ProfileFlattener plugins/cura-god-mode-plugin plugins/cura-big-flame-graph plugins/cura-siemensnx-plugin +plugins/CuraVariSlicePlugin #Build stuff CMakeCache.txt