From 56fa7036b3545ebdfad420fa28e8efc3b35bfcfa Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 23 Oct 2017 20:55:08 +0200 Subject: [PATCH 1/8] 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 2/8] 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 3/8] 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 4/8] 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 5/8] 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 6/8] 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 7/8] 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 7a9dda4022eb82acf4b100b46ad13839e396235d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 30 Oct 2017 14:46:31 +0100 Subject: [PATCH 8/8] 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"))