From aa39a442191b7584b8abfde80c52507173ea0701 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 12 Sep 2016 16:41:24 +0200 Subject: [PATCH 1/3] Update i18n context for consistency --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index c766b2d947..27b0e532d4 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -18,7 +18,7 @@ Column Label { - text: printerConnected ? connectedPrinter.connectionText : catalog.i18nc("@label", "The printer is not connected.") + text: printerConnected ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("default") wrapMode: Text.WordWrap From 0693c0284b4fe074a118649dd0ec3993221650ea Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 12 Sep 2016 16:49:22 +0200 Subject: [PATCH 2/3] Show printer state on Printers preference pane CURA-2276 --- resources/qml/Preferences/MachinesPage.qml | 58 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 12ff53d9ca..8c1e061026 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -123,7 +123,7 @@ UM.ManagementPage } } - Row + Grid { id: machineInfo @@ -132,17 +132,71 @@ UM.ManagementPage anchors.left: parent.left anchors.right: parent.right spacing: UM.Theme.getSize("default_margin").height + rowSpacing: UM.Theme.getSize("default_lining").height + columns: 2 visible: base.currentItem + property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 + property var connectedPrinter: printerConnected ? Cura.MachineManager.printerOutputDevices[0] : null + property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands + Label { - text: catalog.i18nc("@label", "Type") + text: catalog.i18nc("@label", "Printer type:") visible: base.currentItem && "definition_name" in base.currentItem.metadata } Label { text: (base.currentItem && "definition_name" in base.currentItem.metadata) ? base.currentItem.metadata.definition_name : "" } + Label + { + text: catalog.i18nc("@label", "Connection:") + visible: base.currentItem && base.currentItem.id == Cura.MachineManager.activeMachineId + } + Label { + width: parent.width * 0.7 + text: machineInfo.printerConnected ? machineInfo.connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") + visible: base.currentItem && base.currentItem.id == Cura.MachineManager.activeMachineId + wrapMode: Text.WordWrap + } + Label + { + text: catalog.i18nc("@label", "State:") + visible: base.currentItem && base.currentItem.id == Cura.MachineManager.activeMachineId && machineInfo.printerAcceptsCommands + } + Label { + width: parent.width * 0.7 + text: + { + if(!machineInfo.printerConnected || !machineInfo.printerAcceptsCommands) { + return ""; + } + + switch(Cura.MachineManager.printerOutputDevices[0].jobState) + { + case "printing": + return catalog.i18nc("@label:MonitorStatus", "Printing..."); + case "paused": + return catalog.i18nc("@label:MonitorStatus", "Paused"); + case "pre_print": + return catalog.i18nc("@label:MonitorStatus", "Preparing..."); + case "wait_cleanup": + return catalog.i18nc("@label:MonitorStatus", "Waiting for someone to clear the build plate"); + case "error": + return printerOutputDevice.errorText; + case "maintenance": // note sure if this jobState actually occurs in the wild + return catalog.i18nc("@label:MonitorStatus", "Busy; please check the printer"); + case "abort": // note sure if this jobState actually occurs in the wild + return catalog.i18nc("@label:MonitorStatus", "Aborting print..."); + case "ready": // ready to print or getting ready + case "": // ready to print or getting ready + return catalog.i18nc("@label:MonitorStatus", "Waiting for a printjob"); + } + } + visible: base.currentItem && base.currentItem.id == Cura.MachineManager.activeMachineId && machineInfo.printerAcceptsCommands + wrapMode: Text.WordWrap + } } Column { From 4bfa0f3bb1658b74fec8d5046f7067ef7d4401fe Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 12 Sep 2016 16:53:59 +0200 Subject: [PATCH 3/3] Move sidebar action button style into styles.qml --- resources/qml/MonitorButton.qml | 106 +------------------------------ resources/themes/cura/styles.qml | 55 ++++++++++++++++ 2 files changed, 57 insertions(+), 104 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index f9f6cd5f5d..9c433cda5f 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -226,58 +226,7 @@ Rectangle } } - style: 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; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - 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"); - } - font: UM.Theme.getFont("action_button") - text: control.text - } - } - label: Item { } - } + style: UM.Theme.styles.sidebar_action_button } Button @@ -293,58 +242,7 @@ Rectangle text: catalog.i18nc("@label:", "Abort Print") onClicked: confirmationDialog.visible = true - style: 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; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) - - Label - { - id: actualLabel - anchors.centerIn: parent - 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"); - } - font: UM.Theme.getFont("action_button") - text: control.text; - } - } - label: Item { } - } + style: UM.Theme.styles.sidebar_action_button } MessageDialog diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 96bbf03a45..354aa15165 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -506,4 +506,59 @@ QtObject { } } } + + property Component sidebar_action_button: Component { + 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; } } + + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) + + Label + { + id: actualLabel + anchors.centerIn: parent + 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"); + } + font: UM.Theme.getFont("action_button") + text: control.text + } + } + label: Item { } + } + } }