From 8a603c2fc176314e3a9522a67de76df2e2ead1c3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 15 Jun 2016 16:17:52 +0200 Subject: [PATCH 01/28] Added basic tabs for monitoring print CURA-1036 --- resources/qml/Sidebar.qml | 87 +++++++++++++++++++- resources/themes/cura/icons/tab_monitor.svg | 12 +++ resources/themes/cura/icons/tab_settings.svg | 44 ++++++++++ 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 resources/themes/cura/icons/tab_monitor.svg create mode 100644 resources/themes/cura/icons/tab_settings.svg diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 4c8d671a7f..9455c50c08 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -14,6 +14,7 @@ Rectangle id: base; property int currentModeIndex; + property bool monitoringPrint: false // Is there an output device for this printer? property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 @@ -44,12 +45,44 @@ Rectangle } } + // Mode selection buttons for changing between Setting & Monitor print mode + Row + { + id: settingAndMonitorButtons // Really need a better name for this. + + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width; + anchors.right: parent.right + Button + { + width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 + height: 50 + onClicked: monitoringPrint = false + iconSource: UM.Theme.getIcon("tab_settings"); + style: UM.Theme.styles.tool_button + checkable: true + checked: true + exclusiveGroup: settingAndMonitorButtonsGroup + } + Button + { + width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 + height: 50 + onClicked: monitoringPrint = true + iconSource: UM.Theme.getIcon("tab_monitor"); + style: UM.Theme.styles.tool_button + checkable: true + exclusiveGroup: settingAndMonitorButtonsGroup + } + ExclusiveGroup { id: settingAndMonitorButtonsGroup } + } + SidebarHeader { id: header width: parent.width height: totalHeightHeader - anchors.top: parent.top + anchors.top: settingAndMonitorButtons.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height onShowTooltip: base.showTooltip(item, location, text) @@ -91,8 +124,9 @@ Rectangle anchors.top: headerSeparator.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width/100*45 - font: UM.Theme.getFont("large"); + font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") + visible: !monitoringPrint } Rectangle { @@ -103,6 +137,7 @@ Rectangle anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.top: headerSeparator.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height + visible: !monitoringPrint Component{ id: wizardDelegate Button { @@ -152,6 +187,19 @@ Rectangle } } + Label { + id: monitorLabel + text: catalog.i18nc("@label","Activity Data"); + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width; + anchors.top: headerSeparator.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width/100*45 + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + visible: monitoringPrint + } + StackView { id: sidebarContents @@ -161,6 +209,7 @@ Rectangle anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: base.left anchors.right: base.right + visible: !monitoringPrint delegate: StackViewDelegate { @@ -191,6 +240,40 @@ Rectangle } } + // Item that holds all the print monitor properties + Grid + { + id: printMonitor + anchors.bottom: footerSeparator.top + anchors.top: monitorLabel.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.left: base.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.right: base.right + visible: monitoringPrint + columns: 2 + columnSpacing: UM.Theme.getSize("default_margin").width + Label + { + text: "Temperature 1: " + } + Label + { + text: "" + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[0] + } + + + Label + { + text: "Temperature 2: " + } + Label + { + text: "" + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[1] + } + + } + Rectangle { id: footerSeparator width: parent.width diff --git a/resources/themes/cura/icons/tab_monitor.svg b/resources/themes/cura/icons/tab_monitor.svg new file mode 100644 index 0000000000..03d9e97dbf --- /dev/null +++ b/resources/themes/cura/icons/tab_monitor.svg @@ -0,0 +1,12 @@ + + + + Fill 1 Copy 3 + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura/icons/tab_settings.svg b/resources/themes/cura/icons/tab_settings.svg new file mode 100644 index 0000000000..82e203a294 --- /dev/null +++ b/resources/themes/cura/icons/tab_settings.svg @@ -0,0 +1,44 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + From c130d4d9cf9da17d0a78fc5b66111fd4f865bacc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 15 Jun 2016 16:46:03 +0200 Subject: [PATCH 02/28] Added properties for total time and time spend on print CURA-1036 --- cura/PrinterOutputDevice.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 7649106523..79ec9131e0 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -29,6 +29,8 @@ class PrinterOutputDevice(QObject, OutputDevice): self._head_y = 0 self._head_z = 0 self._connection_state = ConnectionState.closed + self._time_elapsed = 0 + self._time_total = 0 def requestWrite(self, node, file_name = None, filter_by_machine = False): raise NotImplementedError("requestWrite needs to be implemented") @@ -57,6 +59,10 @@ class PrinterOutputDevice(QObject, OutputDevice): # it also sends it's own device_id (for convenience sake) connectionStateChanged = pyqtSignal(str) + timeElapsedChanged = pyqtSignal() + + timeTotalChanged = pyqtSignal() + ## Get the bed temperature of the bed (if any) # This function is "final" (do not re-implement) # /sa _getBedTemperature implementation function @@ -74,6 +80,30 @@ class PrinterOutputDevice(QObject, OutputDevice): self._target_bed_temperature = temperature self.targetBedTemperatureChanged.emit() + ## Time the print has been printing. + # Note that timeTotal - timeElapsed should give time remaining. + @pyqtProperty(float, notify = timeElapsedChanged) + def timeElapsed(self): + return self._time_elapsed + + ## Total time of the print + # Note that timeTotal - timeElapsed should give time remaining. + @pyqtProperty(float, notify=timeTotalChanged) + def timeTotal(self): + return self._time_total + + @pyqtSlot(float) + def setTimeTotal(self, new_total): + if self._time_total != new_total: + self._time_total = new_total + self.timeTotalChanged.emit() + + @pyqtSlot(float) + def setTimeElapsed(self, time_elapsed): + if self._time_elapsed != time_elapsed: + self._time_elapsed = time_elapsed + self.timeElapsedChanged.emit() + ## Home the head of the connected printer # This function is "final" (do not re-implement) # /sa _homeHead implementation function From 8160f8d5e6f71334abf10b5318d56d08daf83e4c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 15 Jun 2016 16:47:19 +0200 Subject: [PATCH 03/28] Added more data to the print monitor screen CURA-1068 --- resources/qml/Sidebar.qml | 50 +++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 9455c50c08..04eacad044 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -255,21 +255,63 @@ Rectangle columnSpacing: UM.Theme.getSize("default_margin").width Label { - text: "Temperature 1: " + text: "Temperature 1:" } Label { - text: "" + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[0] + text: " " + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[0] } Label { - text: "Temperature 2: " + text: "Temperature 2:" } Label { - text: "" + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[1] + text: " " + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[1] + } + + Label + { + text: "Bed Temperature:" + } + Label + { + text: " " + Cura.MachineManager.printerOutputDevices[0].bedTemperature + } + + + + // Spacers + Label { text: " "} + Label { text: " "} + + Label + { + text: "Printing Time:" + } + Label + { + text: " " + Cura.MachineManager.printerOutputDevices[0].timeTotal + } + + Label + { + text: "Estimated time left:" + } + Label + { + text: " " + (Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) + } + + Label + { + text: "Current Layer:" + } + Label + { + text: " " } } From 3a46bb8d8a1a7987c22ffae372bb16547eb1385b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 09:34:43 +0200 Subject: [PATCH 04/28] Added CameraImageProvider & camera handling CURA-1036 and CURA-338 --- cura/CameraImageProvider.py | 18 ++++++++++++++++++ cura/CuraApplication.py | 6 +++++- resources/qml/Sidebar.qml | 2 -- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 cura/CameraImageProvider.py diff --git a/cura/CameraImageProvider.py b/cura/CameraImageProvider.py new file mode 100644 index 0000000000..ff66170f3c --- /dev/null +++ b/cura/CameraImageProvider.py @@ -0,0 +1,18 @@ +from PyQt5.QtGui import QImage +from PyQt5.QtQuick import QQuickImageProvider +from PyQt5.QtCore import QSize + +from UM.Application import Application + +class CameraImageProvider(QQuickImageProvider): + def __init__(self): + QQuickImageProvider.__init__(self, QQuickImageProvider.Image) + + ## Request a new image. + def requestImage(self, id, size): + for output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices(): + try: + return output_device.getCameraImage(), QSize(15, 15) + except AttributeError: + pass + return QImage(), QSize(15, 15) \ No newline at end of file diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 393f1e5634..2f1408a16d 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -43,6 +43,7 @@ from . import ZOffsetDecorator from . import CuraSplashScreen from . import MachineManagerModel from . import ContainerSettingsModel +from . import CameraImageProvider from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS from PyQt5.QtGui import QColor, QIcon @@ -222,7 +223,7 @@ class CuraApplication(QtApplication): JobQueue.getInstance().jobFinished.connect(self._onJobFinished) self.applicationShuttingDown.connect(self.saveSettings) - + self.engineCreatedSignal.connect(self._onEngineCreated) self._recent_files = [] files = Preferences.getInstance().getValue("cura/recent_files").split(";") for f in files: @@ -231,6 +232,9 @@ class CuraApplication(QtApplication): self._recent_files.append(QUrl.fromLocalFile(f)) + def _onEngineCreated(self): + self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider()) + ## Cura has multiple locations where instance containers need to be saved, so we need to handle this differently. # # Note that the AutoSave plugin also calls this method. diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 04eacad044..74022bbe3b 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -281,8 +281,6 @@ Rectangle text: " " + Cura.MachineManager.printerOutputDevices[0].bedTemperature } - - // Spacers Label { text: " "} Label { text: " "} From a735e92dfaeb4a863b3c73761aead35b85132c4c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 11:01:58 +0200 Subject: [PATCH 05/28] Added camera image overlay when monitoring print CURA-1036 --- resources/qml/Cura.qml | 32 ++++++++++++++++++++++++++++++-- resources/qml/Sidebar.qml | 3 ++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 6dd57e17c8..bfb18d3d61 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -16,7 +16,7 @@ UM.MainWindow //: Cura application window title title: catalog.i18nc("@title:window","Cura"); viewportRect: Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0) - + property bool monitoringPrint: false Item { id: backgroundItem; @@ -531,12 +531,40 @@ UM.MainWindow bottom: parent.bottom; right: parent.right; } - + onMonitoringPrintChanged: base.monitoringPrint = monitoringPrint width: UM.Theme.getSize("sidebar").width; } + Rectangle + { + color: "black" + anchors + { + top: parent.top + bottom: parent.bottom + left:parent.left + right: sidebar.left + } + visible: base.monitoringPrint + opacity: 0.5 + } + + Image + { + id: cameraImage + width: 800 + height: 600 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenterOffset: -(UM.Theme.getSize("sidebar").width/ 2) + visible: base.monitoringPrint + source: Cura.MachineManager.printerOutputDevices[0].cameraImage + } } } + + + UM.PreferencesDialog { id: preferences diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 74022bbe3b..747bc7621f 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -314,7 +314,8 @@ Rectangle } - Rectangle { + Rectangle + { id: footerSeparator width: parent.width height: UM.Theme.getSize("sidebar_lining").height From 2d78f0a61008a825470d714b3ed7c846ef6cce84 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 11:43:25 +0200 Subject: [PATCH 06/28] Added job_state property CURA-1036 --- cura/PrinterOutputDevice.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 79ec9131e0..9dabe52373 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -31,6 +31,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self._connection_state = ConnectionState.closed self._time_elapsed = 0 self._time_total = 0 + self._job_state = "" def requestWrite(self, node, file_name = None, filter_by_machine = False): raise NotImplementedError("requestWrite needs to be implemented") @@ -63,6 +64,17 @@ class PrinterOutputDevice(QObject, OutputDevice): timeTotalChanged = pyqtSignal() + jobStateChanged = pyqtSignal() + + @pyqtProperty(str, notify = jobStateChanged) + def jobState(self): + return self._job_state + + def setJobState(self, job_state): + if self._job_state != job_state: + self._job_state = job_state + self.jobStateChanged.emit() + ## Get the bed temperature of the bed (if any) # This function is "final" (do not re-implement) # /sa _getBedTemperature implementation function From 640e1a2350c1e1eeb872b010fff9790dbdec707e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 15:35:11 +0200 Subject: [PATCH 07/28] Implemented interface for setting printjobstate CURA-1038 --- cura/PrinterOutputDevice.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 9dabe52373..8dca62f368 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -70,11 +70,18 @@ class PrinterOutputDevice(QObject, OutputDevice): def jobState(self): return self._job_state - def setJobState(self, job_state): + def _updateJobState(self, job_state): if self._job_state != job_state: self._job_state = job_state self.jobStateChanged.emit() + @pyqtSlot(str) + def setJobState(self, job_state): + self._setJobState(job_state) + + def _setJobState(self, job_state): + Logger.log("w", "_setJobState is not implemented by this output device") + ## Get the bed temperature of the bed (if any) # This function is "final" (do not re-implement) # /sa _getBedTemperature implementation function From 8d8b4792162fd2a34442215931c59dfe5eded8d4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 15:36:51 +0200 Subject: [PATCH 08/28] Adding pause / resume buttons for print monitoring CURA-1036 --- resources/qml/MonitorButton.qml | 161 ++++++++++++++++++++++++++++++++ resources/qml/Sidebar.qml | 11 +++ 2 files changed, 172 insertions(+) create mode 100644 resources/qml/MonitorButton.qml diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml new file mode 100644 index 0000000000..2d4a8c1b36 --- /dev/null +++ b/resources/qml/MonitorButton.qml @@ -0,0 +1,161 @@ +// Copyright (c) 2016 Ultimaker B.V. +// Cura is released under the terms of the AGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 + +import UM 1.1 as UM +import Cura 1.0 as Cura + +Rectangle +{ + id: base; + UM.I18nCatalog { id: catalog; name:"cura"} + + property real progress: Cura.MachineManager.printerOutputDevices[0].progress; + property int backendState: UM.Backend.state; + + property bool activity: Printer.getPlatformActivity; + property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height + property string fileBaseName + property string statusText: + { + return "Printing..." + } + + Label + { + id: statusLabel + width: parent.width - 2 * UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + color: "green" + font: UM.Theme.getFont("large") + text: statusText; + } + + Rectangle + { + id: progressBar + width: parent.width - 2 * UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("progressbar").height + anchors.top: statusLabel.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height / 4 + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_background") + + Rectangle + { + width: Math.max(parent.width * base.progress) + height: parent.height + color: "green" + radius: UM.Theme.getSize("progressbar_radius").width + //visible: base.backendState == 2 ? true : false + } + } + + Button + { + id: abortButton + + enabled: true + height: UM.Theme.getSize("save_button_save_to_button").height + + anchors.top: progressBar.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + text: catalog.i18nc("@label:", "Abort Job") + onClicked: {} + + style: ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : + 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.enabled ? UM.Theme.getColor("action_button_disabled") : + 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; } } + + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) + + Label + { + id: actualLabel + anchors.centerIn: parent + color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : + 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("action_button") + text: control.text; + } + } + label: Item { } + } + } + + Button + { + id: pauseButton + + height: UM.Theme.getSize("save_button_save_to_button").height + + anchors.top: progressBar.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: abortButton.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + text: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") + onClicked: { Cura.MachineManager.printerOutputDevices[0].setJobState("printing")} + + style: ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : + 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.enabled ? UM.Theme.getColor("action_button_disabled") : + 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; } } + + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) + + Label + { + id: actualLabel + anchors.centerIn: parent + color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : + 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("action_button") + text: control.text; + } + } + label: Item { } + } + } + + Rectangle + { + id: saveRow + width: base.width + height: saveToButton.height + anchors.top: progressBar.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.left: parent.left + } +} diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 747bc7621f..c1a07ab23a 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -330,8 +330,19 @@ Rectangle implicitWidth: base.width implicitHeight: totalHeight anchors.bottom: parent.bottom + visible: !monitoringPrint } + MonitorButton + { + id: monitorButton; + implicitWidth: base.width + implicitHeight: totalHeight + anchors.bottom: parent.bottom + visible: monitoringPrint + } + + SidebarTooltip { id: tooltip; From 74c47740923c88ab3d62b08c58fe57692f64d508 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 17:21:16 +0200 Subject: [PATCH 09/28] Fixed print /resume button CURA-1036 --- resources/qml/MonitorButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 2d4a8c1b36..157f32429b 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -117,7 +117,7 @@ Rectangle anchors.rightMargin: UM.Theme.getSize("default_margin").width text: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") - onClicked: { Cura.MachineManager.printerOutputDevices[0].setJobState("printing")} + onClicked: { Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? Cura.MachineManager.printerOutputDevices[0].setJobState("printing") : Cura.MachineManager.printerOutputDevices[0].setJobState("paused") } style: ButtonStyle { From ec34d92500665226a598d1427eb85f78c9147a11 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 16 Jun 2016 17:47:05 +0200 Subject: [PATCH 10/28] Resume, pause & abort are handled correctly CURA-1036 --- resources/qml/MonitorButton.qml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 157f32429b..16ea5687e0 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -22,7 +22,22 @@ Rectangle property string fileBaseName property string statusText: { - return "Printing..." + if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing") + { + return "Printing..." + } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") + { + return "Paused" + } + else if(Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print") + { + return "Preparing..." + } + else + { + return " " + } + } Label @@ -73,7 +88,8 @@ Rectangle anchors.rightMargin: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label:", "Abort Job") - onClicked: {} + onClicked: { Cura.MachineManager.printerOutputDevices[0].setJobState("abort") } + style: ButtonStyle { @@ -117,7 +133,7 @@ Rectangle anchors.rightMargin: UM.Theme.getSize("default_margin").width text: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") - onClicked: { Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? Cura.MachineManager.printerOutputDevices[0].setJobState("printing") : Cura.MachineManager.printerOutputDevices[0].setJobState("paused") } + onClicked: { Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? Cura.MachineManager.printerOutputDevices[0].setJobState("print") : Cura.MachineManager.printerOutputDevices[0].setJobState("pause") } style: ButtonStyle { From 168246d594b1fdc2e4137622e89b27ba70c7d582 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 17 Jun 2016 11:02:22 +0200 Subject: [PATCH 11/28] Added progress percentage label CURA-1036 --- resources/qml/MonitorButton.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 16ea5687e0..335de0b323 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -53,6 +53,18 @@ Rectangle text: statusText; } + Label + { + id: percentageLabel + anchors.top: parent.top + anchors.right: progressBar.right + //anchors.rightMargin: UM.Theme.getSize("default_margin").width + + color: "green" + font: UM.Theme.getFont("large") + text: Math.round(progress * 100) + "%" ; + } + Rectangle { id: progressBar From ef9ce7ad55a406bcc1c4f415c812987be35ec5ef Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 17 Jun 2016 11:55:53 +0200 Subject: [PATCH 12/28] Made time total & time remaining pretty CURA-1036 --- resources/qml/Sidebar.qml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index c1a07ab23a..6f7f437c23 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -34,6 +34,21 @@ Rectangle tooltip.hide(); } + function strPadLeft(string, pad, length) { + return (new Array(length + 1).join(pad) + string).slice(-length); + } + + function getPrettyTime(time) + { + var hours = Math.floor(time / 3600) + time -= hours * 3600 + var minutes = Math.floor(time / 60); + time -= minutes * 60 + var seconds = Math.floor(time); + + var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); + return finalTime; + } MouseArea { anchors.fill: parent @@ -289,9 +304,10 @@ Rectangle { text: "Printing Time:" } + Label { - text: " " + Cura.MachineManager.printerOutputDevices[0].timeTotal + text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal) } Label @@ -300,7 +316,7 @@ Rectangle } Label { - text: " " + (Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) + text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) } Label From 1f9acf0b5435f2eb0e36d50bd3823e277dff2e40 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 17 Jun 2016 12:01:48 +0200 Subject: [PATCH 13/28] Color of progress bar now changes based on jobstate CURA-1036 --- resources/qml/MonitorButton.qml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 335de0b323..49a4e38fa4 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -48,7 +48,7 @@ Rectangle anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - color: "green" + color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "orange": "green" font: UM.Theme.getFont("large") text: statusText; } @@ -60,7 +60,7 @@ Rectangle anchors.right: progressBar.right //anchors.rightMargin: UM.Theme.getSize("default_margin").width - color: "green" + color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "orange": "green" font: UM.Theme.getFont("large") text: Math.round(progress * 100) + "%" ; } @@ -81,9 +81,8 @@ Rectangle { width: Math.max(parent.width * base.progress) height: parent.height - color: "green" + color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "orange": "green" radius: UM.Theme.getSize("progressbar_radius").width - //visible: base.backendState == 2 ? true : false } } From 1232ac7df5ce1d7fde48ed7016499ae9b3bd85f1 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 17 Jun 2016 12:05:23 +0200 Subject: [PATCH 14/28] Temperatures are now rounded + displayed with celcius sign CURA-1036 --- resources/qml/Sidebar.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 6f7f437c23..c63e46ed04 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -274,7 +274,7 @@ Rectangle } Label { - text: " " + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[0] + text: " " + Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[0]) + "°C" } @@ -284,7 +284,7 @@ Rectangle } Label { - text: " " + Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[1] + text: " " + Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[1]) + "°C" } Label @@ -293,7 +293,7 @@ Rectangle } Label { - text: " " + Cura.MachineManager.printerOutputDevices[0].bedTemperature + text: " " + Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C" } // Spacers From 96e6477793f732ddaae7ab868695cabf1b070a34 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 17 Jun 2016 13:06:33 +0200 Subject: [PATCH 15/28] Print monitoring tab now has icons indicated if it's paused / connected CURA-1036 --- resources/qml/Sidebar.qml | 17 +- .../cura/icons/tab_monitor_connected.svg | 89 +++++++ .../themes/cura/icons/tab_monitor_paused.svg | 243 ++++++++++++++++++ 3 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 resources/themes/cura/icons/tab_monitor_connected.svg create mode 100644 resources/themes/cura/icons/tab_monitor_paused.svg diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index c63e46ed04..f45f3195fe 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -22,6 +22,21 @@ Rectangle color: UM.Theme.getColor("sidebar"); UM.I18nCatalog { id: catalog; name:"cura"} + + property string machineMonitorIcon: + { + if(!printerConnected) + { + return "tab_monitor" + } + if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") + { + return "tab_monitor_paused" + } else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error") + { + return "tab_monitor_connected" + } + } function showTooltip(item, position, text) { tooltip.text = text; @@ -84,7 +99,7 @@ Rectangle width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 height: 50 onClicked: monitoringPrint = true - iconSource: UM.Theme.getIcon("tab_monitor"); + iconSource: UM.Theme.getIcon(machineMonitorIcon) style: UM.Theme.styles.tool_button checkable: true exclusiveGroup: settingAndMonitorButtonsGroup diff --git a/resources/themes/cura/icons/tab_monitor_connected.svg b/resources/themes/cura/icons/tab_monitor_connected.svg new file mode 100644 index 0000000000..e3b314146a --- /dev/null +++ b/resources/themes/cura/icons/tab_monitor_connected.svg @@ -0,0 +1,89 @@ + + + + + + image/svg+xml + + Fill 1 Copy 3 + + + + + + Fill 1 Copy 3 + Created with Sketch. + + + + + + + + + diff --git a/resources/themes/cura/icons/tab_monitor_paused.svg b/resources/themes/cura/icons/tab_monitor_paused.svg new file mode 100644 index 0000000000..608c279385 --- /dev/null +++ b/resources/themes/cura/icons/tab_monitor_paused.svg @@ -0,0 +1,243 @@ + + + + + + image/svg+xml + + Fill 1 Copy 3 + + + + + + Fill 1 Copy 3 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1c83b152903b730d2d0915bba6d159da2751fa22 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 22 Jun 2016 14:17:56 +0200 Subject: [PATCH 16/28] Tweak viewport overlay Change color, opacity. Block mouseclicks. CURA-1036 --- resources/qml/Cura.qml | 20 ++++++++++++++++---- resources/themes/cura/theme.json | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index bfb18d3d61..a9e9f0c875 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -534,9 +534,12 @@ UM.MainWindow onMonitoringPrintChanged: base.monitoringPrint = monitoringPrint width: UM.Theme.getSize("sidebar").width; } + Rectangle { - color: "black" + id: viewportOverlay + + color: UM.Theme.getColor("viewport_overlay") anchors { top: parent.top @@ -544,8 +547,17 @@ UM.MainWindow left:parent.left right: sidebar.left } - visible: base.monitoringPrint - opacity: 0.5 + visible: opacity > 0 + opacity: base.monitoringPrint ? 0.75 : 0 + + Behavior on opacity { NumberAnimation { duration: 100; } } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.AllButtons + + onWheel: wheel.accepted = true + } } Image @@ -555,7 +567,7 @@ UM.MainWindow height: 600 anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenterOffset: -(UM.Theme.getSize("sidebar").width/ 2) + anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2 visible: base.monitoringPrint source: Cura.MachineManager.printerOutputDevices[0].cameraImage } diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index acd60e2646..9c2b9f7b03 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -38,6 +38,7 @@ "colors": { "sidebar": [255, 255, 255, 255], "lining": [127, 127, 127, 255], + "viewport_overlay": [24, 41, 77, 255], "primary": [12, 169, 227, 255], "primary_hover": [48, 182, 231, 255], From cdd38763f617beb254cf33b6c87169e3b01cb2e3 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 22 Jun 2016 16:06:11 +0200 Subject: [PATCH 17/28] Tweak sidebar tab bar appearance CURA-1036 --- resources/qml/Sidebar.qml | 87 +++++++------- resources/themes/cura/icons/tab_monitor.svg | 83 +++++++++++-- resources/themes/cura/icons/tab_settings.svg | 117 ++++++++++++------- resources/themes/cura/styles.qml | 50 ++++++++ resources/themes/cura/theme.json | 5 + 5 files changed, 249 insertions(+), 93 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index f45f3195fe..4a111e7903 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -23,20 +23,6 @@ Rectangle UM.I18nCatalog { id: catalog; name:"cura"} - property string machineMonitorIcon: - { - if(!printerConnected) - { - return "tab_monitor" - } - if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") - { - return "tab_monitor_paused" - } else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error") - { - return "tab_monitor_connected" - } - } function showTooltip(item, position, text) { tooltip.text = text; @@ -64,6 +50,7 @@ Rectangle var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); return finalTime; } + MouseArea { anchors.fill: parent @@ -76,35 +63,55 @@ Rectangle } // Mode selection buttons for changing between Setting & Monitor print mode - Row + Rectangle { - id: settingAndMonitorButtons // Really need a better name for this. - + id: sidebarHeaderBar anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.right: parent.right - Button + height: childrenRect.height + color: UM.Theme.getColor("sidebar_header_bar") + + Row { - width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 - height: 50 - onClicked: monitoringPrint = false - iconSource: UM.Theme.getIcon("tab_settings"); - style: UM.Theme.styles.tool_button - checkable: true - checked: true - exclusiveGroup: settingAndMonitorButtonsGroup + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width; + anchors.right: parent.right + Button + { + width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 + height: UM.Theme.getSize("sidebar_header").height + onClicked: monitoringPrint = false + iconSource: UM.Theme.getIcon("tab_settings"); + checkable: true + checked: true + exclusiveGroup: sidebarHeaderBarGroup + + style: UM.Theme.styles.sidebar_header_tab + } + Button + { + width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 + height: UM.Theme.getSize("sidebar_header").height + onClicked: monitoringPrint = true + iconSource: { + if(!printerConnected) + { + return UM.Theme.getIcon("tab_monitor") + } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") + { + return UM.Theme.getIcon("tab_monitor_paused") + } else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error") + { + return UM.Theme.getIcon("tab_monitor_connected") + } + } + checkable: true + exclusiveGroup: sidebarHeaderBarGroup + + style: UM.Theme.styles.sidebar_header_tab + } + ExclusiveGroup { id: sidebarHeaderBarGroup } } - Button - { - width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 - height: 50 - onClicked: monitoringPrint = true - iconSource: UM.Theme.getIcon(machineMonitorIcon) - style: UM.Theme.styles.tool_button - checkable: true - exclusiveGroup: settingAndMonitorButtonsGroup - } - ExclusiveGroup { id: settingAndMonitorButtonsGroup } } SidebarHeader { @@ -112,7 +119,7 @@ Rectangle width: parent.width height: totalHeightHeader - anchors.top: settingAndMonitorButtons.bottom + anchors.top: sidebarHeaderBar.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height onShowTooltip: base.showTooltip(item, location, text) @@ -352,7 +359,7 @@ Rectangle height: UM.Theme.getSize("sidebar_lining").height color: UM.Theme.getColor("sidebar_lining") anchors.bottom: saveButton.top - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.bottomMargin: UM.Theme.getSize("default_margin").height } SaveButton diff --git a/resources/themes/cura/icons/tab_monitor.svg b/resources/themes/cura/icons/tab_monitor.svg index 03d9e97dbf..516191b988 100644 --- a/resources/themes/cura/icons/tab_monitor.svg +++ b/resources/themes/cura/icons/tab_monitor.svg @@ -1,12 +1,75 @@ - - - Fill 1 Copy 3 - Created with Sketch. - - - - - + + + + + image/svg+xml + + Fill 1 Copy 3 + + + + + + Fill 1 Copy 3 + Created with Sketch. + + + + - \ No newline at end of file + + diff --git a/resources/themes/cura/icons/tab_settings.svg b/resources/themes/cura/icons/tab_settings.svg index 82e203a294..f181147d98 100644 --- a/resources/themes/cura/icons/tab_settings.svg +++ b/resources/themes/cura/icons/tab_settings.svg @@ -1,44 +1,75 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + image/svg+xml + + Rectangle 2365 Copy 3 + + + + + + Rectangle 2365 Copy 3 + Created with Sketch. + + + + + + diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 1428c3d40a..fa2aa0cd22 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -43,6 +43,56 @@ QtObject { } } + property Component sidebar_header_tab: Component { + ButtonStyle { + background: Item { + implicitWidth: Theme.getSize("button").width; + implicitHeight: Theme.getSize("button").height; + + Rectangle { + id: buttonFace; + + anchors.fill: parent; + property bool down: control.pressed || (control.checkable && control.checked); + + color: { + if(control.pressed || (control.checkable && control.checked)) { + return Theme.getColor("sidebar_header_active"); + } else if(control.hovered) { + return Theme.getColor("sidebar_header_hover"); + } else { + return Theme.getColor("sidebar_header_bar"); + } + } + Behavior on color { ColorAnimation { duration: 50; } } + + Rectangle { + id: underline; + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: UM.Theme.getSize("sidebar_header_highlight").height + color: control.checked ? UM.Theme.getColor("sidebar_header_highlight") : UM.Theme.getColor("sidebar_header_highlight_hover") + visible: control.hovered || control.checked + } + } + } + + label: Item { + Image { + anchors.centerIn: parent; + opacity: !control.enabled ? 0.2 : 1.0 + source: control.iconSource; + width: Theme.getSize("button_icon").width; + height: Theme.getSize("button_icon").height; + + sourceSize: Theme.getSize("button_icon") + } + } + } + } + property Component tool_button: Component { ButtonStyle { background: Item { diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 9c2b9f7b03..de30996289 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -56,6 +56,10 @@ "error": [255, 140, 0, 255], "sidebar_header_bar": [24, 41, 77, 255], + "sidebar_header_active": [70, 84, 113, 255], + "sidebar_header_hover": [24, 41, 77, 255], + "sidebar_header_highlight": [12, 169, 227, 255], + "sidebar_header_highlight_hover": [255, 255, 255, 255], "sidebar_lining": [245, 245, 245, 255], "button": [24, 41, 77, 255], @@ -166,6 +170,7 @@ "sidebar": [35.0, 10.0], "sidebar_header": [0.0, 4.0], + "sidebar_header_highlight": [0.5, 0.5], "sidebar_header_mode_toggle": [0.0, 2.0], "sidebar_lining": [0.5, 0.5], "sidebar_setup": [0.0, 2.0], From d0aa33f57f62f0b56b1c689cfa821622ac792dcd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 23 Jun 2016 17:05:45 +0200 Subject: [PATCH 18/28] Added jobName property CURA-1036 --- cura/PrinterOutputDevice.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 8dca62f368..7f6e51e1fd 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -32,6 +32,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self._time_elapsed = 0 self._time_total = 0 self._job_state = "" + self._job_name = "" def requestWrite(self, node, file_name = None, filter_by_machine = False): raise NotImplementedError("requestWrite needs to be implemented") @@ -66,6 +67,8 @@ class PrinterOutputDevice(QObject, OutputDevice): jobStateChanged = pyqtSignal() + jobNameChanged = pyqtSignal() + @pyqtProperty(str, notify = jobStateChanged) def jobState(self): return self._job_state @@ -82,6 +85,15 @@ class PrinterOutputDevice(QObject, OutputDevice): def _setJobState(self, job_state): Logger.log("w", "_setJobState is not implemented by this output device") + @pyqtProperty(str, notify = jobNameChanged) + def jobName(self): + return self._job_name + + def setJobName(self, name): + if self._job_name != name: + self._job_name = name + self.jobNameChanged.emit() + ## Get the bed temperature of the bed (if any) # This function is "final" (do not re-implement) # /sa _getBedTemperature implementation function From fe05aa18cbc532ebf840951140125e38bef57f9d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 23 Jun 2016 17:27:12 +0200 Subject: [PATCH 19/28] Resize camera-image with viewport CURA-338 --- resources/qml/Cura.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 802f182de5..a88260025e 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -563,8 +563,8 @@ UM.MainWindow Image { id: cameraImage - width: 800 - height: 600 + width: Math.min(viewportOverlay.width, sourceSize.width) + height: sourceSize.height * width / sourceSize.width anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2 From d613863d83b8743ce76362e025a55fd7c2cc6443 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 23 Jun 2016 21:50:51 +0200 Subject: [PATCH 20/28] Tweak colors and icons for print monitor CURA-1036 --- resources/qml/MonitorButton.qml | 16 +- .../themes/cura/icons/tab_monitor_busy.svg | 107 +++++++++ .../cura/icons/tab_monitor_connected.svg | 66 ++--- .../themes/cura/icons/tab_monitor_offline.svg | 94 ++++++++ .../themes/cura/icons/tab_monitor_paused.svg | 226 ++++-------------- .../themes/cura/icons/tab_monitor_stopped.svg | 94 ++++++++ resources/themes/cura/theme.json | 8 +- 7 files changed, 384 insertions(+), 227 deletions(-) create mode 100644 resources/themes/cura/icons/tab_monitor_busy.svg create mode 100644 resources/themes/cura/icons/tab_monitor_offline.svg create mode 100644 resources/themes/cura/icons/tab_monitor_stopped.svg diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 49a4e38fa4..c8a776ee01 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -48,7 +48,7 @@ Rectangle anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "orange": "green" + color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") font: UM.Theme.getFont("large") text: statusText; } @@ -60,7 +60,7 @@ Rectangle anchors.right: progressBar.right //anchors.rightMargin: UM.Theme.getSize("default_margin").width - color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "orange": "green" + color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") font: UM.Theme.getFont("large") text: Math.round(progress * 100) + "%" ; } @@ -81,7 +81,7 @@ Rectangle { width: Math.max(parent.width * base.progress) height: parent.height - color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "orange": "green" + color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") radius: UM.Theme.getSize("progressbar_radius").width } } @@ -174,15 +174,5 @@ Rectangle } label: Item { } } - } - - Rectangle - { - id: saveRow - width: base.width - height: saveToButton.height - anchors.top: progressBar.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left } } diff --git a/resources/themes/cura/icons/tab_monitor_busy.svg b/resources/themes/cura/icons/tab_monitor_busy.svg new file mode 100644 index 0000000000..f0e47b91d4 --- /dev/null +++ b/resources/themes/cura/icons/tab_monitor_busy.svg @@ -0,0 +1,107 @@ + + + + + + image/svg+xml + + Fill 1 Copy 3 + + + + + + Fill 1 Copy 3 + Created with Sketch. + + + + + + + + + + + diff --git a/resources/themes/cura/icons/tab_monitor_connected.svg b/resources/themes/cura/icons/tab_monitor_connected.svg index e3b314146a..8f6f83fe91 100644 --- a/resources/themes/cura/icons/tab_monitor_connected.svg +++ b/resources/themes/cura/icons/tab_monitor_connected.svg @@ -8,9 +8,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="19px" - height="19px" - viewBox="0 0 19 19" + width="30" + height="30" + viewBox="0 0 30 30" version="1.1" id="svg2" inkscape:version="0.91 r13725" @@ -28,7 +28,7 @@ + inkscape:current-layer="svg2" + inkscape:snap-global="true" + inkscape:object-nodes="false" + inkscape:snap-smooth-nodes="false" + inkscape:snap-midpoints="false" + inkscape:snap-intersection-paths="false" + inkscape:snap-bbox="true" + inkscape:snap-others="false" + inkscape:snap-nodes="false" /> Fill 1 Copy 3 @@ -57,33 +66,30 @@ + style="fill:none;fill-rule:evenodd;stroke:none;stroke-width:1" + transform="matrix(1.3157895,0,0,1.3157895,2.5,2.4999995)"> + inkscape:connector-curvature="0" /> + style="fill:#00cd00;fill-opacity:1" + id="path3337" + cx="22.5" + cy="7.5" + r="7.5" /> + style="fill:#ffffff;fill-opacity:1" + d="M 25.546876,4.3017582 21.994141,7.9208992 19.859375,5.8408211 18.5,7.2177742 22.072266,10.698242 C 23.732574,9.0171252 25.519159,7.1853281 26.97461,5.7021492 Z" + id="rect4171" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccc" /> diff --git a/resources/themes/cura/icons/tab_monitor_offline.svg b/resources/themes/cura/icons/tab_monitor_offline.svg new file mode 100644 index 0000000000..a13a7b586e --- /dev/null +++ b/resources/themes/cura/icons/tab_monitor_offline.svg @@ -0,0 +1,94 @@ + + + + + + image/svg+xml + + Fill 1 Copy 3 + + + + + + Fill 1 Copy 3 + Created with Sketch. + + + + + + + + + diff --git a/resources/themes/cura/icons/tab_monitor_paused.svg b/resources/themes/cura/icons/tab_monitor_paused.svg index 608c279385..49c8babebd 100644 --- a/resources/themes/cura/icons/tab_monitor_paused.svg +++ b/resources/themes/cura/icons/tab_monitor_paused.svg @@ -8,9 +8,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="19px" - height="19px" - viewBox="0 0 19 19" + width="30" + height="30" + viewBox="0 0 30 30" version="1.1" id="svg2" inkscape:version="0.91 r13725" @@ -28,7 +28,7 @@ + inkscape:current-layer="svg2" + inkscape:snap-global="true" + inkscape:object-nodes="false" + inkscape:snap-smooth-nodes="false" + inkscape:snap-midpoints="false" + inkscape:snap-intersection-paths="false" + inkscape:snap-bbox="true" + inkscape:snap-others="false" + inkscape:snap-nodes="false" /> Fill 1 Copy 3 @@ -57,187 +66,38 @@ + style="fill:none;fill-rule:evenodd;stroke:none;stroke-width:1" + transform="matrix(1.3157895,0,0,1.3157895,2.5,2.4999995)"> + inkscape:connector-curvature="0" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + style="fill:#ff8c00;fill-opacity:1" + id="path3337" + cx="22.5" + cy="7.5" + r="7.5" /> + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4713" + width="2" + height="7" + x="19.5" + y="4" /> + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" + id="rect4713-3" + width="2" + height="7" + x="23.5" + y="4" /> diff --git a/resources/themes/cura/icons/tab_monitor_stopped.svg b/resources/themes/cura/icons/tab_monitor_stopped.svg new file mode 100644 index 0000000000..7f861067dd --- /dev/null +++ b/resources/themes/cura/icons/tab_monitor_stopped.svg @@ -0,0 +1,94 @@ + + + + + + image/svg+xml + + Fill 1 Copy 3 + + + + + + Fill 1 Copy 3 + Created with Sketch. + + + + + + + + + diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index de30996289..1b4b566d86 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -158,7 +158,13 @@ "message_text": [32, 166, 219, 255], "message_dismiss": [127, 127, 127, 255], - "tool_panel_background": [255, 255, 255, 255] + "tool_panel_background": [255, 255, 255, 255], + + "status_offline": [0, 0, 0, 255], + "status_ready": [0, 205, 0, 255], + "status_busy": [12, 169, 227, 255], + "status_paused": [255, 140, 0, 255], + "status_stopped": [236, 82, 80, 255] }, "sizes": { From 2143fc14abe54b6cb20d185c4f7419be1574758d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 23 Jun 2016 21:58:45 +0200 Subject: [PATCH 21/28] Add print job name CURA-1036 --- resources/qml/Sidebar.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 4a111e7903..7f91332da4 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -155,7 +155,7 @@ Rectangle Label { id: settingsModeLabel - text: catalog.i18nc("@label:listbox","Setup"); + text: catalog.i18nc("@label:listbox","Print Setup"); anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.top: headerSeparator.bottom @@ -226,7 +226,7 @@ Rectangle Label { id: monitorLabel - text: catalog.i18nc("@label","Activity Data"); + text: catalog.i18nc("@label","Printer Monitor"); anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.top: headerSeparator.bottom @@ -322,6 +322,16 @@ Rectangle Label { text: " "} Label { text: " "} + Label + { + text: "Job name:" + } + + Label + { + text: " " + Cura.MachineManager.printerOutputDevices[0].jobName + } + Label { text: "Printing Time:" From beff54e5b1f858b320b30517c5d5be5c6cb7c7be Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 24 Jun 2016 12:50:39 +0200 Subject: [PATCH 22/28] Refactor print monitor as styleable listview Listview updates when print monitor values becomes available. CURA-1036 --- resources/qml/Sidebar.qml | 183 ++++++++++++++++++++++---------------- 1 file changed, 107 insertions(+), 76 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 7f91332da4..c168ec1a55 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 -import UM 1.1 as UM +import UM 1.2 as UM import Cura 1.0 as Cura Rectangle @@ -18,6 +18,7 @@ Rectangle // Is there an output device for this printer? property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 + onPrinterConnectedChanged: populatePrintMonitorModel() color: UM.Theme.getColor("sidebar"); UM.I18nCatalog { id: catalog; name:"cura"} @@ -277,10 +278,11 @@ Rectangle } } - // Item that holds all the print monitor properties - Grid + // ListView that shows the print monitor properties + ListView { id: printMonitor + anchors.bottom: footerSeparator.top anchors.top: monitorLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -288,78 +290,43 @@ Rectangle anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: base.right visible: monitoringPrint - columns: 2 - columnSpacing: UM.Theme.getSize("default_margin").width - Label - { - text: "Temperature 1:" - } - Label - { - text: " " + Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[0]) + "°C" - } + model: printMonitorModel + delegate: Row + { + Label + { + text: label + color: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); + width: base.width * .4 + elide: Text.ElideRight; + } + Label + { + text: value + color: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); + } + } + section.property: "category" + section.criteria: ViewSection.FullString + section.delegate: Rectangle + { + color: UM.Theme.getColor("setting_category") + width: parent.width - UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("section").height - Label - { - text: "Temperature 2:" + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: section + font: UM.Theme.getFont("setting_category") + color: UM.Theme.getColor("setting_category_text") + } } - Label - { - text: " " + Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[1]) + "°C" - } - - Label - { - text: "Bed Temperature:" - } - Label - { - text: " " + Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C" - } - - // Spacers - Label { text: " "} - Label { text: " "} - - Label - { - text: "Job name:" - } - - Label - { - text: " " + Cura.MachineManager.printerOutputDevices[0].jobName - } - - Label - { - text: "Printing Time:" - } - - Label - { - text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal) - } - - Label - { - text: "Estimated time left:" - } - Label - { - text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) - } - - Label - { - text: "Current Layer:" - } - Label - { - text: " " - } - } Rectangle @@ -374,7 +341,7 @@ Rectangle SaveButton { - id: saveButton; + id: saveButton implicitWidth: base.width implicitHeight: totalHeight anchors.bottom: parent.bottom @@ -383,11 +350,11 @@ Rectangle MonitorButton { - id: monitorButton; + id: monitorButton implicitWidth: base.width implicitHeight: totalHeight anchors.bottom: parent.bottom - visible: monitoringPrint + visible: monitoringPrint && printerConnected } @@ -425,4 +392,68 @@ Rectangle modesListModel.append({ text: catalog.i18nc("@title:tab", "Advanced"), item: sidebarAdvanced }) sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true }); } -} + + UM.SettingPropertyProvider + { + id: machineExtruderCount + + containerStackId: Cura.MachineManager.activeMachineId + key: "machine_extruder_count" + watchedProperties: [ "value" ] + storeIndex: 0 + } + + ListModel { + id: printMonitorModel + Component.onCompleted: populatePrintMonitorModel() + } + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: populatePrintMonitorModel() + } + + function populatePrintMonitorModel() + { + printMonitorModel.clear(); + + if (!printerConnected) + return + + var extruderCount = machineExtruderCount.properties.value + for(var extruderNumber = 0; extruderNumber < extruderCount ; extruderNumber++) { + printMonitorModel.append({ + label: extruderCount > 1 ? catalog.i18nc("@label", "Hotend Temperature %1").arg(extruderNumber + 1) : catalog.i18nc("@label", "Hotend Temperature"), + value: Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[extruderNumber]) + "°C", + category: catalog.i18nc("@label", "Temperatures") + }) + } + printMonitorModel.append({ + label: catalog.i18nc("@label", "Bed Temperature"), + value: Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C", + category: catalog.i18nc("@label", "Temperatures") + }) + + printMonitorModel.append({ + label: catalog.i18nc("@label", "Job name"), + value: Cura.MachineManager.printerOutputDevices[0].jobName, + category: catalog.i18nc("@label", "Active print") + }) + printMonitorModel.append({ + label: catalog.i18nc("@label", "Printing Time"), + value: getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal), + category: catalog.i18nc("@label", "Active print") + }) + printMonitorModel.append({ + label: catalog.i18nc("@label", "Estimated time left"), + value: getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed), + category: catalog.i18nc("@label", "Active print") + }) + printMonitorModel.append({ + label: catalog.i18nc("@label", "Current Layer"), + value: 0, + category: catalog.i18nc("@label", "Active print") + }) + } +} \ No newline at end of file From 00ad7b23ff69ee64de38f32784efc0d2c884ad11 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 24 Jun 2016 13:39:24 +0200 Subject: [PATCH 23/28] Prevent QML warnings when there is no connected printer CURA-1036 --- resources/qml/Cura.qml | 2 +- resources/qml/MonitorButton.qml | 35 +++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a88260025e..1d9ff48259 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -569,7 +569,7 @@ UM.MainWindow anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2 visible: base.monitoringPrint - source: Cura.MachineManager.printerOutputDevices[0].cameraImage + source: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].cameraImage : "" } } } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index c8a776ee01..ca6b216a0a 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -14,7 +14,8 @@ Rectangle id: base; UM.I18nCatalog { id: catalog; name:"cura"} - property real progress: Cura.MachineManager.printerOutputDevices[0].progress; + property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 + property real progress: printerConnected ? Cura.MachineManager.printerOutputDevices[0].progress : 0; property int backendState: UM.Backend.state; property bool activity: Printer.getPlatformActivity; @@ -22,7 +23,10 @@ Rectangle property string fileBaseName property string statusText: { - if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing") + if(!printerConnected) + { + return "Please check your printer connections" + } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing") { return "Printing..." } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") @@ -48,7 +52,7 @@ Rectangle anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width - color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") + color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline") font: UM.Theme.getFont("large") text: statusText; } @@ -58,11 +62,11 @@ Rectangle id: percentageLabel anchors.top: parent.top anchors.right: progressBar.right - //anchors.rightMargin: UM.Theme.getSize("default_margin").width - color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") + color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline") font: UM.Theme.getFont("large") - text: Math.round(progress * 100) + "%" ; + text: Math.round(progress * 100) + "%"; + visible: printerConnected } Rectangle @@ -81,16 +85,16 @@ Rectangle { width: Math.max(parent.width * base.progress) height: parent.height - color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") + color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline") radius: UM.Theme.getSize("progressbar_radius").width } } - Button - { + Button + { id: abortButton - enabled: true + visible: printerConnected height: UM.Theme.getSize("save_button_save_to_button").height anchors.top: progressBar.bottom @@ -98,7 +102,7 @@ Rectangle anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@label:", "Abort Job") + text: catalog.i18nc("@label:", "Abort Print") onClicked: { Cura.MachineManager.printerOutputDevices[0].setJobState("abort") } @@ -130,20 +134,21 @@ Rectangle } label: Item { } } - } + } - Button - { + Button + { id: pauseButton height: UM.Theme.getSize("save_button_save_to_button").height + visible: printerConnected anchors.top: progressBar.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.right: abortButton.left anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") + text: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") : "" onClicked: { Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? Cura.MachineManager.printerOutputDevices[0].setJobState("print") : Cura.MachineManager.printerOutputDevices[0].setJobState("pause") } style: ButtonStyle From f6e31cd97a8e733bae643f73775d5944de13dfcb Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 24 Jun 2016 14:35:31 +0200 Subject: [PATCH 24/28] Fix updating monitored values Though the PrintMonitorModel was a nicer solution, it broke the binding of values coming from the PrinterOutputDevices CURA-1036 --- resources/qml/Sidebar.qml | 181 +++++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 81 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index c168ec1a55..71dade0b22 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -278,8 +278,8 @@ Rectangle } } - // ListView that shows the print monitor properties - ListView + // Item that shows the print monitor properties + Column { id: printMonitor @@ -291,40 +291,103 @@ Rectangle anchors.right: base.right visible: monitoringPrint - model: printMonitorModel - delegate: Row + Loader { - Label + sourceComponent: monitorSection + property string label: catalog.i18nc("@label", "Temperatures") + } + Repeater + { + model: machineExtruderCount.properties.value + delegate: Loader { - text: label - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default"); - width: base.width * .4 - elide: Text.ElideRight; - } - Label - { - text: value - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default"); + sourceComponent: monitorItem + property string label: machineExtruderCount.properties.value > 1 ? catalog.i18nc("@label", "Hotend Temperature %1").arg(index + 1) : catalog.i18nc("@label", "Hotend Temperature") + property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[index]) + "°C" : "" } } - section.property: "category" - section.criteria: ViewSection.FullString - section.delegate: Rectangle + Repeater { - color: UM.Theme.getColor("setting_category") - width: parent.width - UM.Theme.getSize("default_margin").width - height: UM.Theme.getSize("section").height - - Label + model: machineHeatedBed.properties.value == "True" ? 1 : 0 + delegate: Loader { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - text: section - font: UM.Theme.getFont("setting_category") - color: UM.Theme.getColor("setting_category_text") + sourceComponent: monitorItem + property string label: catalog.i18nc("@label", "Bed Temperature") + property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C" : "" + } + } + + Loader + { + sourceComponent: monitorSection + property string label: catalog.i18nc("@label", "Active print") + } + Loader + { + sourceComponent: monitorItem + property string label: catalog.i18nc("@label", "Job Name") + property string value: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobName : "" + } + Loader + { + sourceComponent: monitorItem + property string label: catalog.i18nc("@label", "Printing Time") + property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal) : "" + } + Loader + { + sourceComponent: monitorItem + property string label: catalog.i18nc("@label", "Estimated time left") + property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) : "" + } + Loader + { + sourceComponent: monitorItem + property string label: catalog.i18nc("@label", "Current Layer") + property string value: printerConnected ? "0" : "" + } + + Component + { + id: monitorItem + + Row + { + Label + { + text: label + color: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); + width: base.width * 0.4 + elide: Text.ElideRight; + } + Label + { + text: value + color: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); + } + } + } + Component + { + id: monitorSection + + Rectangle + { + color: UM.Theme.getColor("setting_category") + width: base.width - 2 * UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("section").height + + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: label + font: UM.Theme.getFont("setting_category") + color: UM.Theme.getColor("setting_category_text") + } } } } @@ -354,7 +417,7 @@ Rectangle implicitWidth: base.width implicitHeight: totalHeight anchors.bottom: parent.bottom - visible: monitoringPrint && printerConnected + visible: monitoringPrint } @@ -403,57 +466,13 @@ Rectangle storeIndex: 0 } - ListModel { - id: printMonitorModel - Component.onCompleted: populatePrintMonitorModel() - } - - Connections + UM.SettingPropertyProvider { - target: Cura.MachineManager - onGlobalContainerChanged: populatePrintMonitorModel() - } + id: machineHeatedBed - function populatePrintMonitorModel() - { - printMonitorModel.clear(); - - if (!printerConnected) - return - - var extruderCount = machineExtruderCount.properties.value - for(var extruderNumber = 0; extruderNumber < extruderCount ; extruderNumber++) { - printMonitorModel.append({ - label: extruderCount > 1 ? catalog.i18nc("@label", "Hotend Temperature %1").arg(extruderNumber + 1) : catalog.i18nc("@label", "Hotend Temperature"), - value: Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[extruderNumber]) + "°C", - category: catalog.i18nc("@label", "Temperatures") - }) - } - printMonitorModel.append({ - label: catalog.i18nc("@label", "Bed Temperature"), - value: Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C", - category: catalog.i18nc("@label", "Temperatures") - }) - - printMonitorModel.append({ - label: catalog.i18nc("@label", "Job name"), - value: Cura.MachineManager.printerOutputDevices[0].jobName, - category: catalog.i18nc("@label", "Active print") - }) - printMonitorModel.append({ - label: catalog.i18nc("@label", "Printing Time"), - value: getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal), - category: catalog.i18nc("@label", "Active print") - }) - printMonitorModel.append({ - label: catalog.i18nc("@label", "Estimated time left"), - value: getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed), - category: catalog.i18nc("@label", "Active print") - }) - printMonitorModel.append({ - label: catalog.i18nc("@label", "Current Layer"), - value: 0, - category: catalog.i18nc("@label", "Active print") - }) + containerStackId: Cura.MachineManager.activeMachineId + key: "machine_heated_bed" + watchedProperties: [ "value" ] + storeIndex: 0 } } \ No newline at end of file From 8bc2c6e042b06c9118480082be0da778c30bc447 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 24 Jun 2016 14:41:52 +0200 Subject: [PATCH 25/28] Tweak styling CURA-1036 --- resources/qml/Sidebar.qml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 71dade0b22..32dd1caa4f 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -353,19 +353,22 @@ Rectangle Row { + height: UM.Theme.getSize("setting_control").height Label { text: label - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default"); + color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + font: UM.Theme.getFont("default") width: base.width * 0.4 - elide: Text.ElideRight; + elide: Text.ElideRight + anchors.verticalCenter: parent.verticalCenter } Label { text: value - color: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default"); + color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + font: UM.Theme.getFont("default") + anchors.verticalCenter: parent.verticalCenter } } } From a4eee2dce6692955724ed94c63be22b4b65a5ec5 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sat, 25 Jun 2016 09:38:10 +0200 Subject: [PATCH 26/28] Show relevant message on splash screen during startup --- cura/CuraApplication.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7ce3a938cf..7aced51a6c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -122,7 +122,6 @@ class CuraApplication(QtApplication): self._platform = None self._output_devices = {} self._print_information = None - self._i18n_catalog = None self._previous_active_tool = None self._platform_activity = False self._scene_bounding_box = AxisAlignedBox.Null @@ -133,12 +132,16 @@ class CuraApplication(QtApplication): self._cura_actions = None self._started = False + self._i18n_catalog = i18nCatalog("cura") + self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity) self.getController().toolOperationStopped.connect(self._onToolOperationStopped) Resources.addType(self.ResourceTypes.QmlFiles, "qml") Resources.addType(self.ResourceTypes.Firmware, "firmware") + self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Loading machines...")) + ## Add the 4 types of profiles to storage. Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality") Resources.addStorageType(self.ResourceTypes.VariantInstanceContainer, "variants") @@ -326,8 +329,6 @@ class CuraApplication(QtApplication): parser.add_argument("--debug", dest="debug-mode", action="store_true", default=False, help="Enable detailed crash reports.") def run(self): - self._i18n_catalog = i18nCatalog("cura"); - i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", From 2ee745e1f92d4955f574fc6bf60c5d82649e264c Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sat, 25 Jun 2016 09:40:22 +0200 Subject: [PATCH 27/28] Remove hack i18nCatalog was being abused to do text replacement on HTML --- cura/CuraApplication.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7aced51a6c..9d068d1214 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -329,11 +329,6 @@ class CuraApplication(QtApplication): parser.add_argument("--debug", dest="debug-mode", action="store_true", default=False, help="Enable detailed crash reports.") def run(self): - i18nCatalog.setTagReplacements({ - "filename": "font color=\"black\"", - "message": "font color=UM.Theme.colors.message_text;", - }) - self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() From 612888c9fbbea7809d26e2e46a15d6db1d4a42d4 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 10:25:02 +0200 Subject: [PATCH 28/28] Remove remnant code CURA-1036 --- resources/qml/Sidebar.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 32dd1caa4f..e1516214f1 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -18,7 +18,6 @@ Rectangle // Is there an output device for this printer? property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 - onPrinterConnectedChanged: populatePrintMonitorModel() color: UM.Theme.getColor("sidebar"); UM.I18nCatalog { id: catalog; name:"cura"}