From b7673a74388574cd2aca6b810940a6ecf1b01702 Mon Sep 17 00:00:00 2001
From: Simon Edwards
Date: Tue, 18 Sep 2018 16:27:22 +0200
Subject: [PATCH 01/31] Show Cura Connect alerts in the monitor tab
CL-897
---
cura/PrinterOutput/PrintJobOutputModel.py | 16 +-
.../resources/qml/ClusterMonitorItem.qml | 1 -
.../resources/qml/PrintJobInfoBlock.qml | 240 +++++++++++++++++-
.../src/ClusterUM3OutputDevice.py | 16 ++
4 files changed, 268 insertions(+), 5 deletions(-)
diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py
index 7366b95f86..c194f5df32 100644
--- a/cura/PrinterOutput/PrintJobOutputModel.py
+++ b/cura/PrinterOutput/PrintJobOutputModel.py
@@ -12,6 +12,8 @@ if TYPE_CHECKING:
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel
+from cura.PrinterOutput.ConfigurationChangeModel import ConfigurationChangeModel
+
class PrintJobOutputModel(QObject):
stateChanged = pyqtSignal()
@@ -24,6 +26,7 @@ class PrintJobOutputModel(QObject):
configurationChanged = pyqtSignal()
previewImageChanged = pyqtSignal()
compatibleMachineFamiliesChanged = pyqtSignal()
+ configurationChangesChanged = pyqtSignal()
def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None:
super().__init__(parent)
@@ -41,6 +44,7 @@ class PrintJobOutputModel(QObject):
self._preview_image_id = 0
self._preview_image = None # type: Optional[QImage]
+ self._configuration_changes = [] # type: List[ConfigurationChangeModel]
@pyqtProperty("QStringList", notify=compatibleMachineFamiliesChanged)
def compatibleMachineFamilies(self):
@@ -147,4 +151,14 @@ class PrintJobOutputModel(QObject):
@pyqtSlot(str)
def setState(self, state):
- self._output_controller.setJobState(self, state)
\ No newline at end of file
+ self._output_controller.setJobState(self, state)
+
+ @pyqtProperty("QVariantList", notify=configurationChangesChanged)
+ def configurationChanges(self) -> List[ConfigurationChangeModel]:
+ return self._configuration_changes
+
+ def updateConfigurationChanges(self, changes: List[ConfigurationChangeModel]) -> None:
+ if len(self._configuration_changes) == 0 and len(changes) == 0:
+ return
+ self._configuration_changes = changes
+ self.configurationChangesChanged.emit()
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index f6cf6607c7..b55b5c6779 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -85,7 +85,6 @@ Component
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").height
anchors.leftMargin: UM.Theme.getSize("default_margin").height
- height: 175 * screenScaleFactor
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 71c2104318..f0e07807e2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -2,6 +2,8 @@ import QtQuick 2.2
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
+import QtQuick.Layouts 1.1
+import QtQuick.Dialogs 1.1
import UM 1.3 as UM
@@ -9,6 +11,110 @@ import UM 1.3 as UM
Item
{
id: base
+
+ function haveAlert() {
+ return printJob.configurationChanges.length !== 0;
+ }
+
+ function alertHeight() {
+ return haveAlert() ? 230 : 0;
+ }
+
+ function alertText() {
+ if (printJob.configurationChanges.length === 0) {
+ return "";
+ }
+
+ var topLine;
+ if (materialsAreKnown(printJob)) {
+ topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printJob.assignedPrinter.name);
+ } else {
+ topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printJob.assignedPrinter.name);
+ }
+ var result = "" + topLine +"
";
+
+ for (var i=0; i" + text + "
";
+ }
+ return result;
+ }
+
+ function materialsAreKnown(printJob) {
+ var conf0 = printJob.configuration[0];
+ if (conf0 && !conf0.material.material) {
+ return false;
+ }
+
+ var conf1 = printJob.configuration[1];
+ if (conf1 && !conf1.material.material) {
+ return false;
+ }
+
+ return true;
+ }
+
+ function formatBuildPlateType(buildPlateType) {
+ var translationText = "";
+
+ switch (buildPlateType) {
+ case 'glass':
+ translationText = catalog.i18nc("@label", "Glass");
+ break;
+ case 'aluminum':
+ translationText = catalog.i18nc("@label", "Aluminum");
+ break;
+ default:
+ translationText = null;
+ }
+ return translationText;
+ }
+
+ function formatPrintJobName(name) {
+ var extensionsToRemove = [
+ '.gz',
+ '.gcode',
+ '.ufp'
+ ];
+
+ for (var i = 0; i < extensionsToRemove.length; i++) {
+ var extension = extensionsToRemove[i];
+
+ if (name.slice(-extension.length) === extension) {
+ name = name.substring(0, name.length - extension.length);
+ }
+ }
+
+ return name;
+ }
+
+ function isPrintJobForcable(printJob) {
+ var forcable = true;
+
+ for (var i = 0; i < printJob.configurationChanges.length; i++) {
+ var typeOfChange = printJob.configurationChanges[i].typeOfChange;
+ if (typeOfChange === 'material_insert' || typeOfChange === 'buildplate_change') {
+ forcable = false;
+ }
+ }
+
+ return forcable;
+ }
+
+ property var cardHeight: 175
+
+ height: (cardHeight + alertHeight()) * screenScaleFactor
property var printJob: null
property var shadowRadius: 5 * screenScaleFactor
function getPrettyTime(time)
@@ -27,6 +133,9 @@ Item
Rectangle
{
id: background
+
+ height: (cardHeight + alertHeight()) * screenScaleFactor
+
anchors
{
top: parent.top
@@ -35,7 +144,7 @@ Item
leftMargin: base.shadowRadius
rightMargin: base.shadowRadius
right: parent.right
- bottom: parent.bottom
+ //bottom: parent.bottom - alertHeight() * screenScaleFactor
bottomMargin: base.shadowRadius
}
@@ -47,6 +156,18 @@ Item
color: "#3F000000" // 25% shadow
}
+ Rectangle
+ {
+ height: cardHeight * screenScaleFactor
+
+ anchors
+ {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ // bottom: parent.bottom
+ }
+
Item
{
// Content on the left of the infobox
@@ -392,15 +513,128 @@ Item
}
}
-
+ }
Rectangle
{
+ height: cardHeight * screenScaleFactor
color: UM.Theme.getColor("viewport_background")
width: 2 * screenScaleFactor
anchors.top: parent.top
- anchors.bottom: parent.bottom
anchors.margins: UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter
}
+
+ // Alert / Configuration change box
+ Rectangle
+ {
+ height: alertHeight() * screenScaleFactor
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+
+color: "#ff00ff"
+ ColumnLayout
+ {
+ anchors.fill: parent
+ RowLayout
+ {
+ Item
+ {
+ Layout.fillWidth: true
+ }
+
+ Label
+ {
+ font: UM.Theme.getFont("default_bold")
+ text: "Configuration change"
+ }
+
+ UM.RecolorImage
+ {
+ id: collapseIcon
+ width: 15
+ height: 15
+ sourceSize.width: width
+ sourceSize.height: height
+
+ // FIXME
+ source: base.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
+ color: "black"
+ }
+
+ Item
+ {
+ Layout.fillWidth: true
+ }
+
+ }
+
+ Rectangle
+ {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+color: "red"
+
+ Rectangle
+ {
+color: "green"
+ width: childrenRect.width
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ ColumnLayout
+ {
+ width: childrenRect.width
+
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+
+ Text
+ {
+ Layout.alignment: Qt.AlignTop
+
+ textFormat: Text.StyledText
+ font: UM.Theme.getFont("default_bold")
+ text: alertText()
+ }
+
+ Button
+ {
+ visible: isPrintJobForcable(printJob)
+ text: catalog.i18nc("@label", "Override")
+ onClicked: {
+ overrideConfirmationDialog.visible = true;
+ }
+ }
+
+ // Spacer
+ Item
+ {
+ Layout.fillHeight: true
+ }
+ }
+ }
+ }
+ }
+ }
+
+ MessageDialog
+ {
+ id: overrideConfirmationDialog
+ title: catalog.i18nc("@window:title", "Override configuration")
+ icon: StandardIcon.Warning
+ text: {
+ var printJobName = formatPrintJobName(printJob.name);
+ var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
+ return confirmText;
+ }
+
+ standardButtons: StandardButton.Yes | StandardButton.No
+ Component.onCompleted: visible = false
+ onYes: OutputDevice.forceSendJob(printJob.key)
+ }
}
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
index 409ca7a84a..79040373ae 100644
--- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
+++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
@@ -17,6 +17,7 @@ from UM.Scene.SceneNode import SceneNode # For typing.
from UM.Version import Version # To check against firmware versions for support.
from cura.CuraApplication import CuraApplication
+from cura.PrinterOutput.ConfigurationChangeModel import ConfigurationChangeModel
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState
@@ -406,6 +407,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
# is a modification of the cluster queue and not of the actual job.
self.delete("print_jobs/{uuid}".format(uuid = print_job_uuid), on_finished=None)
+ @pyqtSlot(str)
+ def forceSendJob(self, print_job_uuid: str) -> None:
+ data = "{\"force\": true}"
+ self.put("print_jobs/{uuid}".format(uuid=print_job_uuid), data, on_finished=None)
+
def _printJobStateChanged(self) -> None:
username = self._getUserName()
@@ -574,6 +580,16 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
if not status_set_by_impediment:
print_job.updateState(data["status"])
+ print_job.updateConfigurationChanges(self._createConfigurationChanges(data["configuration_changes_required"]))
+
+ def _createConfigurationChanges(self, data: List[Dict[str, Any]]) -> List[ConfigurationChangeModel]:
+ result = []
+ for change in data:
+ result.append(ConfigurationChangeModel(type_of_change=change["type_of_change"],
+ index=change["index"],
+ target_name=change["target_name"],
+ origin_name=change["origin_name"]))
+ return result
def _createMaterialOutputModel(self, material_data) -> MaterialOutputModel:
containers = ContainerRegistry.getInstance().findInstanceContainers(type="material", GUID=material_data["guid"])
From 9d85f3ece615e69d30695c5feff5094c1081b181 Mon Sep 17 00:00:00 2001
From: Simon Edwards
Date: Wed, 19 Sep 2018 17:02:46 +0200
Subject: [PATCH 02/31] Use the same string as the web front-end
CL-897
---
plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index f0e07807e2..ad583edcf8 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -624,7 +624,7 @@ color: "green"
MessageDialog
{
id: overrideConfirmationDialog
- title: catalog.i18nc("@window:title", "Override configuration")
+ title: catalog.i18nc("@window:title", "Override configuration configuration and start print")
icon: StandardIcon.Warning
text: {
var printJobName = formatPrintJobName(printJob.name);
From 9d53a31ec12a046848fed5823cd80a4b510d3608 Mon Sep 17 00:00:00 2001
From: Simon Edwards
Date: Thu, 20 Sep 2018 10:28:14 +0200
Subject: [PATCH 03/31] Add a missing file
CL-897
---
.../PrinterOutput/ConfigurationChangeModel.py | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 cura/PrinterOutput/ConfigurationChangeModel.py
diff --git a/cura/PrinterOutput/ConfigurationChangeModel.py b/cura/PrinterOutput/ConfigurationChangeModel.py
new file mode 100644
index 0000000000..b032a08ec2
--- /dev/null
+++ b/cura/PrinterOutput/ConfigurationChangeModel.py
@@ -0,0 +1,30 @@
+
+from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
+
+
+class ConfigurationChangeModel(QObject):
+ def __init__(self, type_of_change: str, index: int, target_name: str, origin_name: str) -> None:
+ super().__init__()
+ self._type_of_change = type_of_change
+ # enum = ["material", "print_core_change"]
+ self._index = index
+ self._target_name = target_name
+ self._origin_name = origin_name
+
+ @pyqtProperty(int)
+ def index(self) -> int:
+ return self._index
+ # "target_id": fields.String(required=True, description="Target material guid or hotend id"),
+ # "origin_id": fields.String(required=True, description="Original/current material guid or hotend id"),
+
+ @pyqtProperty(str)
+ def typeOfChange(self) -> str:
+ return self._type_of_change
+
+ @pyqtProperty(str)
+ def targetName(self) -> str:
+ return self._target_name
+
+ @pyqtProperty(str)
+ def originName(self) -> str:
+ return self._origin_name
From 0e44a782514e6497c98a77d692121a67aea04a79 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Thu, 20 Sep 2018 15:33:10 +0200
Subject: [PATCH 04/31] Set non-NOTIFY properties to constants
---
cura/PrinterOutput/ConfigurationChangeModel.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/cura/PrinterOutput/ConfigurationChangeModel.py b/cura/PrinterOutput/ConfigurationChangeModel.py
index b032a08ec2..f40a0c2e6b 100644
--- a/cura/PrinterOutput/ConfigurationChangeModel.py
+++ b/cura/PrinterOutput/ConfigurationChangeModel.py
@@ -1,7 +1,8 @@
+# Copyright (c) 2018 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
-
class ConfigurationChangeModel(QObject):
def __init__(self, type_of_change: str, index: int, target_name: str, origin_name: str) -> None:
super().__init__()
@@ -11,20 +12,20 @@ class ConfigurationChangeModel(QObject):
self._target_name = target_name
self._origin_name = origin_name
- @pyqtProperty(int)
+ @pyqtProperty(int, constant = True)
def index(self) -> int:
return self._index
# "target_id": fields.String(required=True, description="Target material guid or hotend id"),
# "origin_id": fields.String(required=True, description="Original/current material guid or hotend id"),
- @pyqtProperty(str)
+ @pyqtProperty(str, constant = True)
def typeOfChange(self) -> str:
return self._type_of_change
- @pyqtProperty(str)
+ @pyqtProperty(str, constant = True)
def targetName(self) -> str:
return self._target_name
- @pyqtProperty(str)
+ @pyqtProperty(str, constant = True)
def originName(self) -> str:
return self._origin_name
From a2f5dda564654e7b0c7900aae2bb2d9f90c3092d Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Thu, 20 Sep 2018 17:13:45 +0200
Subject: [PATCH 05/31] Out with the old...
Contributes to CL-897
---
.../resources/qml/PrintJobInfoBlock.qml | 1306 ++++++++---------
1 file changed, 652 insertions(+), 654 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index aa6c9a72df..4e79d1ce4e 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -5,659 +5,657 @@ import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
-
import UM 1.3 as UM
-
-Item
-{
- id: base
-
- function haveAlert() {
- return printJob.configurationChanges.length !== 0;
- }
-
- function alertHeight() {
- return haveAlert() ? 230 : 0;
- }
-
- function alertText() {
- if (printJob.configurationChanges.length === 0) {
- return "";
- }
-
- var topLine;
- if (materialsAreKnown(printJob)) {
- topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printJob.assignedPrinter.name);
- } else {
- topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printJob.assignedPrinter.name);
- }
- var result = "" + topLine +"
";
-
- for (var i=0; i" + text + " ";
- }
- return result;
- }
-
- function materialsAreKnown(printJob) {
- var conf0 = printJob.configuration[0];
- if (conf0 && !conf0.material.material) {
- return false;
- }
-
- var conf1 = printJob.configuration[1];
- if (conf1 && !conf1.material.material) {
- return false;
- }
-
- return true;
- }
-
- function formatBuildPlateType(buildPlateType) {
- var translationText = "";
-
- switch (buildPlateType) {
- case 'glass':
- translationText = catalog.i18nc("@label", "Glass");
- break;
- case 'aluminum':
- translationText = catalog.i18nc("@label", "Aluminum");
- break;
- default:
- translationText = null;
- }
- return translationText;
- }
-
- function formatPrintJobName(name) {
- var extensionsToRemove = [
- '.gz',
- '.gcode',
- '.ufp'
- ];
-
- for (var i = 0; i < extensionsToRemove.length; i++) {
- var extension = extensionsToRemove[i];
-
- if (name.slice(-extension.length) === extension) {
- name = name.substring(0, name.length - extension.length);
- }
- }
-
- return name;
- }
-
- function isPrintJobForcable(printJob) {
- var forcable = true;
-
- for (var i = 0; i < printJob.configurationChanges.length; i++) {
- var typeOfChange = printJob.configurationChanges[i].typeOfChange;
- if (typeOfChange === 'material_insert' || typeOfChange === 'buildplate_change') {
- forcable = false;
- }
- }
-
- return forcable;
- }
-
- property var cardHeight: 175
-
- height: (cardHeight + alertHeight()) * screenScaleFactor
- property var printJob: null
- property var shadowRadius: 5 * screenScaleFactor
- function getPrettyTime(time)
- {
- return OutputDevice.formatDuration(time)
- }
-
- width: parent.width
-
- UM.I18nCatalog
- {
- id: catalog
- name: "cura"
- }
-
- Rectangle
- {
- id: background
-
- height: (cardHeight + alertHeight()) * screenScaleFactor
-
- anchors
- {
- top: parent.top
- topMargin: 3 * screenScaleFactor
- left: parent.left
- leftMargin: base.shadowRadius
- rightMargin: base.shadowRadius
- right: parent.right
- //bottom: parent.bottom - alertHeight() * screenScaleFactor
- bottomMargin: base.shadowRadius
- }
-
- layer.enabled: true
- layer.effect: DropShadow
- {
- radius: base.shadowRadius
- verticalOffset: 2 * screenScaleFactor
- color: "#3F000000" // 25% shadow
- }
-
- Rectangle
- {
- height: cardHeight * screenScaleFactor
-
- anchors
- {
- top: parent.top
- left: parent.left
- right: parent.right
- // bottom: parent.bottom
- }
-
- Item
- {
- // Content on the left of the infobox
- anchors
- {
- top: parent.top
- bottom: parent.bottom
- left: parent.left
- right: parent.horizontalCenter
- margins: UM.Theme.getSize("wide_margin").width
- rightMargin: UM.Theme.getSize("default_margin").width
- }
-
- Label
- {
- id: printJobName
- text: printJob.name
- font: UM.Theme.getFont("default_bold")
- width: parent.width
- elide: Text.ElideRight
- }
-
- Label
- {
- id: ownerName
- anchors.top: printJobName.bottom
- text: printJob.owner
- font: UM.Theme.getFont("default")
- opacity: 0.6
- width: parent.width
- elide: Text.ElideRight
- }
-
- Image
- {
- id: printJobPreview
- source: printJob.previewImageUrl
- anchors.top: ownerName.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: totalTimeLabel.bottom
- width: height
- opacity: printJob.state == "error" ? 0.5 : 1.0
- }
-
- UM.RecolorImage
- {
- id: statusImage
- anchors.centerIn: printJobPreview
- source: printJob.state == "error" ? "../svg/aborted-icon.svg" : ""
- visible: source != ""
- width: 0.5 * printJobPreview.width
- height: 0.5 * printJobPreview.height
- sourceSize.width: width
- sourceSize.height: height
- color: "black"
- }
-
- Label
- {
- id: totalTimeLabel
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- font: UM.Theme.getFont("default")
- text: printJob != null ? getPrettyTime(printJob.timeTotal) : ""
- elide: Text.ElideRight
- }
- }
-
- Item
- {
- // Content on the right side of the infobox.
- anchors
- {
- top: parent.top
- bottom: parent.bottom
- left: parent.horizontalCenter
- right: parent.right
- margins: 2 * UM.Theme.getSize("default_margin").width
- leftMargin: UM.Theme.getSize("default_margin").width
- rightMargin: UM.Theme.getSize("default_margin").width / 2
- }
-
- Label
- {
- id: targetPrinterLabel
- elide: Text.ElideRight
- font: UM.Theme.getFont("default_bold")
- text:
- {
- if(printJob.assignedPrinter == null)
- {
- if(printJob.state == "error")
- {
- return catalog.i18nc("@label", "Waiting for: Unavailable printer")
- }
- return catalog.i18nc("@label", "Waiting for: First available")
- }
- else
- {
- return catalog.i18nc("@label", "Waiting for: ") + printJob.assignedPrinter.name
- }
-
- }
-
- anchors
- {
- left: parent.left
- right: contextButton.left
- rightMargin: UM.Theme.getSize("default_margin").width
- }
- }
-
-
- function switchPopupState()
- {
- popup.visible ? popup.close() : popup.open()
- }
-
- Button
- {
- id: contextButton
- text: "\u22EE" //Unicode; Three stacked points.
- width: 35
- height: width
- anchors
- {
- right: parent.right
- top: parent.top
- }
- hoverEnabled: true
-
- background: Rectangle
- {
- opacity: contextButton.down || contextButton.hovered ? 1 : 0
- width: contextButton.width
- height: contextButton.height
- radius: 0.5 * width
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: contextButton.text
- color: UM.Theme.getColor("monitor_text_inactive")
- font.pixelSize: 25
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignHCenter
- }
-
- onClicked: parent.switchPopupState()
- }
-
- Popup
- {
- // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
- id: popup
- clip: true
- closePolicy: Popup.CloseOnPressOutside
- x: (parent.width - width) + 26 * screenScaleFactor
- y: contextButton.height - 5 * screenScaleFactor // Because shadow
- width: 182 * screenScaleFactor
- height: contentItem.height + 2 * padding
- visible: false
- padding: 5 * screenScaleFactor // Because shadow
-
- transformOrigin: Popup.Top
- contentItem: Item
- {
- width: popup.width
- height: childrenRect.height + 36 * screenScaleFactor
- anchors.topMargin: 10 * screenScaleFactor
- anchors.bottomMargin: 10 * screenScaleFactor
- Button
- {
- id: sendToTopButton
- text: catalog.i18nc("@label", "Move to top")
- onClicked:
- {
- sendToTopConfirmationDialog.visible = true;
- popup.close();
- }
- width: parent.width
- enabled: OutputDevice.queuedPrintJobs[0].key != printJob.key
- visible: enabled
- anchors.top: parent.top
- anchors.topMargin: 18 * screenScaleFactor
- height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
- hoverEnabled: true
- background: Rectangle
- {
- opacity: sendToTopButton.down || sendToTopButton.hovered ? 1 : 0
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: sendToTopButton.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- }
- }
-
- MessageDialog
- {
- id: sendToTopConfirmationDialog
- title: catalog.i18nc("@window:title", "Move print job to top")
- icon: StandardIcon.Warning
- text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name)
- standardButtons: StandardButton.Yes | StandardButton.No
- Component.onCompleted: visible = false
- onYes: OutputDevice.sendJobToTop(printJob.key)
- }
-
- Button
- {
- id: deleteButton
- text: catalog.i18nc("@label", "Delete")
- onClicked:
- {
- deleteConfirmationDialog.visible = true;
- popup.close();
- }
- width: parent.width
- height: 39 * screenScaleFactor
- anchors.top: sendToTopButton.bottom
- hoverEnabled: true
- background: Rectangle
- {
- opacity: deleteButton.down || deleteButton.hovered ? 1 : 0
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: deleteButton.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- }
- }
-
- MessageDialog
- {
- id: deleteConfirmationDialog
- title: catalog.i18nc("@window:title", "Delete print job")
- icon: StandardIcon.Warning
- text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name)
- standardButtons: StandardButton.Yes | StandardButton.No
- Component.onCompleted: visible = false
- onYes: OutputDevice.deleteJobFromQueue(printJob.key)
- }
- }
-
- background: Item
- {
- width: popup.width
- height: popup.height
-
- DropShadow
- {
- anchors.fill: pointedRectangle
- radius: 5
- color: "#3F000000" // 25% shadow
- source: pointedRectangle
- transparentBorder: true
- verticalOffset: 2
- }
-
- Item
- {
- id: pointedRectangle
- width: parent.width - 10 * screenScaleFactor // Because of the shadow
- height: parent.height - 10 * screenScaleFactor // Because of the shadow
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
-
- Rectangle
- {
- id: point
- height: 14 * screenScaleFactor
- width: 14 * screenScaleFactor
- color: UM.Theme.getColor("setting_control")
- transform: Rotation { angle: 45}
- anchors.right: bloop.right
- anchors.rightMargin: 24
- y: 1
- }
-
- Rectangle
- {
- id: bloop
- color: UM.Theme.getColor("setting_control")
- width: parent.width
- anchors.top: parent.top
- anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
- }
- }
- }
-
- exit: Transition
- {
- // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- NumberAnimation { property: "visible"; duration: 75; }
- }
- enter: Transition
- {
- // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- NumberAnimation { property: "visible"; duration: 75; }
- }
-
- onClosed: visible = false
- onOpened: visible = true
- }
-
- Row
- {
- id: printerFamilyPills
- spacing: 0.5 * UM.Theme.getSize("default_margin").width
- anchors
- {
- left: parent.left
- right: parent.right
- bottom: extrudersInfo.top
- bottomMargin: UM.Theme.getSize("default_margin").height
- }
- height: childrenRect.height
- Repeater
- {
- model: printJob.compatibleMachineFamilies
-
- delegate: PrinterFamilyPill
- {
- text: modelData
- color: UM.Theme.getColor("viewport_background")
- padding: 3 * screenScaleFactor
- }
- }
- }
- // PrintCore && Material config
- Row
- {
- id: extrudersInfo
- anchors.bottom: parent.bottom
-
- anchors
- {
- left: parent.left
- right: parent.right
- }
- height: childrenRect.height
-
- spacing: UM.Theme.getSize("default_margin").width
-
- PrintCoreConfiguration
- {
- id: leftExtruderInfo
- width: Math.round(parent.width / 2) * screenScaleFactor
- printCoreConfiguration: printJob.configuration.extruderConfigurations[0]
- }
-
- PrintCoreConfiguration
- {
- id: rightExtruderInfo
- width: Math.round(parent.width / 2) * screenScaleFactor
- printCoreConfiguration: printJob.configuration.extruderConfigurations[1]
- }
- }
-
- }
- }
- Rectangle
- {
- height: cardHeight * screenScaleFactor
- color: UM.Theme.getColor("viewport_background")
- width: 2 * screenScaleFactor
- anchors.top: parent.top
- anchors.margins: UM.Theme.getSize("default_margin").height
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- // Alert / Configuration change box
- Rectangle
- {
- height: alertHeight() * screenScaleFactor
-
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
-
-color: "#ff00ff"
- ColumnLayout
- {
- anchors.fill: parent
- RowLayout
- {
- Item
- {
- Layout.fillWidth: true
- }
-
- Label
- {
- font: UM.Theme.getFont("default_bold")
- text: "Configuration change"
- }
-
- UM.RecolorImage
- {
- id: collapseIcon
- width: 15
- height: 15
- sourceSize.width: width
- sourceSize.height: height
-
- // FIXME
- source: base.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
- color: "black"
- }
-
- Item
- {
- Layout.fillWidth: true
- }
-
- }
-
- Rectangle
- {
- Layout.fillHeight: true
- Layout.fillWidth: true
-color: "red"
-
- Rectangle
- {
-color: "green"
- width: childrenRect.width
-
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.top
- anchors.bottom: parent.bottom
-
- ColumnLayout
- {
- width: childrenRect.width
-
- anchors.top: parent.top
- anchors.bottom: parent.bottom
-
- Text
- {
- Layout.alignment: Qt.AlignTop
-
- textFormat: Text.StyledText
- font: UM.Theme.getFont("default_bold")
- text: alertText()
- }
-
- Button
- {
- visible: isPrintJobForcable(printJob)
- text: catalog.i18nc("@label", "Override")
- onClicked: {
- overrideConfirmationDialog.visible = true;
- }
- }
-
- // Spacer
- Item
- {
- Layout.fillHeight: true
- }
- }
- }
- }
- }
- }
-
- MessageDialog
- {
- id: overrideConfirmationDialog
- title: catalog.i18nc("@window:title", "Override configuration configuration and start print")
- icon: StandardIcon.Warning
- text: {
- var printJobName = formatPrintJobName(printJob.name);
- var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
- return confirmText;
- }
-
- standardButtons: StandardButton.Yes | StandardButton.No
- Component.onCompleted: visible = false
- onYes: OutputDevice.forceSendJob(printJob.key)
- }
- }
-}
\ No newline at end of file
+// Item
+// {
+// id: base
+
+// function haveAlert() {
+// return printJob.configurationChanges.length !== 0;
+// }
+
+// function alertHeight() {
+// return haveAlert() ? 230 : 0;
+// }
+
+// function alertText() {
+// if (printJob.configurationChanges.length === 0) {
+// return "";
+// }
+
+// var topLine;
+// if (materialsAreKnown(printJob)) {
+// topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printJob.assignedPrinter.name);
+// } else {
+// topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printJob.assignedPrinter.name);
+// }
+// var result = "" + topLine +"
";
+
+// for (var i=0; i" + text + " ";
+// }
+// return result;
+// }
+
+// function materialsAreKnown(printJob) {
+// var conf0 = printJob.configuration[0];
+// if (conf0 && !conf0.material.material) {
+// return false;
+// }
+
+// var conf1 = printJob.configuration[1];
+// if (conf1 && !conf1.material.material) {
+// return false;
+// }
+
+// return true;
+// }
+
+// function formatBuildPlateType(buildPlateType) {
+// var translationText = "";
+
+// switch (buildPlateType) {
+// case 'glass':
+// translationText = catalog.i18nc("@label", "Glass");
+// break;
+// case 'aluminum':
+// translationText = catalog.i18nc("@label", "Aluminum");
+// break;
+// default:
+// translationText = null;
+// }
+// return translationText;
+// }
+
+// function formatPrintJobName(name) {
+// var extensionsToRemove = [
+// '.gz',
+// '.gcode',
+// '.ufp'
+// ];
+
+// for (var i = 0; i < extensionsToRemove.length; i++) {
+// var extension = extensionsToRemove[i];
+
+// if (name.slice(-extension.length) === extension) {
+// name = name.substring(0, name.length - extension.length);
+// }
+// }
+
+// return name;
+// }
+
+// function isPrintJobForcable(printJob) {
+// var forcable = true;
+
+// for (var i = 0; i < printJob.configurationChanges.length; i++) {
+// var typeOfChange = printJob.configurationChanges[i].typeOfChange;
+// if (typeOfChange === 'material_insert' || typeOfChange === 'buildplate_change') {
+// forcable = false;
+// }
+// }
+
+// return forcable;
+// }
+
+// property var cardHeight: 175
+
+// height: (cardHeight + alertHeight()) * screenScaleFactor
+// property var printJob: null
+// property var shadowRadius: 5 * screenScaleFactor
+// function getPrettyTime(time)
+// {
+// return OutputDevice.formatDuration(time)
+// }
+
+// width: parent.width
+
+// UM.I18nCatalog
+// {
+// id: catalog
+// name: "cura"
+// }
+
+// Rectangle
+// {
+// id: background
+
+// height: (cardHeight + alertHeight()) * screenScaleFactor
+
+// anchors
+// {
+// top: parent.top
+// topMargin: 3 * screenScaleFactor
+// left: parent.left
+// leftMargin: base.shadowRadius
+// rightMargin: base.shadowRadius
+// right: parent.right
+// //bottom: parent.bottom - alertHeight() * screenScaleFactor
+// bottomMargin: base.shadowRadius
+// }
+
+// layer.enabled: true
+// layer.effect: DropShadow
+// {
+// radius: base.shadowRadius
+// verticalOffset: 2 * screenScaleFactor
+// color: "#3F000000" // 25% shadow
+// }
+
+// Rectangle
+// {
+// height: cardHeight * screenScaleFactor
+
+// anchors
+// {
+// top: parent.top
+// left: parent.left
+// right: parent.right
+// // bottom: parent.bottom
+// }
+
+// Item
+// {
+// // Content on the left of the infobox
+// anchors
+// {
+// top: parent.top
+// bottom: parent.bottom
+// left: parent.left
+// right: parent.horizontalCenter
+// margins: UM.Theme.getSize("wide_margin").width
+// rightMargin: UM.Theme.getSize("default_margin").width
+// }
+
+// Label
+// {
+// id: printJobName
+// text: printJob.name
+// font: UM.Theme.getFont("default_bold")
+// width: parent.width
+// elide: Text.ElideRight
+// }
+
+// Label
+// {
+// id: ownerName
+// anchors.top: printJobName.bottom
+// text: printJob.owner
+// font: UM.Theme.getFont("default")
+// opacity: 0.6
+// width: parent.width
+// elide: Text.ElideRight
+// }
+
+// Image
+// {
+// id: printJobPreview
+// source: printJob.previewImageUrl
+// anchors.top: ownerName.bottom
+// anchors.horizontalCenter: parent.horizontalCenter
+// anchors.bottom: totalTimeLabel.bottom
+// width: height
+// opacity: printJob.state == "error" ? 0.5 : 1.0
+// }
+
+// UM.RecolorImage
+// {
+// id: statusImage
+// anchors.centerIn: printJobPreview
+// source: printJob.state == "error" ? "../svg/aborted-icon.svg" : ""
+// visible: source != ""
+// width: 0.5 * printJobPreview.width
+// height: 0.5 * printJobPreview.height
+// sourceSize.width: width
+// sourceSize.height: height
+// color: "black"
+// }
+
+// Label
+// {
+// id: totalTimeLabel
+// anchors.bottom: parent.bottom
+// anchors.right: parent.right
+// font: UM.Theme.getFont("default")
+// text: printJob != null ? getPrettyTime(printJob.timeTotal) : ""
+// elide: Text.ElideRight
+// }
+// }
+
+// Item
+// {
+// // Content on the right side of the infobox.
+// anchors
+// {
+// top: parent.top
+// bottom: parent.bottom
+// left: parent.horizontalCenter
+// right: parent.right
+// margins: 2 * UM.Theme.getSize("default_margin").width
+// leftMargin: UM.Theme.getSize("default_margin").width
+// rightMargin: UM.Theme.getSize("default_margin").width / 2
+// }
+
+// Label
+// {
+// id: targetPrinterLabel
+// elide: Text.ElideRight
+// font: UM.Theme.getFont("default_bold")
+// text:
+// {
+// if(printJob.assignedPrinter == null)
+// {
+// if(printJob.state == "error")
+// {
+// return catalog.i18nc("@label", "Waiting for: Unavailable printer")
+// }
+// return catalog.i18nc("@label", "Waiting for: First available")
+// }
+// else
+// {
+// return catalog.i18nc("@label", "Waiting for: ") + printJob.assignedPrinter.name
+// }
+
+// }
+
+// anchors
+// {
+// left: parent.left
+// right: contextButton.left
+// rightMargin: UM.Theme.getSize("default_margin").width
+// }
+// }
+
+
+// function switchPopupState()
+// {
+// popup.visible ? popup.close() : popup.open()
+// }
+
+// Button
+// {
+// id: contextButton
+// text: "\u22EE" //Unicode; Three stacked points.
+// width: 35
+// height: width
+// anchors
+// {
+// right: parent.right
+// top: parent.top
+// }
+// hoverEnabled: true
+
+// background: Rectangle
+// {
+// opacity: contextButton.down || contextButton.hovered ? 1 : 0
+// width: contextButton.width
+// height: contextButton.height
+// radius: 0.5 * width
+// color: UM.Theme.getColor("viewport_background")
+// }
+// contentItem: Label
+// {
+// text: contextButton.text
+// color: UM.Theme.getColor("monitor_text_inactive")
+// font.pixelSize: 25
+// verticalAlignment: Text.AlignVCenter
+// horizontalAlignment: Text.AlignHCenter
+// }
+
+// onClicked: parent.switchPopupState()
+// }
+
+// Popup
+// {
+// // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
+// id: popup
+// clip: true
+// closePolicy: Popup.CloseOnPressOutside
+// x: (parent.width - width) + 26 * screenScaleFactor
+// y: contextButton.height - 5 * screenScaleFactor // Because shadow
+// width: 182 * screenScaleFactor
+// height: contentItem.height + 2 * padding
+// visible: false
+// padding: 5 * screenScaleFactor // Because shadow
+
+// transformOrigin: Popup.Top
+// contentItem: Item
+// {
+// width: popup.width
+// height: childrenRect.height + 36 * screenScaleFactor
+// anchors.topMargin: 10 * screenScaleFactor
+// anchors.bottomMargin: 10 * screenScaleFactor
+// Button
+// {
+// id: sendToTopButton
+// text: catalog.i18nc("@label", "Move to top")
+// onClicked:
+// {
+// sendToTopConfirmationDialog.visible = true;
+// popup.close();
+// }
+// width: parent.width
+// enabled: OutputDevice.queuedPrintJobs[0].key != printJob.key
+// visible: enabled
+// anchors.top: parent.top
+// anchors.topMargin: 18 * screenScaleFactor
+// height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
+// hoverEnabled: true
+// background: Rectangle
+// {
+// opacity: sendToTopButton.down || sendToTopButton.hovered ? 1 : 0
+// color: UM.Theme.getColor("viewport_background")
+// }
+// contentItem: Label
+// {
+// text: sendToTopButton.text
+// horizontalAlignment: Text.AlignLeft
+// verticalAlignment: Text.AlignVCenter
+// }
+// }
+
+// MessageDialog
+// {
+// id: sendToTopConfirmationDialog
+// title: catalog.i18nc("@window:title", "Move print job to top")
+// icon: StandardIcon.Warning
+// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name)
+// standardButtons: StandardButton.Yes | StandardButton.No
+// Component.onCompleted: visible = false
+// onYes: OutputDevice.sendJobToTop(printJob.key)
+// }
+
+// Button
+// {
+// id: deleteButton
+// text: catalog.i18nc("@label", "Delete")
+// onClicked:
+// {
+// deleteConfirmationDialog.visible = true;
+// popup.close();
+// }
+// width: parent.width
+// height: 39 * screenScaleFactor
+// anchors.top: sendToTopButton.bottom
+// hoverEnabled: true
+// background: Rectangle
+// {
+// opacity: deleteButton.down || deleteButton.hovered ? 1 : 0
+// color: UM.Theme.getColor("viewport_background")
+// }
+// contentItem: Label
+// {
+// text: deleteButton.text
+// horizontalAlignment: Text.AlignLeft
+// verticalAlignment: Text.AlignVCenter
+// }
+// }
+
+// MessageDialog
+// {
+// id: deleteConfirmationDialog
+// title: catalog.i18nc("@window:title", "Delete print job")
+// icon: StandardIcon.Warning
+// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name)
+// standardButtons: StandardButton.Yes | StandardButton.No
+// Component.onCompleted: visible = false
+// onYes: OutputDevice.deleteJobFromQueue(printJob.key)
+// }
+// }
+
+// background: Item
+// {
+// width: popup.width
+// height: popup.height
+
+// DropShadow
+// {
+// anchors.fill: pointedRectangle
+// radius: 5
+// color: "#3F000000" // 25% shadow
+// source: pointedRectangle
+// transparentBorder: true
+// verticalOffset: 2
+// }
+
+// Item
+// {
+// id: pointedRectangle
+// width: parent.width - 10 * screenScaleFactor // Because of the shadow
+// height: parent.height - 10 * screenScaleFactor // Because of the shadow
+// anchors.horizontalCenter: parent.horizontalCenter
+// anchors.verticalCenter: parent.verticalCenter
+
+// Rectangle
+// {
+// id: point
+// height: 14 * screenScaleFactor
+// width: 14 * screenScaleFactor
+// color: UM.Theme.getColor("setting_control")
+// transform: Rotation { angle: 45}
+// anchors.right: bloop.right
+// anchors.rightMargin: 24
+// y: 1
+// }
+
+// Rectangle
+// {
+// id: bloop
+// color: UM.Theme.getColor("setting_control")
+// width: parent.width
+// anchors.top: parent.top
+// anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
+// anchors.bottom: parent.bottom
+// anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
+// }
+// }
+// }
+
+// exit: Transition
+// {
+// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
+// NumberAnimation { property: "visible"; duration: 75; }
+// }
+// enter: Transition
+// {
+// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
+// NumberAnimation { property: "visible"; duration: 75; }
+// }
+
+// onClosed: visible = false
+// onOpened: visible = true
+// }
+
+// Row
+// {
+// id: printerFamilyPills
+// spacing: 0.5 * UM.Theme.getSize("default_margin").width
+// anchors
+// {
+// left: parent.left
+// right: parent.right
+// bottom: extrudersInfo.top
+// bottomMargin: UM.Theme.getSize("default_margin").height
+// }
+// height: childrenRect.height
+// Repeater
+// {
+// model: printJob.compatibleMachineFamilies
+
+// delegate: PrinterFamilyPill
+// {
+// text: modelData
+// color: UM.Theme.getColor("viewport_background")
+// padding: 3 * screenScaleFactor
+// }
+// }
+// }
+// // PrintCore && Material config
+// Row
+// {
+// id: extrudersInfo
+// anchors.bottom: parent.bottom
+
+// anchors
+// {
+// left: parent.left
+// right: parent.right
+// }
+// height: childrenRect.height
+
+// spacing: UM.Theme.getSize("default_margin").width
+
+// PrintCoreConfiguration
+// {
+// id: leftExtruderInfo
+// width: Math.round(parent.width / 2) * screenScaleFactor
+// printCoreConfiguration: printJob.configuration.extruderConfigurations[0]
+// }
+
+// PrintCoreConfiguration
+// {
+// id: rightExtruderInfo
+// width: Math.round(parent.width / 2) * screenScaleFactor
+// printCoreConfiguration: printJob.configuration.extruderConfigurations[1]
+// }
+// }
+
+// }
+// }
+// Rectangle
+// {
+// height: cardHeight * screenScaleFactor
+// color: UM.Theme.getColor("viewport_background")
+// width: 2 * screenScaleFactor
+// anchors.top: parent.top
+// anchors.margins: UM.Theme.getSize("default_margin").height
+// anchors.horizontalCenter: parent.horizontalCenter
+// }
+
+// // Alert / Configuration change box
+// Rectangle
+// {
+// height: alertHeight() * screenScaleFactor
+
+// anchors.left: parent.left
+// anchors.right: parent.right
+// anchors.bottom: parent.bottom
+
+// color: "#ff00ff"
+// ColumnLayout
+// {
+// anchors.fill: parent
+// RowLayout
+// {
+// Item
+// {
+// Layout.fillWidth: true
+// }
+
+// Label
+// {
+// font: UM.Theme.getFont("default_bold")
+// text: "Configuration change"
+// }
+
+// UM.RecolorImage
+// {
+// id: collapseIcon
+// width: 15
+// height: 15
+// sourceSize.width: width
+// sourceSize.height: height
+
+// // FIXME
+// source: base.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
+// color: "black"
+// }
+
+// Item
+// {
+// Layout.fillWidth: true
+// }
+
+// }
+
+// Rectangle
+// {
+// Layout.fillHeight: true
+// Layout.fillWidth: true
+// color: "red"
+
+// Rectangle
+// {
+// color: "green"
+// width: childrenRect.width
+
+// anchors.horizontalCenter: parent.horizontalCenter
+// anchors.top: parent.top
+// anchors.bottom: parent.bottom
+
+// ColumnLayout
+// {
+// width: childrenRect.width
+
+// anchors.top: parent.top
+// anchors.bottom: parent.bottom
+
+// Text
+// {
+// Layout.alignment: Qt.AlignTop
+
+// textFormat: Text.StyledText
+// font: UM.Theme.getFont("default_bold")
+// text: alertText()
+// }
+
+// Button
+// {
+// visible: isPrintJobForcable(printJob)
+// text: catalog.i18nc("@label", "Override")
+// onClicked: {
+// overrideConfirmationDialog.visible = true;
+// }
+// }
+
+// // Spacer
+// Item
+// {
+// Layout.fillHeight: true
+// }
+// }
+// }
+// }
+// }
+// }
+
+// MessageDialog
+// {
+// id: overrideConfirmationDialog
+// title: catalog.i18nc("@window:title", "Override configuration configuration and start print")
+// icon: StandardIcon.Warning
+// text: {
+// var printJobName = formatPrintJobName(printJob.name);
+// var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
+// return confirmText;
+// }
+
+// standardButtons: StandardButton.Yes | StandardButton.No
+// Component.onCompleted: visible = false
+// onYes: OutputDevice.forceSendJob(printJob.key)
+// }
+// }
+// }
\ No newline at end of file
From 50e07ae2a782a84a9b9bedd32c613192c02bc502 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Thu, 20 Sep 2018 17:14:19 +0200
Subject: [PATCH 06/31] ...and in with the new.
Contributes to CL-897
---
.../resources/qml/PrintJobInfoBlock.qml | 149 ++++++++++++++++++
1 file changed, 149 insertions(+)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 4e79d1ce4e..aa2bcc7906 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -7,6 +7,155 @@ import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import UM 1.3 as UM
+Item {
+
+ id: root
+
+ property var shadowRadius: 5;
+ property var shadowOffset: 2;
+ property var debug: true;
+ property var printJob: null;
+ property var hasChanges: {
+ if (printJob) {
+ return printJob.configurationChanges.length !== 0;
+ }
+ return false;
+ }
+
+ width: parent.width; // Bubbles downward
+ height: childrenRect.height + shadowRadius * 2; // Bubbles upward
+
+ // The actual card (white block)
+ Rectangle {
+
+ color: "white";
+ height: childrenRect.height;
+ width: parent.width - shadowRadius * 2;
+
+ // 5px margin, but shifted 2px vertically because of the shadow
+ anchors {
+ topMargin: shadowRadius - shadowOffset;
+ bottomMargin: shadowRadius + shadowOffset;
+ leftMargin: shadowRadius;
+ rightMargin: shadowRadius;
+ }
+
+ Column {
+
+ width: parent.width;
+ height: childrenRect.height
+
+ // Main content
+ Rectangle {
+
+ color: root.debug ? "red" : "transparent";
+ width: parent.width;
+ height: 200;
+
+ // Left content
+ Rectangle {
+ color: root.debug ? "lightblue" : "transparent";
+ anchors {
+ left: parent.left;
+ right: parent.horizontalCenter;
+ top: parent.top;
+ bottom: parent.bottom;
+ margins: UM.Theme.getSize("wide_margin").width
+ }
+ }
+
+ Rectangle {
+ height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
+ width: 1
+ color: "black";
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ }
+
+ // Right content
+ Rectangle {
+ color: root.debug ? "blue" : "transparent";
+ anchors {
+ left: parent.horizontalCenter;
+ right: parent.right;
+ top: parent.top;
+ bottom: parent.bottom;
+ margins: UM.Theme.getSize("wide_margin").width
+ }
+ }
+ }
+
+ // Config change toggle
+ Rectangle {
+ color: root.debug ? "orange" : "transparent";
+ width: parent.width;
+ visible: root.hasChanges;
+ height: visible ? 40 : 0;
+ MouseArea {
+ anchors.fill: parent;
+ onClicked: {
+ configChangeDetails.visible = !configChangeDetails.visible;
+ }
+ }
+ Label {
+ id: configChangeToggleLabel;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ text: "Configuration change";
+ }
+ UM.RecolorImage {
+ width: 15;
+ height: 15;
+ anchors {
+ left: configChangeToggleLabel.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ sourceSize.width: width;
+ sourceSize.height: height;
+ source: {
+ if (configChangeDetails.visible) {
+ return UM.Theme.getIcon("arrow_top");
+ } else {
+ return UM.Theme.getIcon("arrow_bottom");
+ }
+ }
+ color: "black";
+ }
+ }
+
+ // Config change details
+ Rectangle {
+ id: configChangeDetails
+ color: root.debug ? "yellow" : "transparent";
+ width: parent.width;
+ visible: false;
+ height: visible ? 150 : 0;
+ Behavior on height { NumberAnimation { duration: 100 } }
+
+ Rectangle {
+ color: root.debug ? "lime" : "transparent";
+ anchors {
+ fill: parent;
+ topMargin: UM.Theme.getSize("wide_margin").height;
+ bottomMargin: UM.Theme.getSize("wide_margin").height;
+ leftMargin: UM.Theme.getSize("wide_margin").height * 4;
+ rightMargin: UM.Theme.getSize("wide_margin").height * 4;
+ }
+ Label {
+ wrapMode: Text.WordWrap;
+ text: "The assigned printer, UltiSandra, requires the following configuration change(s): Change material 1 from PLA to ABS.";
+ }
+ }
+ }
+ }
+ }
+}
+
// Item
// {
// id: base
From 302f9a95b34fb911aa21fcab57f796c8e9573afa Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Thu, 27 Sep 2018 13:40:46 +0200
Subject: [PATCH 07/31] Cleaned-up printe job info block
Contributes to CL-897, CL-1051
---
.../resources/qml/ClusterControlItem.qml | 14 +-
.../resources/qml/ClusterMonitorItem.qml | 52 +-
.../qml/ConfigurationChangeBlock.qml | 243 +++++++++
.../resources/qml/PrintCoreConfiguration.qml | 166 +++---
.../resources/qml/PrintJobInfoBlock.qml | 481 +++++++++++++++---
.../resources/svg/ultibot.svg | 1 +
.../resources/svg/warning-icon.svg | 5 +-
resources/themes/cura-light/theme.json | 15 +-
8 files changed, 811 insertions(+), 166 deletions(-)
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
create mode 100644 plugins/UM3NetworkPrinting/resources/svg/ultibot.svg
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
index f8ad0e763e..774ab75f0d 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
@@ -111,11 +111,11 @@ Component
{
if(modelData.state == "disabled")
{
- return UM.Theme.getColor("monitor_background_inactive")
+ return UM.Theme.getColor("monitor_tab_background_inactive")
}
else
{
- return UM.Theme.getColor("monitor_background_active")
+ return UM.Theme.getColor("monitor_tab_background_active")
}
}
id: base
@@ -196,7 +196,7 @@ Component
{
if(modelData.state == "disabled")
{
- return UM.Theme.getColor("monitor_text_inactive")
+ return UM.Theme.getColor("monitor_tab_text_inactive")
}
if(modelData.activePrintJob != undefined)
@@ -204,7 +204,7 @@ Component
return UM.Theme.getColor("primary")
}
- return UM.Theme.getColor("monitor_text_inactive")
+ return UM.Theme.getColor("monitor_tab_text_inactive")
}
}
}
@@ -252,7 +252,7 @@ Component
width: parent.width
elide: Text.ElideRight
font: UM.Theme.getFont("default")
- color: UM.Theme.getColor("monitor_text_inactive")
+ color: UM.Theme.getColor("monitor_tab_text_inactive")
}
}
@@ -427,7 +427,7 @@ Component
contentItem: Label
{
text: contextButton.text
- color: UM.Theme.getColor("monitor_text_inactive")
+ color: UM.Theme.getColor("monitor_tab_text_inactive")
font.pixelSize: 25
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
@@ -762,7 +762,7 @@ Component
]
if(inactiveStates.indexOf(state) > -1 && remainingTime > 0)
{
- return UM.Theme.getColor("monitor_text_inactive")
+ return UM.Theme.getColor("monitor_tab_text_inactive")
}
else
{
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index b55b5c6779..a027043b85 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -56,35 +56,69 @@ Component
color: UM.Theme.getColor("text")
}
- ScrollView
+ Column
{
- id: queuedPrintJobs
-
+ id: skeletonLoader
+ visible: printJobList.count === 0;
+ width: Math.min(800 * screenScaleFactor, maximumWidth)
anchors
{
top: queuedLabel.bottom
topMargin: UM.Theme.getSize("default_margin").height
horizontalCenter: parent.horizontalCenter
- bottomMargin: 0
+ bottomMargin: UM.Theme.getSize("default_margin").height
+ bottom: parent.bottom
+ }
+ PrintJobInfoBlock
+ {
+ printJob: null // Use as skeleton
+ anchors
+ {
+ left: parent.left
+ right: parent.right
+ rightMargin: UM.Theme.getSize("default_margin").width
+ leftMargin: UM.Theme.getSize("default_margin").width
+ }
+ }
+ PrintJobInfoBlock
+ {
+ printJob: null // Use as skeleton
+ anchors
+ {
+ left: parent.left
+ right: parent.right
+ rightMargin: UM.Theme.getSize("default_margin").width
+ leftMargin: UM.Theme.getSize("default_margin").width
+ }
+ }
+ }
+
+ ScrollView
+ {
+ id: queuedPrintJobs
+ anchors {
+ top: queuedLabel.bottom
+ topMargin: UM.Theme.getSize("default_margin").height
+ horizontalCenter: parent.horizontalCenter
+ bottomMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
}
style: UM.Theme.styles.scrollview
width: Math.min(800 * screenScaleFactor, maximumWidth)
+
ListView
{
+ id: printJobList;
anchors.fill: parent
- //anchors.margins: UM.Theme.getSize("default_margin").height
spacing: UM.Theme.getSize("default_margin").height - 10 // 2x the shadow radius
-
model: OutputDevice.queuedPrintJobs
-
delegate: PrintJobInfoBlock
{
printJob: modelData
anchors.left: parent.left
anchors.right: parent.right
- anchors.rightMargin: UM.Theme.getSize("default_margin").height
- anchors.leftMargin: UM.Theme.getSize("default_margin").height
+ anchors.rightMargin: UM.Theme.getSize("default_margin").width
+ anchors.leftMargin: UM.Theme.getSize("default_margin").width
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
new file mode 100644
index 0000000000..48e2e9ce3c
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -0,0 +1,243 @@
+import QtQuick 2.2
+import QtQuick.Dialogs 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.4
+import QtGraphicalEffects 1.0
+import QtQuick.Layouts 1.1
+import QtQuick.Dialogs 1.1
+import UM 1.3 as UM
+
+Rectangle {
+ id: root;
+ property var job: null;
+ property var materialsAreKnown: {
+ var conf0 = job.configuration[0];
+ if (conf0 && !conf0.material.material) {
+ return false;
+ }
+ var conf1 = job.configuration[1];
+ if (conf1 && !conf1.material.material) {
+ return false;
+ }
+ return true;
+ }
+ color: "pink";
+ width: parent.width;
+ height: childrenRect.height;
+
+ Column {
+ width: parent.width;
+ height: childrenRect.height;
+
+ // Config change toggle
+ Rectangle {
+ color: {
+ if(configurationChangeToggle.containsMouse) {
+ return UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ } else {
+ return "transparent";
+ }
+ }
+ width: parent.width;
+ height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme!
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ top: parent.top;
+ }
+
+ Rectangle {
+ width: parent.width;
+ height: UM.Theme.getSize("default_lining").height;
+ color: "#e6e6e6"; // TODO: Theme!
+ }
+
+ UM.RecolorImage {
+ width: 23; // TODO: Theme!
+ height: 23; // TODO: Theme!
+ anchors {
+ right: configChangeToggleLabel.left;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ sourceSize.width: width;
+ sourceSize.height: height;
+ source: "../svg/warning-icon.svg";
+ color: UM.Theme.getColor("text");
+ }
+
+ Label {
+ id: configChangeToggleLabel;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ text: "Configuration change"; // TODO: i18n!
+ }
+
+ UM.RecolorImage {
+ width: 15; // TODO: Theme!
+ height: 15; // TODO: Theme!
+ anchors {
+ left: configChangeToggleLabel.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ sourceSize.width: width;
+ sourceSize.height: height;
+ source: {
+ if (configChangeDetails.visible) {
+ return UM.Theme.getIcon("arrow_top");
+ } else {
+ return UM.Theme.getIcon("arrow_bottom");
+ }
+ }
+ color: UM.Theme.getColor("text");
+ }
+
+ MouseArea {
+ id: configurationChangeToggle;
+ anchors.fill: parent;
+ hoverEnabled: true;
+ onClicked: {
+ configChangeDetails.visible = !configChangeDetails.visible;
+ }
+ }
+ }
+
+ // Config change details
+ Rectangle {
+ id: configChangeDetails
+ color: "transparent";
+ width: parent.width;
+ visible: false;
+ height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0;
+ Behavior on height { NumberAnimation { duration: 100 } }
+
+ Rectangle {
+ color: "transparent";
+ clip: true;
+ anchors {
+ fill: parent;
+ topMargin: UM.Theme.getSize("wide_margin").height;
+ bottomMargin: UM.Theme.getSize("wide_margin").height;
+ leftMargin: UM.Theme.getSize("wide_margin").height * 4;
+ rightMargin: UM.Theme.getSize("wide_margin").height * 4;
+ }
+
+ Label {
+ anchors.fill: parent;
+ wrapMode: Text.WordWrap;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("large_nonbold");
+ text: {
+ if (root.job.configurationChanges.length === 0) {
+ return "";
+ }
+ var topLine;
+ if (root.materialsAreKnown) {
+ topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(root.job.assignedPrinter.name);
+ } else {
+ topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(root.job.assignedPrinter.name);
+ }
+ var result = "" + topLine +"
";
+ for (var i = 0; i < root.job.configurationChanges.length; i++) {
+ var change = root.job.configurationChanges[i];
+ var text;
+ switch (change.typeOfChange) {
+ case 'material_change':
+ text = catalog.i18nc("@label", "Change material %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName);
+ break;
+ case 'material_insert':
+ text = catalog.i18nc("@label", "Load %3 as material %1 (This cannot be overridden).").arg(change.index + 1).arg(change.targetName);
+ break;
+ case 'print_core_change':
+ text = catalog.i18nc("@label", "Change print core %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName);
+ break;
+ case 'buildplate_change':
+ text = catalog.i18nc("@label", "Change build plate to %1 (This cannot be overridden).").arg(formatBuildPlateType(change.target_name));
+ break;
+ default:
+ text = "";
+ }
+ result += "" + text + "
";
+ }
+ return result;
+ }
+ }
+
+ Button {
+ anchors {
+ bottom: parent.bottom;
+ left: parent.left;
+ }
+ visible: {
+ var length = root.job.configurationChanges.length;
+ for (var i = 0; i < length; i++) {
+ var typeOfChange = root.job.configurationChanges[i].typeOfChange;
+ if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
+ return false;
+ }
+ }
+ return true;
+ }
+ text: catalog.i18nc("@label", "Override");
+ onClicked: {
+ overrideConfirmationDialog.visible = true;
+ }
+ }
+ }
+ }
+ }
+
+ MessageDialog {
+ id: overrideConfirmationDialog;
+ title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
+ icon: StandardIcon.Warning;
+ text: {
+ var printJobName = formatPrintJobName(root.job.name);
+ var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
+ return confirmText;
+ }
+ standardButtons: StandardButton.Yes | StandardButton.No;
+ Component.onCompleted: visible = false;
+ onYes: OutputDevice.forceSendJob(root.job.key);
+ }
+
+ // Utils
+ function formatPrintJobName(name) {
+ var extensions = [ ".gz", ".gcode", ".ufp" ];
+ for (var i = 0; i < extensions.length; i++) {
+ var extension = extensions[i];
+ if (name.slice(-extension.length) === extension) {
+ name = name.substring(0, name.length - extension.length);
+ }
+ }
+ return name;
+ }
+ function materialsAreKnown(job) {
+ var conf0 = job.configuration[0];
+ if (conf0 && !conf0.material.material) {
+ return false;
+ }
+ var conf1 = job.configuration[1];
+ if (conf1 && !conf1.material.material) {
+ return false;
+ }
+ return true;
+ }
+ function formatBuildPlateType(buildPlateType) {
+ var translationText = "";
+ switch (buildPlateType) {
+ case 'glass':
+ translationText = catalog.i18nc("@label", "Glass");
+ break;
+ case 'aluminum':
+ translationText = catalog.i18nc("@label", "Aluminum");
+ break;
+ default:
+ translationText = null;
+ }
+ return translationText;
+ }
+}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index b2f4e85f9a..ca39d2663d 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -1,93 +1,119 @@
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
-
import UM 1.2 as UM
-
-Item
-{
+Item {
id: extruderInfo
- property var printCoreConfiguration
- width: Math.round(parent.width / 2)
- height: childrenRect.height
+ property var printCoreConfiguration: null;
- Item
- {
+ width: Math.round(parent.width / 2);
+ height: childrenRect.height;
+
+ // Extruder circle
+ Item {
id: extruderCircle
- width: 30
- height: 30
- anchors.verticalCenter: printAndMaterialLabel.verticalCenter
- opacity:
- {
- if(printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null)
- {
- return 0.5
+ width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
+ height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
+ anchors.verticalCenter: parent.verticalCenter;
+
+ // Loading skeleton
+ Rectangle {
+ visible: !extruderInfo.printCoreConfiguration;
+ anchors.fill: parent;
+ radius: Math.round(width / 2);
+ color: UM.Theme.getColor("viewport_background");
+ }
+
+ // Actual content
+ Rectangle {
+ visible: extruderInfo.printCoreConfiguration;
+ anchors.fill: parent;
+ radius: Math.round(width / 2);
+ border.width: UM.Theme.getSize("monitor_tab_thick_lining").width;
+ border.color: UM.Theme.getColor("monitor_tab_lining_active");
+ opacity: {
+ if (printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null) {
+ return 0.5;
+ }
+ return 1;
}
- return 1
- }
- Rectangle
- {
- anchors.fill: parent
- radius: Math.round(width / 2)
- border.width: 2
- border.color: "black"
- }
-
- Label
- {
- anchors.centerIn: parent
- font: UM.Theme.getFont("default_bold")
- text: printCoreConfiguration.position + 1
+ Label {
+ anchors.centerIn: parent;
+ font: UM.Theme.getFont("default_bold");
+ text: printCoreConfiguration.position + 1;
+ }
}
}
- Item
- {
- id: printAndMaterialLabel
- anchors
- {
- right: parent.right
- left: extruderCircle.right
- margins: UM.Theme.getSize("default_margin").width
- }
- height: childrenRect.height
+ // Print core and material labels
+ Item {
+ id: materialLabel
- Label
- {
- id: materialLabel
- text:
- {
- if(printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined)
- {
- return printCoreConfiguration.activeMaterial.name
- }
- return ""
- }
- font: UM.Theme.getFont("default")
- elide: Text.ElideRight
- width: parent.width
+ anchors {
+ left: extruderCircle.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ top: parent.top;
+ right: parent.right;
+ }
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+
+ // Loading skeleton
+ Rectangle {
+ visible: !extruderInfo.printCoreConfiguration;
+ anchors.fill: parent;
+ color: UM.Theme.getColor("viewport_background");
}
- Label
- {
- id: printCoreLabel
- text:
- {
- if(printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined)
- {
- return printCoreConfiguration.hotendID
+ // Actual content
+ Label {
+ visible: extruderInfo.printCoreConfiguration;
+ anchors.fill: parent;
+ text: {
+ if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) {
+ return printCoreConfiguration.activeMaterial.name;
}
- return ""
+ return "";
}
- anchors.top: materialLabel.bottom
- elide: Text.ElideRight
- width: parent.width
- opacity: 0.6
- font: UM.Theme.getFont("default")
+ font: UM.Theme.getFont("default");
+ elide: Text.ElideRight;
+ }
+ }
+
+ Item {
+ id: printCoreLabel;
+
+ anchors {
+ right: parent.right;
+ left: extruderCircle.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ bottom: parent.bottom;
+ }
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+
+ // Loading skeleton
+ Rectangle {
+ visible: !extruderInfo.printCoreConfiguration;
+ width: parent.width / 3;
+ height: parent.height;
+ color: UM.Theme.getColor("viewport_background");
+ }
+
+ // Actual content
+ Label {
+ visible: extruderInfo.printCoreConfiguration;
+ text: {
+ if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) {
+ return printCoreConfiguration.hotendID;
+ }
+ return "";
+ }
+ elide: Text.ElideRight;
+ opacity: 0.6;
+ font: UM.Theme.getFont("default");
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index aa2bcc7906..cb6b0fb4df 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -8,49 +8,51 @@ import QtQuick.Dialogs 1.1
import UM 1.3 as UM
Item {
-
id: root
property var shadowRadius: 5;
property var shadowOffset: 2;
- property var debug: true;
+ property var debug: false;
property var printJob: null;
- property var hasChanges: {
- if (printJob) {
- return printJob.configurationChanges.length !== 0;
- }
- return false;
- }
width: parent.width; // Bubbles downward
height: childrenRect.height + shadowRadius * 2; // Bubbles upward
+ UM.I18nCatalog {
+ id: catalog;
+ name: "cura";
+ }
+
// The actual card (white block)
Rectangle {
-
- color: "white";
+ color: "white"; // TODO: Theme!
height: childrenRect.height;
width: parent.width - shadowRadius * 2;
// 5px margin, but shifted 2px vertically because of the shadow
anchors {
- topMargin: shadowRadius - shadowOffset;
- bottomMargin: shadowRadius + shadowOffset;
- leftMargin: shadowRadius;
- rightMargin: shadowRadius;
+ topMargin: root.shadowRadius - root.shadowOffset;
+ bottomMargin: root.shadowRadius + root.shadowOffset;
+ leftMargin: root.shadowRadius;
+ rightMargin: root.shadowRadius;
+ }
+ layer.enabled: true
+ layer.effect: DropShadow {
+ radius: root.shadowRadius
+ verticalOffset: 2 * screenScaleFactor
+ color: "#3F000000" // 25% shadow
}
Column {
-
width: parent.width;
- height: childrenRect.height
+ height: childrenRect.height;
// Main content
Rectangle {
-
+ id: mainContent;
color: root.debug ? "red" : "transparent";
width: parent.width;
- height: 200;
+ height: 200; // TODO: Theme!
// Left content
Rectangle {
@@ -62,12 +64,114 @@ Item {
bottom: parent.bottom;
margins: UM.Theme.getSize("wide_margin").width
}
+
+ Item {
+ id: printJobName;
+
+ width: parent.width;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+
+ Rectangle {
+ visible: !root.printJob;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ height: parent.height;
+ width: parent.width / 3;
+ }
+ Label {
+ visible: root.printJob;
+ text: root.printJob ? root.printJob.name : ""; // Supress QML warnings
+ font: UM.Theme.getFont("default_bold");
+ elide: Text.ElideRight;
+ anchors.fill: parent;
+ }
+ }
+
+ Item {
+ id: printJobOwnerName;
+
+ width: parent.width;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ anchors {
+ top: printJobName.bottom;
+ topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2);
+ }
+
+ Rectangle {
+ visible: !root.printJob;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ height: parent.height;
+ width: parent.width / 2;
+ }
+ Label {
+ visible: root.printJob;
+ text: root.printJob ? root.printJob.owner : ""; // Supress QML warnings
+ font: UM.Theme.getFont("default");
+ elide: Text.ElideRight;
+ anchors.fill: parent;
+ }
+ }
+
+ Item {
+ id: printJobPreview;
+ property var useUltibot: false;
+ anchors {
+ top: printJobOwnerName.bottom;
+ horizontalCenter: parent.horizontalCenter;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ bottom: parent.bottom;
+ }
+ width: height;
+
+ // Skeleton
+ Rectangle {
+ visible: !root.printJob;
+ anchors.fill: parent;
+ radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ }
+
+ // Actual content
+ Image {
+ id: previewImage;
+ visible: root.printJob;
+ source: root.printJob.previewImageUrl;
+ opacity: root.printJob.state == "error" ? 0.5 : 1.0;
+ anchors.fill: parent;
+ }
+
+ UM.RecolorImage {
+ id: ultiBotImage;
+ anchors.centerIn: printJobPreview;
+ source: "../svg/ultibot.svg";
+ /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
+ not in order to determine if we show the placeholder (ultibot) image instead. */
+ visible: root.printJob && previewImage.status == Image.Error;
+ width: printJobPreview.width;
+ height: printJobPreview.height;
+ sourceSize.width: width;
+ sourceSize.height: height;
+ color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
+ }
+
+ UM.RecolorImage {
+ id: statusImage;
+ anchors.centerIn: printJobPreview;
+ source: printJob.state == "error" ? "../svg/aborted-icon.svg" : "";
+ visible: source != "";
+ width: 0.5 * printJobPreview.width;
+ height: 0.5 * printJobPreview.height;
+ sourceSize.width: width;
+ sourceSize.height: height;
+ color: "black";
+ }
+ }
}
+ // Divider
Rectangle {
height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
- width: 1
- color: "black";
+ width: UM.Theme.getSize("default_lining").width;
+ color: !root.printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
anchors {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
@@ -82,80 +186,309 @@ Item {
right: parent.right;
top: parent.top;
bottom: parent.bottom;
- margins: UM.Theme.getSize("wide_margin").width
+ margins: UM.Theme.getSize("wide_margin").width;
}
- }
- }
- // Config change toggle
- Rectangle {
- color: root.debug ? "orange" : "transparent";
- width: parent.width;
- visible: root.hasChanges;
- height: visible ? 40 : 0;
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- configChangeDetails.visible = !configChangeDetails.visible;
- }
- }
- Label {
- id: configChangeToggleLabel;
- anchors {
- horizontalCenter: parent.horizontalCenter;
- verticalCenter: parent.verticalCenter;
- }
- text: "Configuration change";
- }
- UM.RecolorImage {
- width: 15;
- height: 15;
- anchors {
- left: configChangeToggleLabel.right;
- leftMargin: UM.Theme.getSize("default_margin").width;
- verticalCenter: parent.verticalCenter;
- }
- sourceSize.width: width;
- sourceSize.height: height;
- source: {
- if (configChangeDetails.visible) {
- return UM.Theme.getIcon("arrow_top");
- } else {
- return UM.Theme.getIcon("arrow_bottom");
+ Item {
+ id: targetPrinterLabel;
+
+ width: parent.width;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+
+ Rectangle {
+ visible: !root.printJob;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ anchors.fill: parent;
+ }
+ Label {
+ visible: root.printJob;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default_bold");
+ text: {
+ if (root.printJob.assignedPrinter == null) {
+ if (root.printJob.state == "error") {
+ return catalog.i18nc("@label", "Waiting for: Unavailable printer");
+ }
+ return catalog.i18nc("@label", "Waiting for: First available");
+ } else {
+ return catalog.i18nc("@label", "Waiting for: ") + root.printJob.assignedPrinter.name;
+ }
+ }
+ }
+ }
+
+ // Printer family pills
+ Row {
+ id: printerFamilyPills;
+ visible: root.printJob;
+ spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ bottom: extrudersInfo.top;
+ bottomMargin: UM.Theme.getSize("default_margin").height;
+ }
+ height: childrenRect.height;
+ Repeater {
+ model: printJob.compatibleMachineFamilies;
+ delegate: PrinterFamilyPill {
+ text: modelData;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ padding: 3 * screenScaleFactor; // TODO: Theme!
+ }
+ }
+ }
+
+ // Print core & material config
+ Row {
+ id: extrudersInfo;
+ anchors {
+ bottom: parent.bottom;
+ left: parent.left;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ }
+ height: childrenRect.height;
+ spacing: UM.Theme.getSize("default_margin").width;
+ PrintCoreConfiguration {
+ id: leftExtruderInfo;
+ width: Math.round(parent.width / 2) * screenScaleFactor;
+ printCoreConfiguration: root.printJob !== null ? printJob.configuration.extruderConfigurations[0] : null;
+ }
+ PrintCoreConfiguration {
+ id: rightExtruderInfo;
+ width: Math.round(parent.width / 2) * screenScaleFactor;
+ printCoreConfiguration: root.printJob !== null ? printJob.configuration.extruderConfigurations[1] : null;
}
}
- color: "black";
}
}
- // Config change details
Rectangle {
- id: configChangeDetails
- color: root.debug ? "yellow" : "transparent";
+ id: configChangesBox;
width: parent.width;
- visible: false;
- height: visible ? 150 : 0;
- Behavior on height { NumberAnimation { duration: 100 } }
+ height: childrenRect.height;
+ visible: root.printJob && root.printJob.configurationChanges.length !== 0;
+ // Config change toggle
Rectangle {
- color: root.debug ? "lime" : "transparent";
+ id: configChangeToggle;
+ color: {
+ if(configChangeToggleArea.containsMouse) {
+ return UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ } else {
+ return "transparent";
+ }
+ }
+ width: parent.width;
+ height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme!
anchors {
- fill: parent;
- topMargin: UM.Theme.getSize("wide_margin").height;
- bottomMargin: UM.Theme.getSize("wide_margin").height;
- leftMargin: UM.Theme.getSize("wide_margin").height * 4;
- rightMargin: UM.Theme.getSize("wide_margin").height * 4;
+ left: parent.left;
+ right: parent.right;
+ top: parent.top;
}
+
+ Rectangle {
+ width: parent.width;
+ height: UM.Theme.getSize("default_lining").height;
+ color: "#e6e6e6"; // TODO: Theme!
+ }
+
+ UM.RecolorImage {
+ width: 23; // TODO: Theme!
+ height: 23; // TODO: Theme!
+ anchors {
+ right: configChangeToggleLabel.left;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ sourceSize.width: width;
+ sourceSize.height: height;
+ source: "../svg/warning-icon.svg";
+ color: UM.Theme.getColor("text");
+ }
+
Label {
- wrapMode: Text.WordWrap;
- text: "The assigned printer, UltiSandra, requires the following configuration change(s): Change material 1 from PLA to ABS.";
+ id: configChangeToggleLabel;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ text: "Configuration change"; // TODO: i18n!
}
+
+ UM.RecolorImage {
+ width: 15; // TODO: Theme!
+ height: 15; // TODO: Theme!
+ anchors {
+ left: configChangeToggleLabel.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ sourceSize.width: width;
+ sourceSize.height: height;
+ source: {
+ if (configChangeDetails.visible) {
+ return UM.Theme.getIcon("arrow_top");
+ } else {
+ return UM.Theme.getIcon("arrow_bottom");
+ }
+ }
+ color: UM.Theme.getColor("text");
+ }
+
+ MouseArea {
+ id: configChangeToggleArea;
+ anchors.fill: parent;
+ hoverEnabled: true;
+ onClicked: {
+ configChangeDetails.visible = !configChangeDetails.visible;
+ }
+ }
+ }
+
+ // Config change details
+ Rectangle {
+ id: configChangeDetails;
+ color: "transparent";
+ width: parent.width;
+ visible: false;
+ // In case of really massive multi-line configuration changes
+ height: visible ? Math.max(UM.Theme.getSize("monitor_tab_config_override_box").height, childrenRect.height) : 0;
+ Behavior on height { NumberAnimation { duration: 100 } }
+ anchors.top: configChangeToggle.bottom;
+
+ Rectangle {
+ color: "transparent";
+ clip: true;
+ anchors {
+ fill: parent;
+ topMargin: UM.Theme.getSize("wide_margin").height;
+ bottomMargin: UM.Theme.getSize("wide_margin").height;
+ leftMargin: UM.Theme.getSize("wide_margin").height * 4;
+ rightMargin: UM.Theme.getSize("wide_margin").height * 4;
+ }
+
+ Label {
+ anchors.fill: parent;
+ wrapMode: Text.WordWrap;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("large_nonbold");
+ text: {
+ if (root.printJob.configurationChanges.length === 0) {
+ return "";
+ }
+ var topLine;
+ if (materialsAreKnown(root.printJob)) {
+ topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(root.printJob.assignedPrinter.name);
+ } else {
+ topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(root.printJob.assignedPrinter.name);
+ }
+ var result = "" + topLine +"
";
+ for (var i = 0; i < root.printJob.configurationChanges.length; i++) {
+ var change = root.printJob.configurationChanges[i];
+ var text;
+ switch (change.typeOfChange) {
+ case "material_change":
+ text = catalog.i18nc("@label", "Change material %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName);
+ break;
+ case "material_insert":
+ text = catalog.i18nc("@label", "Load %3 as material %1 (This cannot be overridden).").arg(change.index + 1).arg(change.targetName);
+ break;
+ case "print_core_change":
+ text = catalog.i18nc("@label", "Change print core %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName);
+ break;
+ case "buildplate_change":
+ text = catalog.i18nc("@label", "Change build plate to %1 (This cannot be overridden).").arg(formatBuildPlateType(change.target_name));
+ break;
+ default:
+ text = "";
+ }
+ result += "" + text + "
";
+ }
+ return result;
+ }
+ }
+
+ Button {
+ anchors {
+ bottom: parent.bottom;
+ left: parent.left;
+ }
+ visible: {
+ var length = root.printJob.configurationChanges.length;
+ for (var i = 0; i < length; i++) {
+ var typeOfChange = root.printJob.configurationChanges[i].typeOfChange;
+ if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
+ return false;
+ }
+ }
+ return true;
+ }
+ text: catalog.i18nc("@label", "Override");
+ onClicked: {
+ overrideConfirmationDialog.visible = true;
+ }
+ }
+ }
+ }
+
+ MessageDialog {
+ id: overrideConfirmationDialog;
+ title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
+ icon: StandardIcon.Warning;
+ text: {
+ var printJobName = formatPrintJobName(root.printJob.name);
+ var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
+ return confirmText;
+ }
+ standardButtons: StandardButton.Yes | StandardButton.No;
+ Component.onCompleted: visible = false;
+ onYes: OutputDevice.forceSendJob(root.printJob.key);
}
}
}
}
+ // Utils
+ function formatPrintJobName(name) {
+ var extensions = [ ".gz", ".gcode", ".ufp" ];
+ for (var i = 0; i < extensions.length; i++) {
+ var extension = extensions[i];
+ if (name.slice(-extension.length) === extension) {
+ name = name.substring(0, name.length - extension.length);
+ }
+ }
+ return name;
+ }
+ function materialsAreKnown(job) {
+ var conf0 = job.configuration[0];
+ if (conf0 && !conf0.material.material) {
+ return false;
+ }
+ var conf1 = job.configuration[1];
+ if (conf1 && !conf1.material.material) {
+ return false;
+ }
+ return true;
+ }
+ function formatBuildPlateType(buildPlateType) {
+ var translationText = "";
+ switch (buildPlateType) {
+ case "glass":
+ translationText = catalog.i18nc("@label", "Glass");
+ break;
+ case "aluminum":
+ translationText = catalog.i18nc("@label", "Aluminum");
+ break;
+ default:
+ translationText = null;
+ }
+ return translationText;
+ }
}
+
+
// Item
// {
// id: base
@@ -458,7 +791,7 @@ Item {
// contentItem: Label
// {
// text: contextButton.text
-// color: UM.Theme.getColor("monitor_text_inactive")
+// color: UM.Theme.getColor("monitor_tab_text_inactive")
// font.pixelSize: 25
// verticalAlignment: Text.AlignVCenter
// horizontalAlignment: Text.AlignHCenter
diff --git a/plugins/UM3NetworkPrinting/resources/svg/ultibot.svg b/plugins/UM3NetworkPrinting/resources/svg/ultibot.svg
new file mode 100644
index 0000000000..be6ca64723
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/svg/ultibot.svg
@@ -0,0 +1 @@
+logobot-placeholder
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/svg/warning-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/warning-icon.svg
index 1e5359a5eb..064d0783e0 100644
--- a/plugins/UM3NetworkPrinting/resources/svg/warning-icon.svg
+++ b/plugins/UM3NetworkPrinting/resources/svg/warning-icon.svg
@@ -1 +1,4 @@
-warning-icon
\ No newline at end of file
+
+ warning-icon
+
+
\ No newline at end of file
diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json
index 43d892c34c..390f0ba995 100644
--- a/resources/themes/cura-light/theme.json
+++ b/resources/themes/cura-light/theme.json
@@ -323,10 +323,12 @@
"favorites_header_text_hover": [31, 36, 39, 255],
"favorites_row_selected": [196, 239, 255, 255],
- "monitor_text_inactive": [154, 154, 154, 255],
- "monitor_background_inactive": [240, 240, 240, 255],
- "monitor_background_active": [255, 255, 255, 255],
- "monitor_lining_inactive": [230, 230, 230, 255]
+ "monitor_tab_background_active": [255, 255, 255, 255],
+ "monitor_tab_background_inactive": [240, 240, 240, 255],
+ "monitor_tab_lining_active": [0, 0, 0, 255],
+ "monitor_tab_lining_inactive": [230, 230, 230, 255],
+ "monitor_tab_placeholder_image": [230, 230, 230, 255],
+ "monitor_tab_text_inactive": [154, 154, 154, 255]
},
"sizes": {
@@ -476,6 +478,9 @@
"toolbox_action_button": [8.0, 2.5],
"toolbox_loader": [2.0, 2.0],
- "drop_shadow_radius": [1.0, 1.0]
+ "monitor_tab_config_override_box": [1.0, 14.0],
+ "monitor_tab_extruder_circle": [2.75, 2.75],
+ "monitor_tab_text_line": [1.16, 1.16],
+ "monitor_tab_thick_lining": [0.16, 0.16]
}
}
From fc333d53c5b77633a9a303054c4453f476b0bbac Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Thu, 27 Sep 2018 14:54:40 +0200
Subject: [PATCH 08/31] Replaced print job context menu
Contributes to CL-897, CL-1051
---
.../resources/qml/PrintCoreConfiguration.qml | 6 +-
.../resources/qml/PrintJobContextMenu.qml | 199 +++++
.../resources/qml/PrintJobInfoBlock.qml | 744 ++----------------
3 files changed, 253 insertions(+), 696 deletions(-)
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index ca39d2663d..289b3f3f00 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -21,7 +21,7 @@ Item {
// Loading skeleton
Rectangle {
- visible: !extruderInfo.printCoreConfiguration;
+ visible: !printCoreConfiguration;
anchors.fill: parent;
radius: Math.round(width / 2);
color: UM.Theme.getColor("viewport_background");
@@ -29,7 +29,7 @@ Item {
// Actual content
Rectangle {
- visible: extruderInfo.printCoreConfiguration;
+ visible: printCoreConfiguration;
anchors.fill: parent;
radius: Math.round(width / 2);
border.width: UM.Theme.getSize("monitor_tab_thick_lining").width;
@@ -44,7 +44,7 @@ Item {
Label {
anchors.centerIn: parent;
font: UM.Theme.getFont("default_bold");
- text: printCoreConfiguration.position + 1;
+ text: printCoreConfiguration ? printCoreConfiguration.position + 1 : 0;
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
new file mode 100644
index 0000000000..74c4bb030c
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -0,0 +1,199 @@
+import QtQuick 2.2
+import QtQuick.Dialogs 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.4
+import QtGraphicalEffects 1.0
+import QtQuick.Layouts 1.1
+import QtQuick.Dialogs 1.1
+import UM 1.3 as UM
+
+Item {
+ id: root;
+ property var printJob: null;
+
+ Button {
+ id: button;
+ background: Rectangle {
+ color: UM.Theme.getColor("viewport_background");
+ height: button.height;
+ opacity: button.down || button.hovered ? 1 : 0;
+ radius: 0.5 * width;
+ width: button.width;
+ }
+ contentItem: Label {
+ color: UM.Theme.getColor("monitor_tab_text_inactive");
+ font.pixelSize: 25;
+ horizontalAlignment: Text.AlignHCenter;
+ text: button.text;
+ verticalAlignment: Text.AlignVCenter;
+ }
+ height: width;
+ hoverEnabled: true;
+ onClicked: parent.switchPopupState();
+ text: "\u22EE"; //Unicode; Three stacked points.
+ width: 35;
+ }
+
+ Popup {
+ id: popup;
+ clip: true;
+ closePolicy: Popup.CloseOnPressOutside;
+ height: contentItem.height + 2 * padding;
+ padding: 5 * screenScaleFactor; // Because shadow
+ transformOrigin: Popup.Top;
+ visible: false;
+ width: 182 * screenScaleFactor;
+ x: (button.width - width) + 26 * screenScaleFactor;
+ y: button.height + 5 * screenScaleFactor; // Because shadow
+ contentItem: Item {
+ width: popup.width
+ height: childrenRect.height + 36 * screenScaleFactor
+ anchors.topMargin: 10 * screenScaleFactor
+ anchors.bottomMargin: 10 * screenScaleFactor
+ Button {
+ id: sendToTopButton
+ text: catalog.i18nc("@label", "Move to top")
+ onClicked:
+ {
+ sendToTopConfirmationDialog.visible = true;
+ popup.close();
+ }
+ width: parent.width
+ enabled: printJob ? OutputDevice.queuedPrintJobs[0].key != printJob.key : false;
+ visible: enabled
+ anchors.top: parent.top
+ anchors.topMargin: 18 * screenScaleFactor
+ height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
+ hoverEnabled: true
+ background: Rectangle
+ {
+ opacity: sendToTopButton.down || sendToTopButton.hovered ? 1 : 0
+ color: UM.Theme.getColor("viewport_background")
+ }
+ contentItem: Label
+ {
+ text: sendToTopButton.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ MessageDialog
+ {
+ id: sendToTopConfirmationDialog
+ title: catalog.i18nc("@window:title", "Move print job to top")
+ icon: StandardIcon.Warning
+ text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
+ standardButtons: StandardButton.Yes | StandardButton.No
+ Component.onCompleted: visible = false
+ onYes: {
+ if (printJob) {
+ OutputDevice.sendJobToTop(printJob.key)
+ }
+ }
+ }
+
+ Button
+ {
+ id: deleteButton
+ text: catalog.i18nc("@label", "Delete")
+ onClicked:
+ {
+ deleteConfirmationDialog.visible = true;
+ popup.close();
+ }
+ width: parent.width
+ height: 39 * screenScaleFactor
+ anchors.top: sendToTopButton.bottom
+ hoverEnabled: true
+ background: Rectangle
+ {
+ opacity: deleteButton.down || deleteButton.hovered ? 1 : 0
+ color: UM.Theme.getColor("viewport_background")
+ }
+ contentItem: Label
+ {
+ text: deleteButton.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ MessageDialog
+ {
+ id: deleteConfirmationDialog
+ title: catalog.i18nc("@window:title", "Delete print job")
+ icon: StandardIcon.Warning
+ text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
+ standardButtons: StandardButton.Yes | StandardButton.No
+ Component.onCompleted: visible = false
+ onYes: OutputDevice.deleteJobFromQueue(printJob.key)
+ }
+ }
+
+ background: Item
+ {
+ width: popup.width
+ height: popup.height
+
+ DropShadow
+ {
+ anchors.fill: pointedRectangle
+ radius: 5
+ color: "#3F000000" // 25% shadow
+ source: pointedRectangle
+ transparentBorder: true
+ verticalOffset: 2
+ }
+
+ Item
+ {
+ id: pointedRectangle
+ width: parent.width - 10 * screenScaleFactor // Because of the shadow
+ height: parent.height - 10 * screenScaleFactor // Because of the shadow
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+
+ Rectangle
+ {
+ id: point
+ height: 14 * screenScaleFactor
+ width: 14 * screenScaleFactor
+ color: UM.Theme.getColor("setting_control")
+ transform: Rotation { angle: 45}
+ anchors.right: bloop.right
+ anchors.rightMargin: 24
+ y: 1
+ }
+
+ Rectangle
+ {
+ id: bloop
+ color: UM.Theme.getColor("setting_control")
+ width: parent.width
+ anchors.top: parent.top
+ anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
+ }
+ }
+ }
+
+ exit: Transition
+ {
+ NumberAnimation { property: "visible"; duration: 75; }
+ }
+ enter: Transition
+ {
+ NumberAnimation { property: "visible"; duration: 75; }
+ }
+
+ onClosed: visible = false
+ onOpened: visible = true
+ }
+
+ // Utils
+ function switchPopupState() {
+ popup.visible ? popup.close() : popup.open()
+ }
+}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index cb6b0fb4df..89fb8a2391 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -72,14 +72,14 @@ Item {
height: UM.Theme.getSize("monitor_tab_text_line").height;
Rectangle {
- visible: !root.printJob;
+ visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: parent.height;
width: parent.width / 3;
}
Label {
- visible: root.printJob;
- text: root.printJob ? root.printJob.name : ""; // Supress QML warnings
+ visible: printJob;
+ text: printJob ? printJob.name : ""; // Supress QML warnings
font: UM.Theme.getFont("default_bold");
elide: Text.ElideRight;
anchors.fill: parent;
@@ -97,14 +97,14 @@ Item {
}
Rectangle {
- visible: !root.printJob;
+ visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: parent.height;
width: parent.width / 2;
}
Label {
- visible: root.printJob;
- text: root.printJob ? root.printJob.owner : ""; // Supress QML warnings
+ visible: printJob;
+ text: printJob ? printJob.owner : ""; // Supress QML warnings
font: UM.Theme.getFont("default");
elide: Text.ElideRight;
anchors.fill: parent;
@@ -124,7 +124,7 @@ Item {
// Skeleton
Rectangle {
- visible: !root.printJob;
+ visible: !printJob;
anchors.fill: parent;
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
@@ -133,9 +133,9 @@ Item {
// Actual content
Image {
id: previewImage;
- visible: root.printJob;
- source: root.printJob.previewImageUrl;
- opacity: root.printJob.state == "error" ? 0.5 : 1.0;
+ visible: printJob;
+ source: printJob ? printJob.previewImageUrl : "";
+ opacity: printJob && printJob.state == "error" ? 0.5 : 1.0;
anchors.fill: parent;
}
@@ -145,7 +145,7 @@ Item {
source: "../svg/ultibot.svg";
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */
- visible: root.printJob && previewImage.status == Image.Error;
+ visible: printJob && previewImage.status == Image.Error;
width: printJobPreview.width;
height: printJobPreview.height;
sourceSize.width: width;
@@ -156,7 +156,7 @@ Item {
UM.RecolorImage {
id: statusImage;
anchors.centerIn: printJobPreview;
- source: printJob.state == "error" ? "../svg/aborted-icon.svg" : "";
+ source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : "";
visible: source != "";
width: 0.5 * printJobPreview.width;
height: 0.5 * printJobPreview.height;
@@ -171,7 +171,7 @@ Item {
Rectangle {
height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
width: UM.Theme.getSize("default_lining").width;
- color: !root.printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
+ color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
anchors {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
@@ -191,28 +191,29 @@ Item {
Item {
id: targetPrinterLabel;
-
width: parent.width;
height: UM.Theme.getSize("monitor_tab_text_line").height;
-
Rectangle {
- visible: !root.printJob;
+ visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
anchors.fill: parent;
}
Label {
- visible: root.printJob;
+ visible: printJob;
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: {
- if (root.printJob.assignedPrinter == null) {
- if (root.printJob.state == "error") {
- return catalog.i18nc("@label", "Waiting for: Unavailable printer");
+ if (printJob) {
+ if (printJob.assignedPrinter == null) {
+ if (printJob.state == "error") {
+ return catalog.i18nc("@label", "Waiting for: Unavailable printer");
+ }
+ return catalog.i18nc("@label", "Waiting for: First available");
+ } else {
+ return catalog.i18nc("@label", "Waiting for: ") + printJob.assignedPrinter.name;
}
- return catalog.i18nc("@label", "Waiting for: First available");
- } else {
- return catalog.i18nc("@label", "Waiting for: ") + root.printJob.assignedPrinter.name;
}
+ return "";
}
}
}
@@ -220,7 +221,7 @@ Item {
// Printer family pills
Row {
id: printerFamilyPills;
- visible: root.printJob;
+ visible: printJob;
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
anchors {
left: parent.left;
@@ -230,7 +231,7 @@ Item {
}
height: childrenRect.height;
Repeater {
- model: printJob.compatibleMachineFamilies;
+ model: printJob ? printJob.compatibleMachineFamilies : [];
delegate: PrinterFamilyPill {
text: modelData;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
@@ -253,22 +254,34 @@ Item {
PrintCoreConfiguration {
id: leftExtruderInfo;
width: Math.round(parent.width / 2) * screenScaleFactor;
- printCoreConfiguration: root.printJob !== null ? printJob.configuration.extruderConfigurations[0] : null;
+ printCoreConfiguration: printJob !== null ? printJob.configuration.extruderConfigurations[0] : null;
}
PrintCoreConfiguration {
id: rightExtruderInfo;
width: Math.round(parent.width / 2) * screenScaleFactor;
- printCoreConfiguration: root.printJob !== null ? printJob.configuration.extruderConfigurations[1] : null;
+ printCoreConfiguration: printJob !== null ? printJob.configuration.extruderConfigurations[1] : null;
}
}
}
+
+ PrintJobContextMenu {
+ id: contextButton;
+ anchors {
+ right: mainContent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width * 3 + root.shadowRadius;
+ top: mainContent.top;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ }
+ printJob: root.printJob;
+ visible: root.printJob;
+ }
}
Rectangle {
id: configChangesBox;
width: parent.width;
height: childrenRect.height;
- visible: root.printJob && root.printJob.configurationChanges.length !== 0;
+ visible: printJob && printJob.configurationChanges.length !== 0;
// Config change toggle
Rectangle {
@@ -375,18 +388,18 @@ Item {
elide: Text.ElideRight;
font: UM.Theme.getFont("large_nonbold");
text: {
- if (root.printJob.configurationChanges.length === 0) {
+ if (!printJob || printJob.configurationChanges.length === 0) {
return "";
}
var topLine;
- if (materialsAreKnown(root.printJob)) {
- topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(root.printJob.assignedPrinter.name);
+ if (materialsAreKnown(printJob)) {
+ topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printJob.assignedPrinter.name);
} else {
- topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(root.printJob.assignedPrinter.name);
+ topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printJob.assignedPrinter.name);
}
var result = "" + topLine +"
";
- for (var i = 0; i < root.printJob.configurationChanges.length; i++) {
- var change = root.printJob.configurationChanges[i];
+ for (var i = 0; i < printJob.configurationChanges.length; i++) {
+ var change = printJob.configurationChanges[i];
var text;
switch (change.typeOfChange) {
case "material_change":
@@ -416,9 +429,9 @@ Item {
left: parent.left;
}
visible: {
- var length = root.printJob.configurationChanges.length;
+ var length = printJob.configurationChanges.length;
for (var i = 0; i < length; i++) {
- var typeOfChange = root.printJob.configurationChanges[i].typeOfChange;
+ var typeOfChange = printJob.configurationChanges[i].typeOfChange;
if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
return false;
}
@@ -438,13 +451,13 @@ Item {
title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
icon: StandardIcon.Warning;
text: {
- var printJobName = formatPrintJobName(root.printJob.name);
+ var printJobName = formatPrintJobName(printJob.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText;
}
standardButtons: StandardButton.Yes | StandardButton.No;
Component.onCompleted: visible = false;
- onYes: OutputDevice.forceSendJob(root.printJob.key);
+ onYes: OutputDevice.forceSendJob(printJob.key);
}
}
}
@@ -486,658 +499,3 @@ Item {
return translationText;
}
}
-
-
-
-// Item
-// {
-// id: base
-
-// function haveAlert() {
-// return printJob.configurationChanges.length !== 0;
-// }
-
-// function alertHeight() {
-// return haveAlert() ? 230 : 0;
-// }
-
-// function alertText() {
-// if (printJob.configurationChanges.length === 0) {
-// return "";
-// }
-
-// var topLine;
-// if (materialsAreKnown(printJob)) {
-// topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(printJob.assignedPrinter.name);
-// } else {
-// topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printJob.assignedPrinter.name);
-// }
-// var result = "" + topLine +"
";
-
-// for (var i=0; i" + text + " ";
-// }
-// return result;
-// }
-
-// function materialsAreKnown(printJob) {
-// var conf0 = printJob.configuration[0];
-// if (conf0 && !conf0.material.material) {
-// return false;
-// }
-
-// var conf1 = printJob.configuration[1];
-// if (conf1 && !conf1.material.material) {
-// return false;
-// }
-
-// return true;
-// }
-
-// function formatBuildPlateType(buildPlateType) {
-// var translationText = "";
-
-// switch (buildPlateType) {
-// case 'glass':
-// translationText = catalog.i18nc("@label", "Glass");
-// break;
-// case 'aluminum':
-// translationText = catalog.i18nc("@label", "Aluminum");
-// break;
-// default:
-// translationText = null;
-// }
-// return translationText;
-// }
-
-// function formatPrintJobName(name) {
-// var extensionsToRemove = [
-// '.gz',
-// '.gcode',
-// '.ufp'
-// ];
-
-// for (var i = 0; i < extensionsToRemove.length; i++) {
-// var extension = extensionsToRemove[i];
-
-// if (name.slice(-extension.length) === extension) {
-// name = name.substring(0, name.length - extension.length);
-// }
-// }
-
-// return name;
-// }
-
-// function isPrintJobForcable(printJob) {
-// var forcable = true;
-
-// for (var i = 0; i < printJob.configurationChanges.length; i++) {
-// var typeOfChange = printJob.configurationChanges[i].typeOfChange;
-// if (typeOfChange === 'material_insert' || typeOfChange === 'buildplate_change') {
-// forcable = false;
-// }
-// }
-
-// return forcable;
-// }
-
-// property var cardHeight: 175
-
-// height: (cardHeight + alertHeight()) * screenScaleFactor
-// property var printJob: null
-// property var shadowRadius: 5 * screenScaleFactor
-// function getPrettyTime(time)
-// {
-// return OutputDevice.formatDuration(time)
-// }
-
-// width: parent.width
-
-// UM.I18nCatalog
-// {
-// id: catalog
-// name: "cura"
-// }
-
-// Rectangle
-// {
-// id: background
-
-// height: (cardHeight + alertHeight()) * screenScaleFactor
-
-// anchors
-// {
-// top: parent.top
-// topMargin: 3 * screenScaleFactor
-// left: parent.left
-// leftMargin: base.shadowRadius
-// rightMargin: base.shadowRadius
-// right: parent.right
-// //bottom: parent.bottom - alertHeight() * screenScaleFactor
-// bottomMargin: base.shadowRadius
-// }
-
-// layer.enabled: true
-// layer.effect: DropShadow
-// {
-// radius: base.shadowRadius
-// verticalOffset: 2 * screenScaleFactor
-// color: "#3F000000" // 25% shadow
-// }
-
-// Rectangle
-// {
-// height: cardHeight * screenScaleFactor
-
-// anchors
-// {
-// top: parent.top
-// left: parent.left
-// right: parent.right
-// // bottom: parent.bottom
-// }
-
-// Item
-// {
-// // Content on the left of the infobox
-// anchors
-// {
-// top: parent.top
-// bottom: parent.bottom
-// left: parent.left
-// right: parent.horizontalCenter
-// margins: UM.Theme.getSize("wide_margin").width
-// rightMargin: UM.Theme.getSize("default_margin").width
-// }
-
-// Label
-// {
-// id: printJobName
-// text: printJob.name
-// font: UM.Theme.getFont("default_bold")
-// width: parent.width
-// elide: Text.ElideRight
-// }
-
-// Label
-// {
-// id: ownerName
-// anchors.top: printJobName.bottom
-// text: printJob.owner
-// font: UM.Theme.getFont("default")
-// opacity: 0.6
-// width: parent.width
-// elide: Text.ElideRight
-// }
-
-// Image
-// {
-// id: printJobPreview
-// source: printJob.previewImageUrl
-// anchors.top: ownerName.bottom
-// anchors.horizontalCenter: parent.horizontalCenter
-// anchors.bottom: totalTimeLabel.bottom
-// width: height
-// opacity: printJob.state == "error" ? 0.5 : 1.0
-// }
-
-// UM.RecolorImage
-// {
-// id: statusImage
-// anchors.centerIn: printJobPreview
-// source: printJob.state == "error" ? "../svg/aborted-icon.svg" : ""
-// visible: source != ""
-// width: 0.5 * printJobPreview.width
-// height: 0.5 * printJobPreview.height
-// sourceSize.width: width
-// sourceSize.height: height
-// color: "black"
-// }
-
-// Label
-// {
-// id: totalTimeLabel
-// anchors.bottom: parent.bottom
-// anchors.right: parent.right
-// font: UM.Theme.getFont("default")
-// text: printJob != null ? getPrettyTime(printJob.timeTotal) : ""
-// elide: Text.ElideRight
-// }
-// }
-
-// Item
-// {
-// // Content on the right side of the infobox.
-// anchors
-// {
-// top: parent.top
-// bottom: parent.bottom
-// left: parent.horizontalCenter
-// right: parent.right
-// margins: 2 * UM.Theme.getSize("default_margin").width
-// leftMargin: UM.Theme.getSize("default_margin").width
-// rightMargin: UM.Theme.getSize("default_margin").width / 2
-// }
-
-// Label
-// {
-// id: targetPrinterLabel
-// elide: Text.ElideRight
-// font: UM.Theme.getFont("default_bold")
-// text:
-// {
-// if(printJob.assignedPrinter == null)
-// {
-// if(printJob.state == "error")
-// {
-// return catalog.i18nc("@label", "Waiting for: Unavailable printer")
-// }
-// return catalog.i18nc("@label", "Waiting for: First available")
-// }
-// else
-// {
-// return catalog.i18nc("@label", "Waiting for: ") + printJob.assignedPrinter.name
-// }
-
-// }
-
-// anchors
-// {
-// left: parent.left
-// right: contextButton.left
-// rightMargin: UM.Theme.getSize("default_margin").width
-// }
-// }
-
-
-// function switchPopupState()
-// {
-// popup.visible ? popup.close() : popup.open()
-// }
-
-// Button
-// {
-// id: contextButton
-// text: "\u22EE" //Unicode; Three stacked points.
-// width: 35
-// height: width
-// anchors
-// {
-// right: parent.right
-// top: parent.top
-// }
-// hoverEnabled: true
-
-// background: Rectangle
-// {
-// opacity: contextButton.down || contextButton.hovered ? 1 : 0
-// width: contextButton.width
-// height: contextButton.height
-// radius: 0.5 * width
-// color: UM.Theme.getColor("viewport_background")
-// }
-// contentItem: Label
-// {
-// text: contextButton.text
-// color: UM.Theme.getColor("monitor_tab_text_inactive")
-// font.pixelSize: 25
-// verticalAlignment: Text.AlignVCenter
-// horizontalAlignment: Text.AlignHCenter
-// }
-
-// onClicked: parent.switchPopupState()
-// }
-
-// Popup
-// {
-// // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
-// id: popup
-// clip: true
-// closePolicy: Popup.CloseOnPressOutside
-// x: (parent.width - width) + 26 * screenScaleFactor
-// y: contextButton.height - 5 * screenScaleFactor // Because shadow
-// width: 182 * screenScaleFactor
-// height: contentItem.height + 2 * padding
-// visible: false
-// padding: 5 * screenScaleFactor // Because shadow
-
-// transformOrigin: Popup.Top
-// contentItem: Item
-// {
-// width: popup.width
-// height: childrenRect.height + 36 * screenScaleFactor
-// anchors.topMargin: 10 * screenScaleFactor
-// anchors.bottomMargin: 10 * screenScaleFactor
-// Button
-// {
-// id: sendToTopButton
-// text: catalog.i18nc("@label", "Move to top")
-// onClicked:
-// {
-// sendToTopConfirmationDialog.visible = true;
-// popup.close();
-// }
-// width: parent.width
-// enabled: OutputDevice.queuedPrintJobs[0].key != printJob.key
-// visible: enabled
-// anchors.top: parent.top
-// anchors.topMargin: 18 * screenScaleFactor
-// height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
-// hoverEnabled: true
-// background: Rectangle
-// {
-// opacity: sendToTopButton.down || sendToTopButton.hovered ? 1 : 0
-// color: UM.Theme.getColor("viewport_background")
-// }
-// contentItem: Label
-// {
-// text: sendToTopButton.text
-// horizontalAlignment: Text.AlignLeft
-// verticalAlignment: Text.AlignVCenter
-// }
-// }
-
-// MessageDialog
-// {
-// id: sendToTopConfirmationDialog
-// title: catalog.i18nc("@window:title", "Move print job to top")
-// icon: StandardIcon.Warning
-// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name)
-// standardButtons: StandardButton.Yes | StandardButton.No
-// Component.onCompleted: visible = false
-// onYes: OutputDevice.sendJobToTop(printJob.key)
-// }
-
-// Button
-// {
-// id: deleteButton
-// text: catalog.i18nc("@label", "Delete")
-// onClicked:
-// {
-// deleteConfirmationDialog.visible = true;
-// popup.close();
-// }
-// width: parent.width
-// height: 39 * screenScaleFactor
-// anchors.top: sendToTopButton.bottom
-// hoverEnabled: true
-// background: Rectangle
-// {
-// opacity: deleteButton.down || deleteButton.hovered ? 1 : 0
-// color: UM.Theme.getColor("viewport_background")
-// }
-// contentItem: Label
-// {
-// text: deleteButton.text
-// horizontalAlignment: Text.AlignLeft
-// verticalAlignment: Text.AlignVCenter
-// }
-// }
-
-// MessageDialog
-// {
-// id: deleteConfirmationDialog
-// title: catalog.i18nc("@window:title", "Delete print job")
-// icon: StandardIcon.Warning
-// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name)
-// standardButtons: StandardButton.Yes | StandardButton.No
-// Component.onCompleted: visible = false
-// onYes: OutputDevice.deleteJobFromQueue(printJob.key)
-// }
-// }
-
-// background: Item
-// {
-// width: popup.width
-// height: popup.height
-
-// DropShadow
-// {
-// anchors.fill: pointedRectangle
-// radius: 5
-// color: "#3F000000" // 25% shadow
-// source: pointedRectangle
-// transparentBorder: true
-// verticalOffset: 2
-// }
-
-// Item
-// {
-// id: pointedRectangle
-// width: parent.width - 10 * screenScaleFactor // Because of the shadow
-// height: parent.height - 10 * screenScaleFactor // Because of the shadow
-// anchors.horizontalCenter: parent.horizontalCenter
-// anchors.verticalCenter: parent.verticalCenter
-
-// Rectangle
-// {
-// id: point
-// height: 14 * screenScaleFactor
-// width: 14 * screenScaleFactor
-// color: UM.Theme.getColor("setting_control")
-// transform: Rotation { angle: 45}
-// anchors.right: bloop.right
-// anchors.rightMargin: 24
-// y: 1
-// }
-
-// Rectangle
-// {
-// id: bloop
-// color: UM.Theme.getColor("setting_control")
-// width: parent.width
-// anchors.top: parent.top
-// anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
-// anchors.bottom: parent.bottom
-// anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
-// }
-// }
-// }
-
-// exit: Transition
-// {
-// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
-// NumberAnimation { property: "visible"; duration: 75; }
-// }
-// enter: Transition
-// {
-// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
-// NumberAnimation { property: "visible"; duration: 75; }
-// }
-
-// onClosed: visible = false
-// onOpened: visible = true
-// }
-
-// Row
-// {
-// id: printerFamilyPills
-// spacing: 0.5 * UM.Theme.getSize("default_margin").width
-// anchors
-// {
-// left: parent.left
-// right: parent.right
-// bottom: extrudersInfo.top
-// bottomMargin: UM.Theme.getSize("default_margin").height
-// }
-// height: childrenRect.height
-// Repeater
-// {
-// model: printJob.compatibleMachineFamilies
-
-// delegate: PrinterFamilyPill
-// {
-// text: modelData
-// color: UM.Theme.getColor("viewport_background")
-// padding: 3 * screenScaleFactor
-// }
-// }
-// }
-// // PrintCore && Material config
-// Row
-// {
-// id: extrudersInfo
-// anchors.bottom: parent.bottom
-
-// anchors
-// {
-// left: parent.left
-// right: parent.right
-// }
-// height: childrenRect.height
-
-// spacing: UM.Theme.getSize("default_margin").width
-
-// PrintCoreConfiguration
-// {
-// id: leftExtruderInfo
-// width: Math.round(parent.width / 2) * screenScaleFactor
-// printCoreConfiguration: printJob.configuration.extruderConfigurations[0]
-// }
-
-// PrintCoreConfiguration
-// {
-// id: rightExtruderInfo
-// width: Math.round(parent.width / 2) * screenScaleFactor
-// printCoreConfiguration: printJob.configuration.extruderConfigurations[1]
-// }
-// }
-
-// }
-// }
-// Rectangle
-// {
-// height: cardHeight * screenScaleFactor
-// color: UM.Theme.getColor("viewport_background")
-// width: 2 * screenScaleFactor
-// anchors.top: parent.top
-// anchors.margins: UM.Theme.getSize("default_margin").height
-// anchors.horizontalCenter: parent.horizontalCenter
-// }
-
-// // Alert / Configuration change box
-// Rectangle
-// {
-// height: alertHeight() * screenScaleFactor
-
-// anchors.left: parent.left
-// anchors.right: parent.right
-// anchors.bottom: parent.bottom
-
-// color: "#ff00ff"
-// ColumnLayout
-// {
-// anchors.fill: parent
-// RowLayout
-// {
-// Item
-// {
-// Layout.fillWidth: true
-// }
-
-// Label
-// {
-// font: UM.Theme.getFont("default_bold")
-// text: "Configuration change"
-// }
-
-// UM.RecolorImage
-// {
-// id: collapseIcon
-// width: 15
-// height: 15
-// sourceSize.width: width
-// sourceSize.height: height
-
-// // FIXME
-// source: base.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
-// color: "black"
-// }
-
-// Item
-// {
-// Layout.fillWidth: true
-// }
-
-// }
-
-// Rectangle
-// {
-// Layout.fillHeight: true
-// Layout.fillWidth: true
-// color: "red"
-
-// Rectangle
-// {
-// color: "green"
-// width: childrenRect.width
-
-// anchors.horizontalCenter: parent.horizontalCenter
-// anchors.top: parent.top
-// anchors.bottom: parent.bottom
-
-// ColumnLayout
-// {
-// width: childrenRect.width
-
-// anchors.top: parent.top
-// anchors.bottom: parent.bottom
-
-// Text
-// {
-// Layout.alignment: Qt.AlignTop
-
-// textFormat: Text.StyledText
-// font: UM.Theme.getFont("default_bold")
-// text: alertText()
-// }
-
-// Button
-// {
-// visible: isPrintJobForcable(printJob)
-// text: catalog.i18nc("@label", "Override")
-// onClicked: {
-// overrideConfirmationDialog.visible = true;
-// }
-// }
-
-// // Spacer
-// Item
-// {
-// Layout.fillHeight: true
-// }
-// }
-// }
-// }
-// }
-// }
-
-// MessageDialog
-// {
-// id: overrideConfirmationDialog
-// title: catalog.i18nc("@window:title", "Override configuration configuration and start print")
-// icon: StandardIcon.Warning
-// text: {
-// var printJobName = formatPrintJobName(printJob.name);
-// var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
-// return confirmText;
-// }
-
-// standardButtons: StandardButton.Yes | StandardButton.No
-// Component.onCompleted: visible = false
-// onYes: OutputDevice.forceSendJob(printJob.key)
-// }
-// }
-// }
\ No newline at end of file
From b5c893c08e34b0398ba4ab433d0f49ac07467d9d Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Fri, 28 Sep 2018 12:15:33 +0200
Subject: [PATCH 09/31] Rework printer cards
Contributes to CL-1051
---
.../resources/qml/ClusterControlItem.qml | 745 +-----------------
.../resources/qml/PrintJobInfoBlock.qml | 2 +-
.../resources/qml/PrinterCard.qml | 652 +++++++++++++++
.../resources/qml/PrinterCardProgressBar.qml | 119 +++
4 files changed, 807 insertions(+), 711 deletions(-)
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
index 774ab75f0d..bfde2ea7cd 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
@@ -66,12 +66,38 @@ Component
onExited: managePrintersLabel.font.underline = false
}
+ // Skeleton loading
+ Column
+ {
+ id: dummies
+ anchors
+ {
+ top: printingLabel.bottom
+ topMargin: UM.Theme.getSize("default_margin").height
+ left: parent.left
+ leftMargin: UM.Theme.getSize("wide_margin").width
+ right: parent.right
+ rightMargin: UM.Theme.getSize("wide_margin").width
+ }
+ spacing: UM.Theme.getSize("default_margin").height - 10
+
+ PrinterCard
+ {
+ printer: null
+ }
+ PrinterCard
+ {
+ printer: null
+ }
+ }
+
+ // Actual content
ScrollView
{
id: printerScrollView
anchors
{
- top: printingLabel.bottom
+ top: dummies.bottom
left: parent.left
right: parent.right
topMargin: UM.Theme.getSize("default_margin").height
@@ -83,720 +109,19 @@ Component
ListView
{
- id: printer_list
- property var current_index: -1
+ id: printerList
+ property var currentIndex: -1
anchors
{
- top: parent.top
- bottom: parent.bottom
- left: parent.left
- right: parent.right
- leftMargin: 2 * UM.Theme.getSize("default_margin").width
- rightMargin: 2 * UM.Theme.getSize("default_margin").width
+ fill: parent
+ leftMargin: UM.Theme.getSize("wide_margin").width
+ rightMargin: UM.Theme.getSize("wide_margin").width
}
- spacing: UM.Theme.getSize("default_margin").height -10
+ spacing: UM.Theme.getSize("default_margin").height - 10
model: OutputDevice.printers
-
- delegate: Item
+ delegate: PrinterCard
{
- width: parent.width
- height: base.height + 2 * base.shadowRadius // To ensure that the shadow doesn't get cut off.
- Rectangle
- {
- width: parent.width - 2 * shadowRadius
- height: childrenRect.height + UM.Theme.getSize("default_margin").height
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- color:
- {
- if(modelData.state == "disabled")
- {
- return UM.Theme.getColor("monitor_tab_background_inactive")
- }
- else
- {
- return UM.Theme.getColor("monitor_tab_background_active")
- }
- }
- id: base
- property var shadowRadius: 5 * screenScaleFactor
- property var collapsed: true
-
- layer.enabled: true
- layer.effect: DropShadow
- {
- radius: 5 * screenScaleFactor
- verticalOffset: 2
- color: "#3F000000" // 25% shadow
- }
-
- Connections
- {
- target: printer_list
- onCurrent_indexChanged: { base.collapsed = printer_list.current_index != model.index }
- }
-
- Item
- {
- id: printerInfo
- height: machineIcon.height
- anchors
- {
- top: parent.top
- left: parent.left
- right: parent.right
- margins: UM.Theme.getSize("default_margin").width
- }
-
- MouseArea
- {
- anchors.fill: parent
- onClicked:
- {
- if (base.collapsed) {
- printer_list.current_index = model.index
- }
- else
- {
- printer_list.current_index = -1
- }
- }
- }
-
- Item
- {
- id: machineIcon
- // Yeah, this is hardcoded now, but I can't think of a good way to fix this.
- // The UI is going to get another update soon, so it's probably not worth the effort...
- width: 58
- height: 58
- anchors.top: parent.top
- anchors.leftMargin: UM.Theme.getSize("default_margin").width
- anchors.left: parent.left
-
- UM.RecolorImage
- {
- anchors.centerIn: parent
- source:
- {
- switch(modelData.type)
- {
- case "Ultimaker 3":
- return "../svg/UM3-icon.svg"
- case "Ultimaker 3 Extended":
- return "../svg/UM3x-icon.svg"
- case "Ultimaker S5":
- return "../svg/UMs5-icon.svg"
- }
- }
- width: sourceSize.width
- height: sourceSize.height
-
- color:
- {
- if(modelData.state == "disabled")
- {
- return UM.Theme.getColor("monitor_tab_text_inactive")
- }
-
- if(modelData.activePrintJob != undefined)
- {
- return UM.Theme.getColor("primary")
- }
-
- return UM.Theme.getColor("monitor_tab_text_inactive")
- }
- }
- }
- Item
- {
- height: childrenRect.height
- anchors
- {
- right: collapseIcon.left
- rightMargin: UM.Theme.getSize("default_margin").width
- left: machineIcon.right
- leftMargin: UM.Theme.getSize("default_margin").width
-
- verticalCenter: machineIcon.verticalCenter
- }
-
- Label
- {
- id: machineNameLabel
- text: modelData.name
- width: parent.width
- elide: Text.ElideRight
- font: UM.Theme.getFont("default_bold")
- }
-
- Label
- {
- id: activeJobLabel
- text:
- {
- if (modelData.state == "disabled")
- {
- return catalog.i18nc("@label", "Not available")
- } else if (modelData.state == "unreachable")
- {
- return catalog.i18nc("@label", "Unreachable")
- }
- if (modelData.activePrintJob != null)
- {
- return modelData.activePrintJob.name
- }
- return catalog.i18nc("@label", "Available")
- }
- anchors.top: machineNameLabel.bottom
- width: parent.width
- elide: Text.ElideRight
- font: UM.Theme.getFont("default")
- color: UM.Theme.getColor("monitor_tab_text_inactive")
- }
- }
-
- UM.RecolorImage
- {
- id: collapseIcon
- width: 15
- height: 15
- sourceSize.width: width
- sourceSize.height: height
- source: base.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.right
- anchors.rightMargin: UM.Theme.getSize("default_margin").width
- color: "black"
- }
- }
-
- Item
- {
- id: detailedInfo
- property var printJob: modelData.activePrintJob
- visible: height == childrenRect.height
- anchors.top: printerInfo.bottom
- width: parent.width
- height: !base.collapsed ? childrenRect.height : 0
- opacity: visible ? 1 : 0
- Behavior on height { NumberAnimation { duration: 100 } }
- Behavior on opacity { NumberAnimation { duration: 100 } }
- Rectangle
- {
- id: topSpacer
- color:
- {
- if(modelData.state == "disabled")
- {
- return UM.Theme.getColor("monitor_lining_inactive")
- }
- return UM.Theme.getColor("viewport_background")
- }
- // UM.Theme.getColor("viewport_background")
- height: 1
- anchors
- {
- left: parent.left
- right: parent.right
- margins: UM.Theme.getSize("default_margin").width
- top: parent.top
- topMargin: UM.Theme.getSize("default_margin").width
- }
- }
- PrinterFamilyPill
- {
- id: printerFamilyPill
- color:
- {
- if(modelData.state == "disabled")
- {
- return "transparent"
- }
- return UM.Theme.getColor("viewport_background")
- }
- anchors.top: topSpacer.bottom
- anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- text: modelData.type
- anchors.left: parent.left
- anchors.leftMargin: UM.Theme.getSize("default_margin").width
- padding: 3
- }
- Row
- {
- id: extrudersInfo
- anchors.top: printerFamilyPill.bottom
- anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- anchors.left: parent.left
- anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
- anchors.right: parent.right
- anchors.rightMargin: 2 * UM.Theme.getSize("default_margin").width
- height: childrenRect.height
- spacing: UM.Theme.getSize("default_margin").width
-
- PrintCoreConfiguration
- {
- id: leftExtruderInfo
- width: Math.round(parent.width / 2)
- printCoreConfiguration: modelData.printerConfiguration.extruderConfigurations[0]
- }
-
- PrintCoreConfiguration
- {
- id: rightExtruderInfo
- width: Math.round(parent.width / 2)
- printCoreConfiguration: modelData.printerConfiguration.extruderConfigurations[1]
- }
- }
-
- Rectangle
- {
- id: jobSpacer
- color: UM.Theme.getColor("viewport_background")
- height: 2
- anchors
- {
- left: parent.left
- right: parent.right
- margins: UM.Theme.getSize("default_margin").width
- top: extrudersInfo.bottom
- topMargin: 2 * UM.Theme.getSize("default_margin").height
- }
- }
-
- Item
- {
- id: jobInfo
- property var showJobInfo: modelData.activePrintJob != null && modelData.activePrintJob.state != "queued"
-
- anchors.top: jobSpacer.bottom
- anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.margins: UM.Theme.getSize("default_margin").width
- anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
- height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height: 0
- visible: showJobInfo
- Label
- {
- id: printJobName
- text: modelData.activePrintJob != null ? modelData.activePrintJob.name : ""
- font: UM.Theme.getFont("default_bold")
- anchors.left: parent.left
- anchors.right: contextButton.left
- anchors.rightMargin: UM.Theme.getSize("default_margin").width
- elide: Text.ElideRight
- }
- Label
- {
- id: ownerName
- anchors.top: printJobName.bottom
- text: modelData.activePrintJob != null ? modelData.activePrintJob.owner : ""
- font: UM.Theme.getFont("default")
- opacity: 0.6
- width: parent.width
- elide: Text.ElideRight
- }
-
- function switchPopupState()
- {
- popup.visible ? popup.close() : popup.open()
- }
-
- Controls2.Button
- {
- id: contextButton
- text: "\u22EE" //Unicode; Three stacked points.
- width: 35
- height: width
- anchors
- {
- right: parent.right
- top: parent.top
- }
- hoverEnabled: true
-
- background: Rectangle
- {
- opacity: contextButton.down || contextButton.hovered ? 1 : 0
- width: contextButton.width
- height: contextButton.height
- radius: 0.5 * width
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: contextButton.text
- color: UM.Theme.getColor("monitor_tab_text_inactive")
- font.pixelSize: 25
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignHCenter
- }
-
- onClicked: parent.switchPopupState()
- }
-
- Controls2.Popup
- {
- // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
- id: popup
- clip: true
- closePolicy: Popup.CloseOnPressOutside
- x: (parent.width - width) + 26 * screenScaleFactor
- y: contextButton.height - 5 * screenScaleFactor // Because shadow
- width: 182 * screenScaleFactor
- height: contentItem.height + 2 * padding
- visible: false
- padding: 5 * screenScaleFactor // Because shadow
-
- transformOrigin: Popup.Top
- contentItem: Item
- {
- width: popup.width
- height: childrenRect.height + 36 * screenScaleFactor
- anchors.topMargin: 10 * screenScaleFactor
- anchors.bottomMargin: 10 * screenScaleFactor
- Controls2.Button
- {
- id: pauseButton
- text: modelData.activePrintJob != null && modelData.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
- onClicked:
- {
- if(modelData.activePrintJob.state == "paused")
- {
- modelData.activePrintJob.setState("print")
- }
- else if(modelData.activePrintJob.state == "printing")
- {
- modelData.activePrintJob.setState("pause")
- }
- popup.close()
- }
- width: parent.width
- enabled: modelData.activePrintJob != null && ["paused", "printing"].indexOf(modelData.activePrintJob.state) >= 0
- visible: enabled
- anchors.top: parent.top
- anchors.topMargin: 18 * screenScaleFactor
- height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
- hoverEnabled: true
- background: Rectangle
- {
- opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: pauseButton.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- }
- }
-
- Controls2.Button
- {
- id: abortButton
- text: catalog.i18nc("@label", "Abort")
- onClicked:
- {
- abortConfirmationDialog.visible = true;
- popup.close();
- }
- width: parent.width
- height: 39 * screenScaleFactor
- anchors.top: pauseButton.bottom
- hoverEnabled: true
- enabled: modelData.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(modelData.activePrintJob.state) >= 0
- background: Rectangle
- {
- opacity: abortButton.down || abortButton.hovered ? 1 : 0
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: abortButton.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- }
- }
-
- MessageDialog
- {
- id: abortConfirmationDialog
- title: catalog.i18nc("@window:title", "Abort print")
- icon: StandardIcon.Warning
- text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(modelData.activePrintJob.name)
- standardButtons: StandardButton.Yes | StandardButton.No
- Component.onCompleted: visible = false
- onYes: modelData.activePrintJob.setState("abort")
- }
- }
-
- background: Item
- {
- width: popup.width
- height: popup.height
-
- DropShadow
- {
- anchors.fill: pointedRectangle
- radius: 5
- color: "#3F000000" // 25% shadow
- source: pointedRectangle
- transparentBorder: true
- verticalOffset: 2
- }
-
- Item
- {
- id: pointedRectangle
- width: parent.width - 10 * screenScaleFactor // Because of the shadow
- height: parent.height - 10 * screenScaleFactor // Because of the shadow
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
-
- Rectangle
- {
- id: point
- height: 14 * screenScaleFactor
- width: 14 * screenScaleFactor
- color: UM.Theme.getColor("setting_control")
- transform: Rotation { angle: 45}
- anchors.right: bloop.right
- anchors.rightMargin: 24
- y: 1
- }
-
- Rectangle
- {
- id: bloop
- color: UM.Theme.getColor("setting_control")
- width: parent.width
- anchors.top: parent.top
- anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
- }
- }
- }
-
- exit: Transition
- {
- // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- NumberAnimation { property: "visible"; duration: 75; }
- }
- enter: Transition
- {
- // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- NumberAnimation { property: "visible"; duration: 75; }
- }
-
- onClosed: visible = false
- onOpened: visible = true
- }
-
- Image
- {
- id: printJobPreview
- source: modelData.activePrintJob != null ? modelData.activePrintJob.previewImageUrl : ""
- anchors.top: ownerName.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width / 2
- height: width
- opacity:
- {
- if(modelData.activePrintJob == null)
- {
- return 1.0
- }
-
- switch(modelData.activePrintJob.state)
- {
- case "wait_cleanup":
- case "wait_user_action":
- case "paused":
- return 0.5
- default:
- return 1.0
- }
- }
-
-
- }
-
- UM.RecolorImage
- {
- id: statusImage
- anchors.centerIn: printJobPreview
- source:
- {
- if(modelData.activePrintJob == null)
- {
- return ""
- }
- switch(modelData.activePrintJob.state)
- {
- case "paused":
- return "../svg/paused-icon.svg"
- case "wait_cleanup":
- if(modelData.activePrintJob.timeElapsed < modelData.activePrintJob.timeTotal)
- {
- return "../svg/aborted-icon.svg"
- }
- return "../svg/approved-icon.svg"
- case "wait_user_action":
- return "../svg/aborted-icon.svg"
- default:
- return ""
- }
- }
- visible: source != ""
- width: 0.5 * printJobPreview.width
- height: 0.5 * printJobPreview.height
- sourceSize.width: width
- sourceSize.height: height
- color: "black"
- }
-
- CameraButton
- {
- id: showCameraButton
- iconSource: "../svg/camera-icon.svg"
- anchors
- {
- left: parent.left
- bottom: printJobPreview.bottom
- }
- }
- }
- }
-
- ProgressBar
- {
- property var progress:
- {
- if(modelData.activePrintJob == null)
- {
- return 0
- }
- var result = modelData.activePrintJob.timeElapsed / modelData.activePrintJob.timeTotal
- if(result > 1.0)
- {
- result = 1.0
- }
- return result
- }
-
- id: jobProgressBar
- width: parent.width
- value: progress
- anchors.top: detailedInfo.bottom
- anchors.topMargin: UM.Theme.getSize("default_margin").height
-
- visible: modelData.activePrintJob != null && modelData.activePrintJob != undefined
-
- style: ProgressBarStyle
- {
- property var remainingTime:
- {
- if(modelData.activePrintJob == null)
- {
- return 0
- }
- /* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
- time from ever being less than 0. Negative durations cause strange behavior such
- as displaying "-1h -1m". */
- var activeJob = modelData.activePrintJob
- return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
- }
- property var progressText:
- {
- if(modelData.activePrintJob == null)
- {
- return ""
- }
- switch(modelData.activePrintJob.state)
- {
- case "wait_cleanup":
- if(modelData.activePrintJob.timeTotal > modelData.activePrintJob.timeElapsed)
- {
- return catalog.i18nc("@label:status", "Aborted")
- }
- return catalog.i18nc("@label:status", "Finished")
- case "pre_print":
- case "sent_to_printer":
- return catalog.i18nc("@label:status", "Preparing")
- case "aborted":
- return catalog.i18nc("@label:status", "Aborted")
- case "wait_user_action":
- return catalog.i18nc("@label:status", "Aborted")
- case "pausing":
- return catalog.i18nc("@label:status", "Pausing")
- case "paused":
- return OutputDevice.formatDuration( remainingTime )
- case "resuming":
- return catalog.i18nc("@label:status", "Resuming")
- case "queued":
- return catalog.i18nc("@label:status", "Action required")
- default:
- return OutputDevice.formatDuration( remainingTime )
- }
- }
-
- background: Rectangle
- {
- implicitWidth: 100
- implicitHeight: visible ? 24 : 0
- color: UM.Theme.getColor("viewport_background")
- }
-
- progress: Rectangle
- {
- color:
- {
- var state = modelData.activePrintJob.state
- var inactiveStates = [
- "pausing",
- "paused",
- "resuming",
- "wait_cleanup"
- ]
- if(inactiveStates.indexOf(state) > -1 && remainingTime > 0)
- {
- return UM.Theme.getColor("monitor_tab_text_inactive")
- }
- else
- {
- return UM.Theme.getColor("primary")
- }
- }
- id: progressItem
- function getTextOffset()
- {
- if(progressItem.width + progressLabel.width + 16 < control.width)
- {
- return progressItem.width + UM.Theme.getSize("default_margin").width
- }
- else
- {
- return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width
- }
- }
-
- Label
- {
- id: progressLabel
- anchors.left: parent.left
- anchors.leftMargin: getTextOffset()
- text: progressText
- anchors.verticalCenter: parent.verticalCenter
- color: progressItem.width + progressLabel.width < control.width ? "black" : "white"
- width: contentWidth
- font: UM.Theme.getFont("default")
- }
- }
- }
- }
- }
+ printer: modelData
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 89fb8a2391..3e3f962908 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -40,7 +40,7 @@ Item {
layer.effect: DropShadow {
radius: root.shadowRadius
verticalOffset: 2 * screenScaleFactor
- color: "#3F000000" // 25% shadow
+ color: "#3F000000" // 25% shadow
}
Column {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
new file mode 100644
index 0000000000..906774d2c2
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -0,0 +1,652 @@
+import QtQuick 2.3
+import QtQuick.Dialogs 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.3
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.4 as LegacyControls
+import UM 1.3 as UM
+
+Item {
+ id: root;
+
+ property var shadowRadius: 5;
+ property var shadowOffset: 2;
+ property var printer: null;
+ property var collapsed: true;
+
+ height: childrenRect.height + shadowRadius * 2; // Bubbles upward
+ width: parent.width; // Bubbles downward
+
+ // The actual card (white block)
+ Rectangle {
+ // 5px margin, but shifted 2px vertically because of the shadow
+ anchors {
+ topMargin: root.shadowRadius - root.shadowOffset;
+ bottomMargin: root.shadowRadius + root.shadowOffset;
+ leftMargin: root.shadowRadius;
+ rightMargin: root.shadowRadius;
+ }
+ color: {
+ if (printer.state == "disabled") {
+ return UM.Theme.getColor("monitor_tab_background_inactive");
+ } else {
+ return UM.Theme.getColor("monitor_tab_background_active");
+ }
+ }
+ height: childrenRect.height;
+ layer.effect: DropShadow {
+ radius: root.shadowRadius;
+ verticalOffset: root.shadowOffset;
+ color: "#3F000000"; // 25% shadow
+ }
+ layer.enabled: true
+ width: parent.width - 2 * shadowRadius;
+
+ // Main card
+ Rectangle {
+ id: mainCard;
+ anchors.top: parent.top;
+ color: "pink";
+ height: childrenRect.height;
+ width: parent.width;
+
+ // Machine icon
+ Item {
+ id: machineIcon;
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("wide_margin").width;
+ margins: UM.Theme.getSize("default_margin").width;
+ top: parent.top;
+ }
+ height: 58;
+ width: 58;
+
+ // Skeleton
+ Rectangle {
+ anchors {
+ fill: parent;
+ // margins: Math.round(UM.Theme.getSize("default_margin").width / 4);
+ }
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ visible: !printer;
+ }
+
+ // Content
+ UM.RecolorImage {
+ anchors.centerIn: parent;
+ color: {
+ if (printer.state == "disabled") {
+ return UM.Theme.getColor("monitor_tab_text_inactive");
+ }
+ if (printer.activePrintJob != undefined) {
+ return UM.Theme.getColor("primary");
+ }
+ return UM.Theme.getColor("monitor_tab_text_inactive");
+ }
+ height: sourceSize.height;
+ source: {
+ switch(printer.type) {
+ case "Ultimaker 3":
+ return "../svg/UM3-icon.svg";
+ case "Ultimaker 3 Extended":
+ return "../svg/UM3x-icon.svg";
+ case "Ultimaker S5":
+ return "../svg/UMs5-icon.svg";
+ }
+ }
+ visible: printer;
+ width: sourceSize.width;
+ }
+ }
+
+ // Printer info
+ Item {
+ id: printerInfo;
+ height: childrenRect.height
+ anchors {
+ left: machineIcon.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: collapseIcon.left;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: machineIcon.verticalCenter;
+ }
+
+ // Machine name
+ Item {
+ id: machineNameLabel;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width * 0.3;
+
+ // Skeleton
+ Rectangle {
+ anchors.fill: parent;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ visible: !printer;
+ }
+
+ // Actual content
+ Label {
+ anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default_bold");
+ text: printer.name;
+ visible: printer;
+ width: parent.width;
+ }
+ }
+
+ // Job name
+ Item {
+ id: activeJobLabel;
+ anchors {
+ top: machineNameLabel.bottom;
+ topMargin: Math.round(UM.Theme.getSize("default_margin").height / 2);
+ }
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width * 0.75;
+
+
+ // Skeleton
+ Rectangle {
+ anchors.fill: parent;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ visible: !printer;
+ }
+
+ // Actual content
+ Label {
+ anchors.fill: parent;
+ color: UM.Theme.getColor("monitor_tab_text_inactive");
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
+ text: {
+ if (printer.state == "disabled") {
+ return catalog.i18nc("@label", "Not available");
+ } else if (printer.state == "unreachable") {
+ return catalog.i18nc("@label", "Unreachable");
+ }
+ if (printer.activePrintJob != null) {
+ return printer.activePrintJob.name;
+ }
+ return catalog.i18nc("@label", "Available");
+ }
+ visible: printer;
+ }
+ }
+ }
+
+ // Collapse icon
+ UM.RecolorImage {
+ id: collapseIcon;
+ anchors {
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ color: UM.Theme.getColor("text");
+ height: 15; // TODO: Theme!
+ source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom");
+ sourceSize.height: height;
+ sourceSize.width: width;
+ visible: printer;
+ width: 15; // TODO: Theme!
+ }
+
+ MouseArea {
+ anchors.fill: parent;
+ enabled: printer;
+ onClicked: {
+ console.log(printerInfo.height)
+ if (root.collapsed && model) {
+ printerList.currentIndex = model.index;
+ } else {
+ printerList.currentIndex = -1;
+ }
+ }
+ }
+
+ Connections {
+ target: printerList
+ onCurrentIndexChanged: {
+ root.collapsed = printerList.currentIndex != model.index;
+ }
+ }
+ }
+
+ // Detailed card
+ Rectangle {
+ width: parent.width;
+ height: 0;
+ anchors.top: mainCard.bottom;
+ anchors.bottom: progressBar.top;
+ }
+
+ // Progress bar
+ PrinterCardProgressBar {
+ id: progressBar;
+ anchors {
+ bottom: parent.bottom;
+ }
+ visible: printer && printer.activePrintJob != null && printer.activePrintJob != undefined;
+ width: parent.width;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Item
+ // {
+ // id: detailedInfo
+ // property var printJob: printer.activePrintJob
+ // visible: height == childrenRect.height
+ // anchors.top: printerInfo.bottom
+ // width: parent.width
+ // height: !root.collapsed ? childrenRect.height : 0
+ // opacity: visible ? 1 : 0
+ // Behavior on height { NumberAnimation { duration: 100 } }
+ // Behavior on opacity { NumberAnimation { duration: 100 } }
+ // Rectangle
+ // {
+ // id: topSpacer
+ // color:
+ // {
+ // if(printer.state == "disabled")
+ // {
+ // return UM.Theme.getColor("monitor_lining_inactive")
+ // }
+ // return UM.Theme.getColor("viewport_background")
+ // }
+ // // UM.Theme.getColor("viewport_background")
+ // height: 1
+ // anchors
+ // {
+ // left: parent.left
+ // right: parent.right
+ // margins: UM.Theme.getSize("default_margin").width
+ // top: parent.top
+ // topMargin: UM.Theme.getSize("default_margin").width
+ // }
+ // }
+ // PrinterFamilyPill
+ // {
+ // id: printerFamilyPill
+ // color:
+ // {
+ // if(printer.state == "disabled")
+ // {
+ // return "transparent"
+ // }
+ // return UM.Theme.getColor("viewport_background")
+ // }
+ // anchors.top: topSpacer.bottom
+ // anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
+ // text: printer.type
+ // anchors.left: parent.left
+ // anchors.leftMargin: UM.Theme.getSize("default_margin").width
+ // padding: 3
+ // }
+ // Row
+ // {
+ // id: extrudersInfo
+ // anchors.top: printerFamilyPill.bottom
+ // anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
+ // anchors.left: parent.left
+ // anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
+ // anchors.right: parent.right
+ // anchors.rightMargin: 2 * UM.Theme.getSize("default_margin").width
+ // height: childrenRect.height
+ // spacing: UM.Theme.getSize("default_margin").width
+
+ // PrintCoreConfiguration
+ // {
+ // id: leftExtruderInfo
+ // width: Math.round(parent.width / 2)
+ // printCoreConfiguration: printer.printerConfiguration.extruderConfigurations[0]
+ // }
+
+ // PrintCoreConfiguration
+ // {
+ // id: rightExtruderInfo
+ // width: Math.round(parent.width / 2)
+ // printCoreConfiguration: printer.printerConfiguration.extruderConfigurations[1]
+ // }
+ // }
+
+ // Rectangle
+ // {
+ // id: jobSpacer
+ // color: UM.Theme.getColor("viewport_background")
+ // height: 2
+ // anchors
+ // {
+ // left: parent.left
+ // right: parent.right
+ // margins: UM.Theme.getSize("default_margin").width
+ // top: extrudersInfo.bottom
+ // topMargin: 2 * UM.Theme.getSize("default_margin").height
+ // }
+ // }
+
+ // Item
+ // {
+ // id: jobInfo
+ // property var showJobInfo: printer.activePrintJob != null && printer.activePrintJob.state != "queued"
+
+ // anchors.top: jobSpacer.bottom
+ // anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
+ // anchors.left: parent.left
+ // anchors.right: parent.right
+ // anchors.margins: UM.Theme.getSize("default_margin").width
+ // anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
+ // height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height: 0
+ // visible: showJobInfo
+ // Label
+ // {
+ // id: printJobName
+ // text: printer.activePrintJob != null ? printer.activePrintJob.name : ""
+ // font: UM.Theme.getFont("default_bold")
+ // anchors.left: parent.left
+ // anchors.right: contextButton.left
+ // anchors.rightMargin: UM.Theme.getSize("default_margin").width
+ // elide: Text.ElideRight
+ // }
+ // Label
+ // {
+ // id: ownerName
+ // anchors.top: printJobName.bottom
+ // text: printer.activePrintJob != null ? printer.activePrintJob.owner : ""
+ // font: UM.Theme.getFont("default")
+ // opacity: 0.6
+ // width: parent.width
+ // elide: Text.ElideRight
+ // }
+
+ // function switchPopupState()
+ // {
+ // popup.visible ? popup.close() : popup.open()
+ // }
+
+ // Button
+ // {
+ // id: contextButton
+ // text: "\u22EE" //Unicode; Three stacked points.
+ // width: 35
+ // height: width
+ // anchors
+ // {
+ // right: parent.right
+ // top: parent.top
+ // }
+ // hoverEnabled: true
+
+ // background: Rectangle
+ // {
+ // opacity: contextButton.down || contextButton.hovered ? 1 : 0
+ // width: contextButton.width
+ // height: contextButton.height
+ // radius: 0.5 * width
+ // color: UM.Theme.getColor("viewport_background")
+ // }
+ // contentItem: Label
+ // {
+ // text: contextButton.text
+ // color: UM.Theme.getColor("monitor_tab_text_inactive")
+ // font.pixelSize: 25
+ // verticalAlignment: Text.AlignVCenter
+ // horizontalAlignment: Text.AlignHCenter
+ // }
+
+ // onClicked: parent.switchPopupState()
+ // }
+
+ // Popup
+ // {
+ // // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
+ // id: popup
+ // clip: true
+ // closePolicy: Popup.CloseOnPressOutside
+ // x: (parent.width - width) + 26 * screenScaleFactor
+ // y: contextButton.height - 5 * screenScaleFactor // Because shadow
+ // width: 182 * screenScaleFactor
+ // height: contentItem.height + 2 * padding
+ // visible: false
+ // padding: 5 * screenScaleFactor // Because shadow
+
+ // transformOrigin: Popup.Top
+ // contentItem: Item
+ // {
+ // width: popup.width
+ // height: childrenRect.height + 36 * screenScaleFactor
+ // anchors.topMargin: 10 * screenScaleFactor
+ // anchors.bottomMargin: 10 * screenScaleFactor
+ // Button
+ // {
+ // id: pauseButton
+ // text: printer.activePrintJob != null && printer.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
+ // onClicked:
+ // {
+ // if(printer.activePrintJob.state == "paused")
+ // {
+ // printer.activePrintJob.setState("print")
+ // }
+ // else if(printer.activePrintJob.state == "printing")
+ // {
+ // printer.activePrintJob.setState("pause")
+ // }
+ // popup.close()
+ // }
+ // width: parent.width
+ // enabled: printer.activePrintJob != null && ["paused", "printing"].indexOf(printer.activePrintJob.state) >= 0
+ // visible: enabled
+ // anchors.top: parent.top
+ // anchors.topMargin: 18 * screenScaleFactor
+ // height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
+ // hoverEnabled: true
+ // background: Rectangle
+ // {
+ // opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
+ // color: UM.Theme.getColor("viewport_background")
+ // }
+ // contentItem: Label
+ // {
+ // text: pauseButton.text
+ // horizontalAlignment: Text.AlignLeft
+ // verticalAlignment: Text.AlignVCenter
+ // }
+ // }
+
+ // Button
+ // {
+ // id: abortButton
+ // text: catalog.i18nc("@label", "Abort")
+ // onClicked:
+ // {
+ // abortConfirmationDialog.visible = true;
+ // popup.close();
+ // }
+ // width: parent.width
+ // height: 39 * screenScaleFactor
+ // anchors.top: pauseButton.bottom
+ // hoverEnabled: true
+ // enabled: printer.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(printer.activePrintJob.state) >= 0
+ // background: Rectangle
+ // {
+ // opacity: abortButton.down || abortButton.hovered ? 1 : 0
+ // color: UM.Theme.getColor("viewport_background")
+ // }
+ // contentItem: Label
+ // {
+ // text: abortButton.text
+ // horizontalAlignment: Text.AlignLeft
+ // verticalAlignment: Text.AlignVCenter
+ // }
+ // }
+
+ // MessageDialog
+ // {
+ // id: abortConfirmationDialog
+ // title: catalog.i18nc("@window:title", "Abort print")
+ // icon: StandardIcon.Warning
+ // text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printer.activePrintJob.name)
+ // standardButtons: StandardButton.Yes | StandardButton.No
+ // Component.onCompleted: visible = false
+ // onYes: printer.activePrintJob.setState("abort")
+ // }
+ // }
+
+ // background: Item
+ // {
+ // width: popup.width
+ // height: popup.height
+
+ // DropShadow
+ // {
+ // anchors.fill: pointedRectangle
+ // radius: 5
+ // color: "#3F000000" // 25% shadow
+ // source: pointedRectangle
+ // transparentBorder: true
+ // verticalOffset: 2
+ // }
+
+ // Item
+ // {
+ // id: pointedRectangle
+ // width: parent.width - 10 * screenScaleFactor // Because of the shadow
+ // height: parent.height - 10 * screenScaleFactor // Because of the shadow
+ // anchors.horizontalCenter: parent.horizontalCenter
+ // anchors.verticalCenter: parent.verticalCenter
+
+ // Rectangle
+ // {
+ // id: point
+ // height: 14 * screenScaleFactor
+ // width: 14 * screenScaleFactor
+ // color: UM.Theme.getColor("setting_control")
+ // transform: Rotation { angle: 45}
+ // anchors.right: bloop.right
+ // anchors.rightMargin: 24
+ // y: 1
+ // }
+
+ // Rectangle
+ // {
+ // id: bloop
+ // color: UM.Theme.getColor("setting_control")
+ // width: parent.width
+ // anchors.top: parent.top
+ // anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
+ // anchors.bottom: parent.bottom
+ // anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
+ // }
+ // }
+ // }
+
+ // exit: Transition
+ // {
+ // // This applies a default NumberAnimation to any changes a state change makes to x or y properties
+ // NumberAnimation { property: "visible"; duration: 75; }
+ // }
+ // enter: Transition
+ // {
+ // // This applies a default NumberAnimation to any changes a state change makes to x or y properties
+ // NumberAnimation { property: "visible"; duration: 75; }
+ // }
+
+ // onClosed: visible = false
+ // onOpened: visible = true
+ // }
+
+ // Image
+ // {
+ // id: printJobPreview
+ // source: printer.activePrintJob != null ? printer.activePrintJob.previewImageUrl : ""
+ // anchors.top: ownerName.bottom
+ // anchors.horizontalCenter: parent.horizontalCenter
+ // width: parent.width / 2
+ // height: width
+ // opacity:
+ // {
+ // if(printer.activePrintJob == null)
+ // {
+ // return 1.0
+ // }
+
+ // switch(printer.activePrintJob.state)
+ // {
+ // case "wait_cleanup":
+ // case "wait_user_action":
+ // case "paused":
+ // return 0.5
+ // default:
+ // return 1.0
+ // }
+ // }
+
+
+ // }
+
+ // UM.RecolorImage
+ // {
+ // id: statusImage
+ // anchors.centerIn: printJobPreview
+ // source:
+ // {
+ // if(printer.activePrintJob == null)
+ // {
+ // return ""
+ // }
+ // switch(printer.activePrintJob.state)
+ // {
+ // case "paused":
+ // return "../svg/paused-icon.svg"
+ // case "wait_cleanup":
+ // if(printer.activePrintJob.timeElapsed < printer.activePrintJob.timeTotal)
+ // {
+ // return "../svg/aborted-icon.svg"
+ // }
+ // return "../svg/approved-icon.svg"
+ // case "wait_user_action":
+ // return "../svg/aborted-icon.svg"
+ // default:
+ // return ""
+ // }
+ // }
+ // visible: source != ""
+ // width: 0.5 * printJobPreview.width
+ // height: 0.5 * printJobPreview.height
+ // sourceSize.width: width
+ // sourceSize.height: height
+ // color: "black"
+ // }
+
+ // CameraButton
+ // {
+ // id: showCameraButton
+ // iconSource: "../svg/camera-icon.svg"
+ // anchors
+ // {
+ // left: parent.left
+ // bottom: printJobPreview.bottom
+ // }
+ // }
+ // }
+ // }
+ // }
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
new file mode 100644
index 0000000000..01bd908c8b
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -0,0 +1,119 @@
+import QtQuick 2.3
+import QtQuick.Controls.Styles 1.3
+import QtQuick.Controls 1.4
+import UM 1.3 as UM
+
+ProgressBar {
+ property var progress: {
+ if (printer.activePrintJob == null) {
+ return 0;
+ }
+ var result = printer.activePrintJob.timeElapsed / printer.activePrintJob.timeTotal;
+ if (result > 1.0) {
+ result = 1.0;
+ }
+ return result;
+ }
+ value: progress;
+
+ style: ProgressBarStyle {
+ property var remainingTime:
+ {
+ if(printer.activePrintJob == null)
+ {
+ return 0
+ }
+ /* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
+ time from ever being less than 0. Negative durations cause strange behavior such
+ as displaying "-1h -1m". */
+ var activeJob = printer.activePrintJob
+ return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
+ }
+ property var progressText:
+ {
+ if(printer.activePrintJob == null)
+ {
+ return ""
+ }
+ switch(printer.activePrintJob.state)
+ {
+ case "wait_cleanup":
+ if(printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed)
+ {
+ return catalog.i18nc("@label:status", "Aborted")
+ }
+ return catalog.i18nc("@label:status", "Finished")
+ case "pre_print":
+ case "sent_to_printer":
+ return catalog.i18nc("@label:status", "Preparing")
+ case "aborted":
+ return catalog.i18nc("@label:status", "Aborted")
+ case "wait_user_action":
+ return catalog.i18nc("@label:status", "Aborted")
+ case "pausing":
+ return catalog.i18nc("@label:status", "Pausing")
+ case "paused":
+ return OutputDevice.formatDuration( remainingTime )
+ case "resuming":
+ return catalog.i18nc("@label:status", "Resuming")
+ case "queued":
+ return catalog.i18nc("@label:status", "Action required")
+ default:
+ return OutputDevice.formatDuration( remainingTime )
+ }
+ }
+
+ background: Rectangle
+ {
+ implicitWidth: 100
+ implicitHeight: visible ? 24 : 0
+ color: UM.Theme.getColor("viewport_background")
+ }
+
+ progress: Rectangle
+ {
+ color:
+ {
+ var state = printer.activePrintJob.state
+ var inactiveStates = [
+ "pausing",
+ "paused",
+ "resuming",
+ "wait_cleanup"
+ ]
+ if(inactiveStates.indexOf(state) > -1 && remainingTime > 0)
+ {
+ return UM.Theme.getColor("monitor_tab_text_inactive")
+ }
+ else
+ {
+ return UM.Theme.getColor("primary")
+ }
+ }
+ id: progressItem
+ function getTextOffset()
+ {
+ if(progressItem.width + progressLabel.width + 16 < control.width)
+ {
+ return progressItem.width + UM.Theme.getSize("default_margin").width
+ }
+ else
+ {
+ return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width
+ }
+ }
+
+ Label
+ {
+ id: progressLabel
+ anchors.left: parent.left
+ anchors.leftMargin: getTextOffset()
+ text: progressText
+ anchors.verticalCenter: parent.verticalCenter
+ color: progressItem.width + progressLabel.width < control.width ? "black" : "white"
+ width: contentWidth
+ font: UM.Theme.getFont("default")
+ }
+ }
+ }
+}
\ No newline at end of file
From 7c01e632df5dc9e335d034c5c2e345e6826375e2 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Fri, 28 Sep 2018 17:00:50 +0200
Subject: [PATCH 10/31] Rework printer cards (cont)
Contributes to CL-1051
---
.../resources/qml/HorizontalLine.qml | 21 +
.../resources/qml/PrintJobInfoBlock.qml | 47 +-
.../resources/qml/PrinterCard.qml | 738 ++++--------------
.../resources/qml/PrinterCardDetails.qml | 370 +++++++++
.../resources/qml/PrinterCardProgressBar.qml | 1 +
.../resources/qml/PrinterFamilyPill.qml | 5 +-
.../resources/qml/PrinterInfoBlock.qml | 83 ++
7 files changed, 641 insertions(+), 624 deletions(-)
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
diff --git a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
new file mode 100644
index 0000000000..a15fb81963
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.3
+import QtQuick.Controls 2.0
+import UM 1.3 as UM
+
+Item {
+ id: root;
+ property var enabled: true;
+ width: parent.width;
+ height: childrenRect.height;
+
+ Rectangle {
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ }
+ color: root.enabled ? UM.Theme.getColor("monitor_lining_inactive") : UM.Theme.getColor("monitor_lining_active");
+ height: UM.Theme.getSize("default_lining").height;
+ }
+}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 3e3f962908..8a6a6d297c 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -218,49 +218,10 @@ Item {
}
}
- // Printer family pills
- Row {
- id: printerFamilyPills;
- visible: printJob;
- spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
- anchors {
- left: parent.left;
- right: parent.right;
- bottom: extrudersInfo.top;
- bottomMargin: UM.Theme.getSize("default_margin").height;
- }
- height: childrenRect.height;
- Repeater {
- model: printJob ? printJob.compatibleMachineFamilies : [];
- delegate: PrinterFamilyPill {
- text: modelData;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- padding: 3 * screenScaleFactor; // TODO: Theme!
- }
- }
- }
-
- // Print core & material config
- Row {
- id: extrudersInfo;
- anchors {
- bottom: parent.bottom;
- left: parent.left;
- right: parent.right;
- rightMargin: UM.Theme.getSize("default_margin").width;
- }
- height: childrenRect.height;
- spacing: UM.Theme.getSize("default_margin").width;
- PrintCoreConfiguration {
- id: leftExtruderInfo;
- width: Math.round(parent.width / 2) * screenScaleFactor;
- printCoreConfiguration: printJob !== null ? printJob.configuration.extruderConfigurations[0] : null;
- }
- PrintCoreConfiguration {
- id: rightExtruderInfo;
- width: Math.round(parent.width / 2) * screenScaleFactor;
- printCoreConfiguration: printJob !== null ? printJob.configuration.extruderConfigurations[1] : null;
- }
+ PrinterInfoBlock {
+ printer: root.printJob.assignedPrinter;
+ printJob: root.printJob;
+ anchors.bottom: parent.bottom;
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index 906774d2c2..3eec298bd2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -42,611 +42,193 @@ Item {
layer.enabled: true
width: parent.width - 2 * shadowRadius;
- // Main card
- Rectangle {
- id: mainCard;
- anchors.top: parent.top;
- color: "pink";
- height: childrenRect.height;
+ Column {
width: parent.width;
+ height: childrenRect.height;
- // Machine icon
+ // Main card
Item {
- id: machineIcon;
- anchors {
- left: parent.left;
- leftMargin: UM.Theme.getSize("wide_margin").width;
- margins: UM.Theme.getSize("default_margin").width;
- top: parent.top;
- }
- height: 58;
- width: 58;
+ id: mainCard;
+ // color: "pink";
+ height: childrenRect.height;
+ width: parent.width;
- // Skeleton
- Rectangle {
+ // Machine icon
+ Item {
+ id: machineIcon;
anchors {
- fill: parent;
- // margins: Math.round(UM.Theme.getSize("default_margin").width / 4);
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("wide_margin").width;
+ margins: UM.Theme.getSize("default_margin").width;
+ top: parent.top;
}
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
- visible: !printer;
- }
+ height: 58;
+ width: 58;
- // Content
- UM.RecolorImage {
- anchors.centerIn: parent;
- color: {
- if (printer.state == "disabled") {
+ // Skeleton
+ Rectangle {
+ anchors {
+ fill: parent;
+ // margins: Math.round(UM.Theme.getSize("default_margin").width / 4);
+ }
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ visible: !printer;
+ }
+
+ // Content
+ UM.RecolorImage {
+ anchors.centerIn: parent;
+ color: {
+ if (printer.state == "disabled") {
+ return UM.Theme.getColor("monitor_tab_text_inactive");
+ }
+ if (printer.activePrintJob != undefined) {
+ return UM.Theme.getColor("primary");
+ }
return UM.Theme.getColor("monitor_tab_text_inactive");
}
- if (printer.activePrintJob != undefined) {
- return UM.Theme.getColor("primary");
+ height: sourceSize.height;
+ source: {
+ switch(printer.type) {
+ case "Ultimaker 3":
+ return "../svg/UM3-icon.svg";
+ case "Ultimaker 3 Extended":
+ return "../svg/UM3x-icon.svg";
+ case "Ultimaker S5":
+ return "../svg/UMs5-icon.svg";
+ }
}
- return UM.Theme.getColor("monitor_tab_text_inactive");
- }
- height: sourceSize.height;
- source: {
- switch(printer.type) {
- case "Ultimaker 3":
- return "../svg/UM3-icon.svg";
- case "Ultimaker 3 Extended":
- return "../svg/UM3x-icon.svg";
- case "Ultimaker S5":
- return "../svg/UMs5-icon.svg";
- }
- }
- visible: printer;
- width: sourceSize.width;
- }
- }
-
- // Printer info
- Item {
- id: printerInfo;
- height: childrenRect.height
- anchors {
- left: machineIcon.right;
- leftMargin: UM.Theme.getSize("default_margin").width;
- right: collapseIcon.left;
- rightMargin: UM.Theme.getSize("default_margin").width;
- verticalCenter: machineIcon.verticalCenter;
- }
-
- // Machine name
- Item {
- id: machineNameLabel;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
- width: parent.width * 0.3;
-
- // Skeleton
- Rectangle {
- anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- visible: !printer;
- }
-
- // Actual content
- Label {
- anchors.fill: parent;
- elide: Text.ElideRight;
- font: UM.Theme.getFont("default_bold");
- text: printer.name;
visible: printer;
- width: parent.width;
+ width: sourceSize.width;
}
}
- // Job name
+ // Printer info
Item {
- id: activeJobLabel;
+ id: printerInfo;
+ height: childrenRect.height
anchors {
- top: machineNameLabel.bottom;
- topMargin: Math.round(UM.Theme.getSize("default_margin").height / 2);
- }
- height: UM.Theme.getSize("monitor_tab_text_line").height;
- width: parent.width * 0.75;
-
-
- // Skeleton
- Rectangle {
- anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- visible: !printer;
+ left: machineIcon.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: collapseIcon.left;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: machineIcon.verticalCenter;
}
- // Actual content
- Label {
- anchors.fill: parent;
- color: UM.Theme.getColor("monitor_tab_text_inactive");
- elide: Text.ElideRight;
- font: UM.Theme.getFont("default");
- text: {
- if (printer.state == "disabled") {
- return catalog.i18nc("@label", "Not available");
- } else if (printer.state == "unreachable") {
- return catalog.i18nc("@label", "Unreachable");
- }
- if (printer.activePrintJob != null) {
- return printer.activePrintJob.name;
- }
- return catalog.i18nc("@label", "Available");
+ // Machine name
+ Item {
+ id: machineNameLabel;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width * 0.3;
+
+ // Skeleton
+ Rectangle {
+ anchors.fill: parent;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ visible: !printer;
}
- visible: printer;
+
+ // Actual content
+ Label {
+ anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default_bold");
+ text: printer.name;
+ visible: printer;
+ width: parent.width;
+ }
+ }
+
+ // Job name
+ Item {
+ id: activeJobLabel;
+ anchors {
+ top: machineNameLabel.bottom;
+ topMargin: Math.round(UM.Theme.getSize("default_margin").height / 2);
+ }
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width * 0.75;
+
+
+ // Skeleton
+ Rectangle {
+ anchors.fill: parent;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ visible: !printer;
+ }
+
+ // Actual content
+ Label {
+ anchors.fill: parent;
+ color: UM.Theme.getColor("monitor_tab_text_inactive");
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
+ text: {
+ if (printer.state == "disabled") {
+ return catalog.i18nc("@label", "Not available");
+ } else if (printer.state == "unreachable") {
+ return catalog.i18nc("@label", "Unreachable");
+ }
+ if (printer.activePrintJob != null) {
+ return printer.activePrintJob.name;
+ }
+ return catalog.i18nc("@label", "Available");
+ }
+ visible: printer;
+ }
+ }
+ }
+
+ // Collapse icon
+ UM.RecolorImage {
+ id: collapseIcon;
+ anchors {
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ verticalCenter: parent.verticalCenter;
+ }
+ color: UM.Theme.getColor("text");
+ height: 15; // TODO: Theme!
+ source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom");
+ sourceSize.height: height;
+ sourceSize.width: width;
+ visible: printer;
+ width: 15; // TODO: Theme!
+ }
+
+ MouseArea {
+ anchors.fill: parent;
+ enabled: printer;
+ onClicked: {
+ console.log(model.index)
+ if (root.collapsed && model) {
+ printerList.currentIndex = model.index;
+ } else {
+ printerList.currentIndex = -1;
+ }
+ }
+ }
+
+ Connections {
+ target: printerList
+ onCurrentIndexChanged: {
+ root.collapsed = printerList.currentIndex != model.index;
}
}
}
- // Collapse icon
- UM.RecolorImage {
- id: collapseIcon;
- anchors {
- right: parent.right;
- rightMargin: UM.Theme.getSize("default_margin").width;
- verticalCenter: parent.verticalCenter;
- }
- color: UM.Theme.getColor("text");
- height: 15; // TODO: Theme!
- source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom");
- sourceSize.height: height;
- sourceSize.width: width;
+ // Detailed card
+ PrinterCardDetails {
+ collapsed: root.collapsed;
+ printer: printer;
visible: printer;
- width: 15; // TODO: Theme!
}
- MouseArea {
- anchors.fill: parent;
- enabled: printer;
- onClicked: {
- console.log(printerInfo.height)
- if (root.collapsed && model) {
- printerList.currentIndex = model.index;
- } else {
- printerList.currentIndex = -1;
- }
- }
+ // Progress bar
+ PrinterCardProgressBar {
+ visible: printer && printer.activePrintJob != null && printer.activePrintJob != undefined;
}
-
- Connections {
- target: printerList
- onCurrentIndexChanged: {
- root.collapsed = printerList.currentIndex != model.index;
- }
- }
- }
-
- // Detailed card
- Rectangle {
- width: parent.width;
- height: 0;
- anchors.top: mainCard.bottom;
- anchors.bottom: progressBar.top;
- }
-
- // Progress bar
- PrinterCardProgressBar {
- id: progressBar;
- anchors {
- bottom: parent.bottom;
- }
- visible: printer && printer.activePrintJob != null && printer.activePrintJob != undefined;
- width: parent.width;
}
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- // Item
- // {
- // id: detailedInfo
- // property var printJob: printer.activePrintJob
- // visible: height == childrenRect.height
- // anchors.top: printerInfo.bottom
- // width: parent.width
- // height: !root.collapsed ? childrenRect.height : 0
- // opacity: visible ? 1 : 0
- // Behavior on height { NumberAnimation { duration: 100 } }
- // Behavior on opacity { NumberAnimation { duration: 100 } }
- // Rectangle
- // {
- // id: topSpacer
- // color:
- // {
- // if(printer.state == "disabled")
- // {
- // return UM.Theme.getColor("monitor_lining_inactive")
- // }
- // return UM.Theme.getColor("viewport_background")
- // }
- // // UM.Theme.getColor("viewport_background")
- // height: 1
- // anchors
- // {
- // left: parent.left
- // right: parent.right
- // margins: UM.Theme.getSize("default_margin").width
- // top: parent.top
- // topMargin: UM.Theme.getSize("default_margin").width
- // }
- // }
- // PrinterFamilyPill
- // {
- // id: printerFamilyPill
- // color:
- // {
- // if(printer.state == "disabled")
- // {
- // return "transparent"
- // }
- // return UM.Theme.getColor("viewport_background")
- // }
- // anchors.top: topSpacer.bottom
- // anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- // text: printer.type
- // anchors.left: parent.left
- // anchors.leftMargin: UM.Theme.getSize("default_margin").width
- // padding: 3
- // }
- // Row
- // {
- // id: extrudersInfo
- // anchors.top: printerFamilyPill.bottom
- // anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- // anchors.left: parent.left
- // anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
- // anchors.right: parent.right
- // anchors.rightMargin: 2 * UM.Theme.getSize("default_margin").width
- // height: childrenRect.height
- // spacing: UM.Theme.getSize("default_margin").width
-
- // PrintCoreConfiguration
- // {
- // id: leftExtruderInfo
- // width: Math.round(parent.width / 2)
- // printCoreConfiguration: printer.printerConfiguration.extruderConfigurations[0]
- // }
-
- // PrintCoreConfiguration
- // {
- // id: rightExtruderInfo
- // width: Math.round(parent.width / 2)
- // printCoreConfiguration: printer.printerConfiguration.extruderConfigurations[1]
- // }
- // }
-
- // Rectangle
- // {
- // id: jobSpacer
- // color: UM.Theme.getColor("viewport_background")
- // height: 2
- // anchors
- // {
- // left: parent.left
- // right: parent.right
- // margins: UM.Theme.getSize("default_margin").width
- // top: extrudersInfo.bottom
- // topMargin: 2 * UM.Theme.getSize("default_margin").height
- // }
- // }
-
- // Item
- // {
- // id: jobInfo
- // property var showJobInfo: printer.activePrintJob != null && printer.activePrintJob.state != "queued"
-
- // anchors.top: jobSpacer.bottom
- // anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- // anchors.left: parent.left
- // anchors.right: parent.right
- // anchors.margins: UM.Theme.getSize("default_margin").width
- // anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
- // height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height: 0
- // visible: showJobInfo
- // Label
- // {
- // id: printJobName
- // text: printer.activePrintJob != null ? printer.activePrintJob.name : ""
- // font: UM.Theme.getFont("default_bold")
- // anchors.left: parent.left
- // anchors.right: contextButton.left
- // anchors.rightMargin: UM.Theme.getSize("default_margin").width
- // elide: Text.ElideRight
- // }
- // Label
- // {
- // id: ownerName
- // anchors.top: printJobName.bottom
- // text: printer.activePrintJob != null ? printer.activePrintJob.owner : ""
- // font: UM.Theme.getFont("default")
- // opacity: 0.6
- // width: parent.width
- // elide: Text.ElideRight
- // }
-
- // function switchPopupState()
- // {
- // popup.visible ? popup.close() : popup.open()
- // }
-
- // Button
- // {
- // id: contextButton
- // text: "\u22EE" //Unicode; Three stacked points.
- // width: 35
- // height: width
- // anchors
- // {
- // right: parent.right
- // top: parent.top
- // }
- // hoverEnabled: true
-
- // background: Rectangle
- // {
- // opacity: contextButton.down || contextButton.hovered ? 1 : 0
- // width: contextButton.width
- // height: contextButton.height
- // radius: 0.5 * width
- // color: UM.Theme.getColor("viewport_background")
- // }
- // contentItem: Label
- // {
- // text: contextButton.text
- // color: UM.Theme.getColor("monitor_tab_text_inactive")
- // font.pixelSize: 25
- // verticalAlignment: Text.AlignVCenter
- // horizontalAlignment: Text.AlignHCenter
- // }
-
- // onClicked: parent.switchPopupState()
- // }
-
- // Popup
- // {
- // // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
- // id: popup
- // clip: true
- // closePolicy: Popup.CloseOnPressOutside
- // x: (parent.width - width) + 26 * screenScaleFactor
- // y: contextButton.height - 5 * screenScaleFactor // Because shadow
- // width: 182 * screenScaleFactor
- // height: contentItem.height + 2 * padding
- // visible: false
- // padding: 5 * screenScaleFactor // Because shadow
-
- // transformOrigin: Popup.Top
- // contentItem: Item
- // {
- // width: popup.width
- // height: childrenRect.height + 36 * screenScaleFactor
- // anchors.topMargin: 10 * screenScaleFactor
- // anchors.bottomMargin: 10 * screenScaleFactor
- // Button
- // {
- // id: pauseButton
- // text: printer.activePrintJob != null && printer.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
- // onClicked:
- // {
- // if(printer.activePrintJob.state == "paused")
- // {
- // printer.activePrintJob.setState("print")
- // }
- // else if(printer.activePrintJob.state == "printing")
- // {
- // printer.activePrintJob.setState("pause")
- // }
- // popup.close()
- // }
- // width: parent.width
- // enabled: printer.activePrintJob != null && ["paused", "printing"].indexOf(printer.activePrintJob.state) >= 0
- // visible: enabled
- // anchors.top: parent.top
- // anchors.topMargin: 18 * screenScaleFactor
- // height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
- // hoverEnabled: true
- // background: Rectangle
- // {
- // opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
- // color: UM.Theme.getColor("viewport_background")
- // }
- // contentItem: Label
- // {
- // text: pauseButton.text
- // horizontalAlignment: Text.AlignLeft
- // verticalAlignment: Text.AlignVCenter
- // }
- // }
-
- // Button
- // {
- // id: abortButton
- // text: catalog.i18nc("@label", "Abort")
- // onClicked:
- // {
- // abortConfirmationDialog.visible = true;
- // popup.close();
- // }
- // width: parent.width
- // height: 39 * screenScaleFactor
- // anchors.top: pauseButton.bottom
- // hoverEnabled: true
- // enabled: printer.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(printer.activePrintJob.state) >= 0
- // background: Rectangle
- // {
- // opacity: abortButton.down || abortButton.hovered ? 1 : 0
- // color: UM.Theme.getColor("viewport_background")
- // }
- // contentItem: Label
- // {
- // text: abortButton.text
- // horizontalAlignment: Text.AlignLeft
- // verticalAlignment: Text.AlignVCenter
- // }
- // }
-
- // MessageDialog
- // {
- // id: abortConfirmationDialog
- // title: catalog.i18nc("@window:title", "Abort print")
- // icon: StandardIcon.Warning
- // text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printer.activePrintJob.name)
- // standardButtons: StandardButton.Yes | StandardButton.No
- // Component.onCompleted: visible = false
- // onYes: printer.activePrintJob.setState("abort")
- // }
- // }
-
- // background: Item
- // {
- // width: popup.width
- // height: popup.height
-
- // DropShadow
- // {
- // anchors.fill: pointedRectangle
- // radius: 5
- // color: "#3F000000" // 25% shadow
- // source: pointedRectangle
- // transparentBorder: true
- // verticalOffset: 2
- // }
-
- // Item
- // {
- // id: pointedRectangle
- // width: parent.width - 10 * screenScaleFactor // Because of the shadow
- // height: parent.height - 10 * screenScaleFactor // Because of the shadow
- // anchors.horizontalCenter: parent.horizontalCenter
- // anchors.verticalCenter: parent.verticalCenter
-
- // Rectangle
- // {
- // id: point
- // height: 14 * screenScaleFactor
- // width: 14 * screenScaleFactor
- // color: UM.Theme.getColor("setting_control")
- // transform: Rotation { angle: 45}
- // anchors.right: bloop.right
- // anchors.rightMargin: 24
- // y: 1
- // }
-
- // Rectangle
- // {
- // id: bloop
- // color: UM.Theme.getColor("setting_control")
- // width: parent.width
- // anchors.top: parent.top
- // anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
- // anchors.bottom: parent.bottom
- // anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
- // }
- // }
- // }
-
- // exit: Transition
- // {
- // // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- // NumberAnimation { property: "visible"; duration: 75; }
- // }
- // enter: Transition
- // {
- // // This applies a default NumberAnimation to any changes a state change makes to x or y properties
- // NumberAnimation { property: "visible"; duration: 75; }
- // }
-
- // onClosed: visible = false
- // onOpened: visible = true
- // }
-
- // Image
- // {
- // id: printJobPreview
- // source: printer.activePrintJob != null ? printer.activePrintJob.previewImageUrl : ""
- // anchors.top: ownerName.bottom
- // anchors.horizontalCenter: parent.horizontalCenter
- // width: parent.width / 2
- // height: width
- // opacity:
- // {
- // if(printer.activePrintJob == null)
- // {
- // return 1.0
- // }
-
- // switch(printer.activePrintJob.state)
- // {
- // case "wait_cleanup":
- // case "wait_user_action":
- // case "paused":
- // return 0.5
- // default:
- // return 1.0
- // }
- // }
-
-
- // }
-
- // UM.RecolorImage
- // {
- // id: statusImage
- // anchors.centerIn: printJobPreview
- // source:
- // {
- // if(printer.activePrintJob == null)
- // {
- // return ""
- // }
- // switch(printer.activePrintJob.state)
- // {
- // case "paused":
- // return "../svg/paused-icon.svg"
- // case "wait_cleanup":
- // if(printer.activePrintJob.timeElapsed < printer.activePrintJob.timeTotal)
- // {
- // return "../svg/aborted-icon.svg"
- // }
- // return "../svg/approved-icon.svg"
- // case "wait_user_action":
- // return "../svg/aborted-icon.svg"
- // default:
- // return ""
- // }
- // }
- // visible: source != ""
- // width: 0.5 * printJobPreview.width
- // height: 0.5 * printJobPreview.height
- // sourceSize.width: width
- // sourceSize.height: height
- // color: "black"
- // }
-
- // CameraButton
- // {
- // id: showCameraButton
- // iconSource: "../svg/camera-icon.svg"
- // anchors
- // {
- // left: parent.left
- // bottom: printJobPreview.bottom
- // }
- // }
- // }
- // }
- // }
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
new file mode 100644
index 0000000000..8cc10b5b6b
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -0,0 +1,370 @@
+import QtQuick 2.3
+import QtQuick.Dialogs 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.3
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.4 as LegacyControls
+import UM 1.3 as UM
+
+Item {
+ id: root;
+
+ property var printer: null;
+ property var printJob: printer.activePrintJob;
+ property var collapsed: true;
+
+ Behavior on height { NumberAnimation { duration: 100 } }
+ Behavior on opacity { NumberAnimation { duration: 100 } }
+
+ width: parent.width;
+ height: collapsed ? 0 : childrenRect.height;
+ opacity: collapsed ? 0 : 1;
+
+ Column {
+ height: childrenRect.height;
+ width: parent.width;
+
+ spacing: UM.Theme.getSize("default_margin").height;
+
+ HorizontalLine { enabled: printer.state !== "disabled" }
+
+ PrinterInfoBlock {
+ printer: root.printer;
+ printJob: root.printer.activePrintJob;
+ }
+
+ HorizontalLine { enabled: printer.state !== "disabled" }
+
+ Rectangle {
+ color: "orange";
+ width: parent.width;
+ height: 100;
+ }
+
+ Item {
+ id: jobInfoSection;
+
+ property var job: root.printer ? root.printer.activePrintJob : null;
+
+ Component.onCompleted: {
+ console.log(job)
+ }
+ height: visible ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height : 0;
+ width: parent.width;
+ visible: job && job.state != "queued";
+
+ anchors.left: parent.left;
+ // anchors.right: contextButton.left;
+ // anchors.rightMargin: UM.Theme.getSize("default_margin").width;
+
+ Label {
+ id: printJobName;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default_bold");
+ text: job ? job.name : "";
+ }
+
+ Label {
+ id: ownerName;
+ anchors.top: job.bottom;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
+ opacity: 0.6;
+ text: job ? job.owner : "";
+ width: parent.width;
+ }
+ }
+ }
+}
+
+
+// Item {
+// id: jobInfo;
+// property var showJobInfo: {
+// return printer.activePrintJob != null && printer.activePrintJob.state != "queued"
+// }
+
+// // anchors {
+// // top: jobSpacer.bottom
+// // topMargin: 2 * UM.Theme.getSize("default_margin").height
+// // left: parent.left
+// // right: parent.right
+// // margins: UM.Theme.getSize("default_margin").width
+// // leftMargin: 2 * UM.Theme.getSize("default_margin").width
+// // }
+
+// height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height : 0;
+// visible: showJobInfo;
+
+
+// function switchPopupState()
+// {
+// popup.visible ? popup.close() : popup.open()
+// }
+
+// Button
+// {
+// id: contextButton
+// text: "\u22EE" //Unicode; Three stacked points.
+// width: 35
+// height: width
+// anchors
+// {
+// right: parent.right
+// top: parent.top
+// }
+// hoverEnabled: true
+
+// background: Rectangle
+// {
+// opacity: contextButton.down || contextButton.hovered ? 1 : 0
+// width: contextButton.width
+// height: contextButton.height
+// radius: 0.5 * width
+// color: UM.Theme.getColor("viewport_background")
+// }
+// contentItem: Label
+// {
+// text: contextButton.text
+// color: UM.Theme.getColor("monitor_tab_text_inactive")
+// font.pixelSize: 25
+// verticalAlignment: Text.AlignVCenter
+// horizontalAlignment: Text.AlignHCenter
+// }
+
+// onClicked: parent.switchPopupState()
+// }
+
+// Popup
+// {
+// // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
+// id: popup
+// clip: true
+// closePolicy: Popup.CloseOnPressOutside
+// x: (parent.width - width) + 26 * screenScaleFactor
+// y: contextButton.height - 5 * screenScaleFactor // Because shadow
+// width: 182 * screenScaleFactor
+// height: contentItem.height + 2 * padding
+// visible: false
+// padding: 5 * screenScaleFactor // Because shadow
+
+// transformOrigin: Popup.Top
+// contentItem: Item
+// {
+// width: popup.width
+// height: childrenRect.height + 36 * screenScaleFactor
+// anchors.topMargin: 10 * screenScaleFactor
+// anchors.bottomMargin: 10 * screenScaleFactor
+// Button
+// {
+// id: pauseButton
+// text: printer.activePrintJob != null && printer.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
+// onClicked:
+// {
+// if(printer.activePrintJob.state == "paused")
+// {
+// printer.activePrintJob.setState("print")
+// }
+// else if(printer.activePrintJob.state == "printing")
+// {
+// printer.activePrintJob.setState("pause")
+// }
+// popup.close()
+// }
+// width: parent.width
+// enabled: printer.activePrintJob != null && ["paused", "printing"].indexOf(printer.activePrintJob.state) >= 0
+// visible: enabled
+// anchors.top: parent.top
+// anchors.topMargin: 18 * screenScaleFactor
+// height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
+// hoverEnabled: true
+// background: Rectangle
+// {
+// opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
+// color: UM.Theme.getColor("viewport_background")
+// }
+// contentItem: Label
+// {
+// text: pauseButton.text
+// horizontalAlignment: Text.AlignLeft
+// verticalAlignment: Text.AlignVCenter
+// }
+// }
+
+// Button
+// {
+// id: abortButton
+// text: catalog.i18nc("@label", "Abort")
+// onClicked:
+// {
+// abortConfirmationDialog.visible = true;
+// popup.close();
+// }
+// width: parent.width
+// height: 39 * screenScaleFactor
+// anchors.top: pauseButton.bottom
+// hoverEnabled: true
+// enabled: printer.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(printer.activePrintJob.state) >= 0
+// background: Rectangle
+// {
+// opacity: abortButton.down || abortButton.hovered ? 1 : 0
+// color: UM.Theme.getColor("viewport_background")
+// }
+// contentItem: Label
+// {
+// text: abortButton.text
+// horizontalAlignment: Text.AlignLeft
+// verticalAlignment: Text.AlignVCenter
+// }
+// }
+
+// MessageDialog
+// {
+// id: abortConfirmationDialog
+// title: catalog.i18nc("@window:title", "Abort print")
+// icon: StandardIcon.Warning
+// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printer.activePrintJob.name)
+// standardButtons: StandardButton.Yes | StandardButton.No
+// Component.onCompleted: visible = false
+// onYes: printer.activePrintJob.setState("abort")
+// }
+// }
+
+// background: Item
+// {
+// width: popup.width
+// height: popup.height
+
+// DropShadow
+// {
+// anchors.fill: pointedRectangle
+// radius: 5
+// color: "#3F000000" // 25% shadow
+// source: pointedRectangle
+// transparentBorder: true
+// verticalOffset: 2
+// }
+
+// Item
+// {
+// id: pointedRectangle
+// width: parent.width - 10 * screenScaleFactor // Because of the shadow
+// height: parent.height - 10 * screenScaleFactor // Because of the shadow
+// anchors.horizontalCenter: parent.horizontalCenter
+// anchors.verticalCenter: parent.verticalCenter
+
+// Rectangle
+// {
+// id: point
+// height: 14 * screenScaleFactor
+// width: 14 * screenScaleFactor
+// color: UM.Theme.getColor("setting_control")
+// transform: Rotation { angle: 45}
+// anchors.right: bloop.right
+// anchors.rightMargin: 24
+// y: 1
+// }
+
+// Rectangle
+// {
+// id: bloop
+// color: UM.Theme.getColor("setting_control")
+// width: parent.width
+// anchors.top: parent.top
+// anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
+// anchors.bottom: parent.bottom
+// anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
+// }
+// }
+// }
+
+// exit: Transition
+// {
+// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
+// NumberAnimation { property: "visible"; duration: 75; }
+// }
+// enter: Transition
+// {
+// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
+// NumberAnimation { property: "visible"; duration: 75; }
+// }
+
+// onClosed: visible = false
+// onOpened: visible = true
+// }
+
+// Image
+// {
+// id: printJobPreview
+// source: printer.activePrintJob != null ? printer.activePrintJob.previewImageUrl : ""
+// anchors.top: ownerName.bottom
+// anchors.horizontalCenter: parent.horizontalCenter
+// width: parent.width / 2
+// height: width
+// opacity:
+// {
+// if(printer.activePrintJob == null)
+// {
+// return 1.0
+// }
+
+// switch(printer.activePrintJob.state)
+// {
+// case "wait_cleanup":
+// case "wait_user_action":
+// case "paused":
+// return 0.5
+// default:
+// return 1.0
+// }
+// }
+
+
+// }
+
+// UM.RecolorImage
+// {
+// id: statusImage
+// anchors.centerIn: printJobPreview
+// source:
+// {
+// if(printer.activePrintJob == null)
+// {
+// return ""
+// }
+// switch(printer.activePrintJob.state)
+// {
+// case "paused":
+// return "../svg/paused-icon.svg"
+// case "wait_cleanup":
+// if(printer.activePrintJob.timeElapsed < printer.activePrintJob.timeTotal)
+// {
+// return "../svg/aborted-icon.svg"
+// }
+// return "../svg/approved-icon.svg"
+// case "wait_user_action":
+// return "../svg/aborted-icon.svg"
+// default:
+// return ""
+// }
+// }
+// visible: source != ""
+// width: 0.5 * printJobPreview.width
+// height: 0.5 * printJobPreview.height
+// sourceSize.width: width
+// sourceSize.height: height
+// color: "black"
+// }
+
+// CameraButton
+// {
+// id: showCameraButton
+// iconSource: "../svg/camera-icon.svg"
+// anchors
+// {
+// left: parent.left
+// bottom: printJobPreview.bottom
+// }
+// }
+// }
+// }
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
index 01bd908c8b..a89ffd51d8 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -15,6 +15,7 @@ ProgressBar {
return result;
}
value: progress;
+ width: parent.width;
style: ProgressBarStyle {
property var remainingTime:
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
index b785cd02b7..24bc82224d 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
@@ -4,9 +4,8 @@ import UM 1.2 as UM
Item
{
- property alias color: background.color
property alias text: familyNameLabel.text
- property var padding: 0
+ property var padding: 3 * screenScaleFactor; // TODO: Theme!
implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom.
implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off.
Rectangle
@@ -14,7 +13,7 @@ Item
id: background
height: parent.height
width: parent.width
- color: parent.color
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
anchors.right: parent.right
anchors.horizontalCenter: parent.horizontalCenter
radius: 0.5 * height
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
new file mode 100644
index 0000000000..1b3a83d024
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -0,0 +1,83 @@
+import QtQuick 2.3
+import QtQuick.Dialogs 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.3
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.4 as LegacyControls
+import UM 1.3 as UM
+
+// Includes printer type pill and extuder configurations
+
+Item {
+ id: root;
+
+ property var printer: null;
+ property var printJob: null;
+
+ width: parent.width;
+ height: childrenRect.height;
+
+ // Printer family pills
+ Row {
+ id: printerFamilyPills;
+
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ bottom: extrudersInfo.top;
+ bottomMargin: UM.Theme.getSize("default_margin").height;
+ }
+ height: childrenRect.height;
+ spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
+ width: parent.width;
+
+ Repeater {
+ id: compatiblePills;
+ visible: printJob;
+ model: printJob ? printJob.compatibleMachineFamilies : [];
+ delegate: PrinterFamilyPill { text: modelData; }
+ }
+
+ PrinterFamilyPill {
+ visible: !compatiblePills.visible && printer;
+ text: printer.type;
+ }
+ }
+
+ // Extruder info
+ Row {
+ id: extrudersInfo;
+
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ }
+ height: childrenRect.height;
+ spacing: UM.Theme.getSize("default_margin").width;
+ width: parent.width;
+
+ PrintCoreConfiguration {
+ width: Math.round(parent.width / 2) * screenScaleFactor;
+ printCoreConfiguration: getExtruderConfig(0);
+ }
+
+ PrintCoreConfiguration {
+ width: Math.round(parent.width / 2) * screenScaleFactor;
+ printCoreConfiguration: getExtruderConfig(1);
+ }
+ }
+
+ function getExtruderConfig( i ) {
+ if (root.printJob) {
+ // Use more-specific print job if possible
+ return root.printJob.configuration.extruderConfigurations[i];
+ } else {
+ if (root.printer) {
+ return root.printer.printerConfiguration.extruderConfigurations[i];
+ } else {
+ return null;
+ }
+ }
+ }
+}
\ No newline at end of file
From 97fa5094ce3852d1527d404fd82c97578635e47c Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 1 Oct 2018 16:24:51 +0200
Subject: [PATCH 11/31] Monitor tab refactor + skeleton loading
Contributes to CL-1051
---
.../resources/qml/ClusterControlItem.qml | 10 +-
.../resources/qml/HorizontalLine.qml | 18 +-
.../resources/qml/PrintJobContextMenu.qml | 289 +++++++-------
.../resources/qml/PrintJobContextMenuItem.qml | 20 +
.../resources/qml/PrintJobPreview.qml | 68 ++++
.../resources/qml/PrintJobTitle.qml | 53 +++
.../resources/qml/PrinterCard.qml | 14 +-
.../resources/qml/PrinterCardDetails.qml | 376 ++----------------
.../resources/qml/PrinterInfoBlock.qml | 5 +-
9 files changed, 348 insertions(+), 505 deletions(-)
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
create mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
index bfde2ea7cd..3dfabdfb86 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
@@ -69,7 +69,8 @@ Component
// Skeleton loading
Column
{
- id: dummies
+ id: skeletonLoader
+ visible: printerList.count === 0;
anchors
{
top: printingLabel.bottom
@@ -97,12 +98,11 @@ Component
id: printerScrollView
anchors
{
- top: dummies.bottom
+ top: printingLabel.bottom
+ topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
- topMargin: UM.Theme.getSize("default_margin").height
- bottom: parent.bottom
- bottomMargin: UM.Theme.getSize("default_margin").height
+ bottom: parent.bottom;
}
style: UM.Theme.styles.scrollview
diff --git a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
index a15fb81963..fcf2330fe7 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
@@ -2,20 +2,8 @@ import QtQuick 2.3
import QtQuick.Controls 2.0
import UM 1.3 as UM
-Item {
- id: root;
- property var enabled: true;
+Rectangle {
+ color: UM.Theme.getColor("monitor_tab_lining_inactive"); // TODO: Maybe theme separately? Maybe not.
+ height: UM.Theme.getSize("default_lining").height;
width: parent.width;
- height: childrenRect.height;
-
- Rectangle {
- anchors {
- left: parent.left;
- leftMargin: UM.Theme.getSize("default_margin").width;
- right: parent.right;
- rightMargin: UM.Theme.getSize("default_margin").width;
- }
- color: root.enabled ? UM.Theme.getColor("monitor_lining_inactive") : UM.Theme.getColor("monitor_lining_active");
- height: UM.Theme.getSize("default_lining").height;
- }
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 74c4bb030c..8d523c322a 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -9,7 +9,9 @@ import UM 1.3 as UM
Item {
id: root;
+
property var printJob: null;
+ property var running: isRunning(printJob);
Button {
id: button;
@@ -36,164 +38,165 @@ Item {
Popup {
id: popup;
+ background: Item {
+ height: popup.height;
+ width: popup.width;
+
+ DropShadow {
+ anchors.fill: pointedRectangle;
+ color: "#3F000000"; // 25% shadow
+ radius: 5;
+ source: pointedRectangle;
+ transparentBorder: true;
+ verticalOffset: 2;
+ }
+
+ Item {
+ id: pointedRectangle
+ width: parent.width - 10 * screenScaleFactor; // Because of the shadow
+ height: parent.height - 10 * screenScaleFactor; // Because of the shadow
+ anchors.horizontalCenter: parent.horizontalCenter;
+ anchors.verticalCenter: parent.verticalCenter;
+
+ Rectangle {
+ id: point
+ anchors.right: bloop.right;
+ anchors.rightMargin: 24;
+ color: UM.Theme.getColor("setting_control");
+ height: 14 * screenScaleFactor;
+ transform: Rotation {
+ angle: 45;
+ }
+ width: 14 * screenScaleFactor;
+ y: 1;
+ }
+
+ Rectangle {
+ id: bloop
+ anchors {
+ bottom: parent.bottom;
+ bottomMargin: 8 * screenScaleFactor; // Because of the shadow
+ top: parent.top;
+ topMargin: 8 * screenScaleFactor; // Because of the shadow + point
+ }
+ color: UM.Theme.getColor("setting_control");
+ width: parent.width;
+ }
+ }
+ }
clip: true;
closePolicy: Popup.CloseOnPressOutside;
+ contentItem: Column {
+ id: popupOptions;
+ anchors {
+ top: parent.top;
+ topMargin: UM.Theme.getSize("default_margin").height + 10 * screenScaleFactor; // Account for the point of the box
+ }
+ height: childrenRect.height + spacing * popupOptions.children.length + UM.Theme.getSize("default_margin").height;
+ spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2);
+ width: parent.width;
+
+ PrintJobContextMenuItem {
+ enabled: printJob && !running ? OutputDevice.queuedPrintJobs[0].key != printJob.key : false;
+ onClicked: {
+ sendToTopConfirmationDialog.visible = true;
+ popup.close();
+ }
+ text: catalog.i18nc("@label", "Move to top");
+ }
+
+ PrintJobContextMenuItem {
+ enabled: printJob && !running;
+ onClicked: {
+ deleteConfirmationDialog.visible = true;
+ popup.close();
+ }
+ text: catalog.i18nc("@label", "Delete");
+ }
+
+ PrintJobContextMenuItem {
+ enabled: printJob && running;
+ onClicked: {
+ if (printJob.state == "paused") {
+ printJob.setState("print");
+ } else if(printJob.state == "printing") {
+ printJob.setState("pause");
+ }
+ popup.close();
+ }
+ text: printJob && printJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause");
+ }
+
+ PrintJobContextMenuItem {
+ enabled: printJob && running;
+ onClicked: {
+ abortConfirmationDialog.visible = true;
+ popup.close();
+ }
+ text: catalog.i18nc("@label", "Abort");
+ }
+ }
+ enter: Transition {
+ NumberAnimation {
+ duration: 75;
+ property: "visible";
+ }
+ }
+ exit: Transition {
+ NumberAnimation {
+ duration: 75;
+ property: "visible";
+ }
+ }
height: contentItem.height + 2 * padding;
+ onClosed: visible = false;
+ onOpened: visible = true;
padding: 5 * screenScaleFactor; // Because shadow
transformOrigin: Popup.Top;
visible: false;
width: 182 * screenScaleFactor;
x: (button.width - width) + 26 * screenScaleFactor;
y: button.height + 5 * screenScaleFactor; // Because shadow
- contentItem: Item {
- width: popup.width
- height: childrenRect.height + 36 * screenScaleFactor
- anchors.topMargin: 10 * screenScaleFactor
- anchors.bottomMargin: 10 * screenScaleFactor
- Button {
- id: sendToTopButton
- text: catalog.i18nc("@label", "Move to top")
- onClicked:
- {
- sendToTopConfirmationDialog.visible = true;
- popup.close();
- }
- width: parent.width
- enabled: printJob ? OutputDevice.queuedPrintJobs[0].key != printJob.key : false;
- visible: enabled
- anchors.top: parent.top
- anchors.topMargin: 18 * screenScaleFactor
- height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
- hoverEnabled: true
- background: Rectangle
- {
- opacity: sendToTopButton.down || sendToTopButton.hovered ? 1 : 0
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: sendToTopButton.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- }
- }
+ }
- MessageDialog
- {
- id: sendToTopConfirmationDialog
- title: catalog.i18nc("@window:title", "Move print job to top")
- icon: StandardIcon.Warning
- text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
- standardButtons: StandardButton.Yes | StandardButton.No
- Component.onCompleted: visible = false
- onYes: {
- if (printJob) {
- OutputDevice.sendJobToTop(printJob.key)
- }
- }
- }
+ MessageDialog {
+ id: sendToTopConfirmationDialog;
+ Component.onCompleted: visible = false;
+ icon: StandardIcon.Warning;
+ onYes: OutputDevice.sendJobToTop(printJob.key);
+ standardButtons: StandardButton.Yes | StandardButton.No;
+ text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
+ title: catalog.i18nc("@window:title", "Move print job to top");
+ }
- Button
- {
- id: deleteButton
- text: catalog.i18nc("@label", "Delete")
- onClicked:
- {
- deleteConfirmationDialog.visible = true;
- popup.close();
- }
- width: parent.width
- height: 39 * screenScaleFactor
- anchors.top: sendToTopButton.bottom
- hoverEnabled: true
- background: Rectangle
- {
- opacity: deleteButton.down || deleteButton.hovered ? 1 : 0
- color: UM.Theme.getColor("viewport_background")
- }
- contentItem: Label
- {
- text: deleteButton.text
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- }
- }
+ MessageDialog {
+ id: deleteConfirmationDialog;
+ Component.onCompleted: visible = false;
+ icon: StandardIcon.Warning;
+ onYes: OutputDevice.deleteJobFromQueue(printJob.key);
+ standardButtons: StandardButton.Yes | StandardButton.No;
+ text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
+ title: catalog.i18nc("@window:title", "Delete print job");
+ }
- MessageDialog
- {
- id: deleteConfirmationDialog
- title: catalog.i18nc("@window:title", "Delete print job")
- icon: StandardIcon.Warning
- text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
- standardButtons: StandardButton.Yes | StandardButton.No
- Component.onCompleted: visible = false
- onYes: OutputDevice.deleteJobFromQueue(printJob.key)
- }
- }
-
- background: Item
- {
- width: popup.width
- height: popup.height
-
- DropShadow
- {
- anchors.fill: pointedRectangle
- radius: 5
- color: "#3F000000" // 25% shadow
- source: pointedRectangle
- transparentBorder: true
- verticalOffset: 2
- }
-
- Item
- {
- id: pointedRectangle
- width: parent.width - 10 * screenScaleFactor // Because of the shadow
- height: parent.height - 10 * screenScaleFactor // Because of the shadow
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
-
- Rectangle
- {
- id: point
- height: 14 * screenScaleFactor
- width: 14 * screenScaleFactor
- color: UM.Theme.getColor("setting_control")
- transform: Rotation { angle: 45}
- anchors.right: bloop.right
- anchors.rightMargin: 24
- y: 1
- }
-
- Rectangle
- {
- id: bloop
- color: UM.Theme.getColor("setting_control")
- width: parent.width
- anchors.top: parent.top
- anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
- }
- }
- }
-
- exit: Transition
- {
- NumberAnimation { property: "visible"; duration: 75; }
- }
- enter: Transition
- {
- NumberAnimation { property: "visible"; duration: 75; }
- }
-
- onClosed: visible = false
- onOpened: visible = true
+ MessageDialog {
+ id: abortConfirmationDialog;
+ Component.onCompleted: visible = false;
+ icon: StandardIcon.Warning;
+ onYes: printJob.setState("abort");
+ standardButtons: StandardButton.Yes | StandardButton.No;
+ text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "";
+ title: catalog.i18nc("@window:title", "Abort print");
}
// Utils
function switchPopupState() {
- popup.visible ? popup.close() : popup.open()
+ popup.visible ? popup.close() : popup.open();
+ }
+ function isRunning(job) {
+ if (!job) {
+ return false;
+ }
+ return ["paused", "printing", "pre_print"].indexOf(job.state) !== -1;
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
new file mode 100644
index 0000000000..e20f5fd1a1
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.2
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.4
+import UM 1.3 as UM
+
+Button {
+ background: Rectangle {
+ opacity: parent.down || parent.hovered ? 1 : 0;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ }
+ contentItem: Label {
+ text: parent.text
+ horizontalAlignment: Text.AlignLeft;
+ verticalAlignment: Text.AlignVCenter;
+ }
+ height: 39 * screenScaleFactor; // TODO: Theme!
+ hoverEnabled: true;
+ visible: enabled;
+ width: parent.width;
+}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
new file mode 100644
index 0000000000..7fae974d8f
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.3
+import QtQuick.Dialogs 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Styles 1.3
+import QtGraphicalEffects 1.0
+import QtQuick.Controls 1.4 as LegacyControls
+import UM 1.3 as UM
+
+// Includes print job name, owner, and preview
+
+Item {
+ property var job: null;
+ property var useUltibot: false;
+ height: 100;
+ width: height;
+
+ // Skeleton
+ Rectangle {
+ visible: !job;
+ anchors.fill: parent;
+ radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ }
+
+ // Actual content
+ Image {
+ id: previewImage;
+ visible: job;
+ source: job ? job.previewImageUrl : "";
+ opacity: {
+ if (job == null) {
+ return 1.0;
+ }
+ var states = ["wait_cleanup", "wait_user_action", "error", "paused"];
+ if (states.indexOf(job.state) !== -1) {
+ return 0.5;
+ }
+ return 1.0;
+ }
+ anchors.fill: parent;
+ }
+
+ UM.RecolorImage {
+ id: ultibotImage;
+ anchors.centerIn: parent;
+ source: "../svg/ultibot.svg";
+ /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
+ not in order to determine if we show the placeholder (ultibot) image instead. */
+ visible: job && previewImage.status == Image.Error;
+ width: parent.width;
+ height: parent.height;
+ sourceSize.width: width;
+ sourceSize.height: height;
+ color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
+ }
+
+ UM.RecolorImage {
+ id: statusImage;
+ anchors.centerIn: parent;
+ source: job && job.state == "error" ? "../svg/aborted-icon.svg" : "";
+ visible: source != "";
+ width: 0.5 * parent.width;
+ height: 0.5 * parent.height;
+ sourceSize.width: width;
+ sourceSize.height: height;
+ color: "black";
+ }
+}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
new file mode 100644
index 0000000000..604b5ce862
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
@@ -0,0 +1,53 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
+import QtQuick 2.3
+import QtQuick.Controls 2.0
+import UM 1.3 as UM
+
+Column {
+ property var job: null;
+ height: childrenRect.height;
+ spacing: Math.floor( UM.Theme.getSize("default_margin").height / 2); // TODO: Use explicit theme size
+ width: parent.width;
+
+ Item {
+ id: jobName;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width;
+
+ Rectangle {
+ visible: !job;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
+ height: parent.height;
+ width: parent.width / 3;
+ }
+ Label {
+ visible: job;
+ text: job ? job.name : "";
+ font: UM.Theme.getFont("default_bold");
+ elide: Text.ElideRight;
+ anchors.fill: parent;
+ }
+ }
+
+ Item {
+ id: ownerName;
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width;
+
+ Rectangle {
+ visible: !job;
+ color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
+ height: parent.height;
+ width: parent.width / 2;
+ }
+ Label {
+ visible: job;
+ text: job ? job.owner : "";
+ font: UM.Theme.getFont("default");
+ elide: Text.ElideRight;
+ anchors.fill: parent;
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index 3eec298bd2..29a90960ba 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -49,8 +49,8 @@ Item {
// Main card
Item {
id: mainCard;
- // color: "pink";
- height: childrenRect.height;
+ // I don't know why the extra height is needed but it is in order to look proportional.
+ height: childrenRect.height + 2;
width: parent.width;
// Machine icon
@@ -201,8 +201,7 @@ Item {
anchors.fill: parent;
enabled: printer;
onClicked: {
- console.log(model.index)
- if (root.collapsed && model) {
+ if (model && root.collapsed) {
printerList.currentIndex = model.index;
} else {
printerList.currentIndex = -1;
@@ -213,6 +212,9 @@ Item {
Connections {
target: printerList
onCurrentIndexChanged: {
+ if (!model) {
+ return;
+ }
root.collapsed = printerList.currentIndex != model.index;
}
}
@@ -221,8 +223,8 @@ Item {
// Detailed card
PrinterCardDetails {
collapsed: root.collapsed;
- printer: printer;
- visible: printer;
+ printer: root.printer;
+ visible: root.printer;
}
// Progress bar
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index 8cc10b5b6b..411c76d97a 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -7,10 +7,9 @@ import QtQuick.Controls 1.4 as LegacyControls
import UM 1.3 as UM
Item {
- id: root;
property var printer: null;
- property var printJob: printer.activePrintJob;
+ property var printJob: printer ? printer.activePrintJob : null;
property var collapsed: true;
Behavior on height { NumberAnimation { duration: 100 } }
@@ -21,350 +20,59 @@ Item {
opacity: collapsed ? 0 : 1;
Column {
- height: childrenRect.height;
+ id: contentColumn;
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ }
+ height: childrenRect.height + UM.Theme.getSize("wide_margin").height;
+ spacing: UM.Theme.getSize("default_margin").height;
width: parent.width;
- spacing: UM.Theme.getSize("default_margin").height;
-
- HorizontalLine { enabled: printer.state !== "disabled" }
+ HorizontalLine {}
PrinterInfoBlock {
printer: root.printer;
printJob: root.printer.activePrintJob;
}
- HorizontalLine { enabled: printer.state !== "disabled" }
+ HorizontalLine {}
- Rectangle {
- color: "orange";
+ Row {
width: parent.width;
- height: 100;
+ height: childrenRect.height;
+
+ PrintJobTitle {
+ job: root.printer.activePrintJob;
+ }
+ PrintJobContextMenu {
+ id: contextButton;
+ anchors {
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("wide_margin").width;
+ }
+ printJob: root.printer.activePrintJob;
+ visible: root.printer.activePrintJob;
+ }
}
+
- Item {
- id: jobInfoSection;
-
- property var job: root.printer ? root.printer.activePrintJob : null;
-
- Component.onCompleted: {
- console.log(job)
- }
- height: visible ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height : 0;
- width: parent.width;
- visible: job && job.state != "queued";
-
- anchors.left: parent.left;
- // anchors.right: contextButton.left;
- // anchors.rightMargin: UM.Theme.getSize("default_margin").width;
-
- Label {
- id: printJobName;
- elide: Text.ElideRight;
- font: UM.Theme.getFont("default_bold");
- text: job ? job.name : "";
- }
-
- Label {
- id: ownerName;
- anchors.top: job.bottom;
- elide: Text.ElideRight;
- font: UM.Theme.getFont("default");
- opacity: 0.6;
- text: job ? job.owner : "";
- width: parent.width;
- }
+ PrintJobPreview {
+ job: root.printer.activePrintJob;
+ anchors.horizontalCenter: parent.horizontalCenter;
}
}
+
+ CameraButton {
+ id: showCameraButton;
+ anchors {
+ bottom: contentColumn.bottom;
+ bottomMargin: Math.round(1.5 * UM.Theme.getSize("default_margin").height);
+ left: contentColumn.left;
+ leftMargin: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
+ }
+ iconSource: "../svg/camera-icon.svg";
+ }
}
-
-
-// Item {
-// id: jobInfo;
-// property var showJobInfo: {
-// return printer.activePrintJob != null && printer.activePrintJob.state != "queued"
-// }
-
-// // anchors {
-// // top: jobSpacer.bottom
-// // topMargin: 2 * UM.Theme.getSize("default_margin").height
-// // left: parent.left
-// // right: parent.right
-// // margins: UM.Theme.getSize("default_margin").width
-// // leftMargin: 2 * UM.Theme.getSize("default_margin").width
-// // }
-
-// height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height : 0;
-// visible: showJobInfo;
-
-
-// function switchPopupState()
-// {
-// popup.visible ? popup.close() : popup.open()
-// }
-
-// Button
-// {
-// id: contextButton
-// text: "\u22EE" //Unicode; Three stacked points.
-// width: 35
-// height: width
-// anchors
-// {
-// right: parent.right
-// top: parent.top
-// }
-// hoverEnabled: true
-
-// background: Rectangle
-// {
-// opacity: contextButton.down || contextButton.hovered ? 1 : 0
-// width: contextButton.width
-// height: contextButton.height
-// radius: 0.5 * width
-// color: UM.Theme.getColor("viewport_background")
-// }
-// contentItem: Label
-// {
-// text: contextButton.text
-// color: UM.Theme.getColor("monitor_tab_text_inactive")
-// font.pixelSize: 25
-// verticalAlignment: Text.AlignVCenter
-// horizontalAlignment: Text.AlignHCenter
-// }
-
-// onClicked: parent.switchPopupState()
-// }
-
-// Popup
-// {
-// // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
-// id: popup
-// clip: true
-// closePolicy: Popup.CloseOnPressOutside
-// x: (parent.width - width) + 26 * screenScaleFactor
-// y: contextButton.height - 5 * screenScaleFactor // Because shadow
-// width: 182 * screenScaleFactor
-// height: contentItem.height + 2 * padding
-// visible: false
-// padding: 5 * screenScaleFactor // Because shadow
-
-// transformOrigin: Popup.Top
-// contentItem: Item
-// {
-// width: popup.width
-// height: childrenRect.height + 36 * screenScaleFactor
-// anchors.topMargin: 10 * screenScaleFactor
-// anchors.bottomMargin: 10 * screenScaleFactor
-// Button
-// {
-// id: pauseButton
-// text: printer.activePrintJob != null && printer.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
-// onClicked:
-// {
-// if(printer.activePrintJob.state == "paused")
-// {
-// printer.activePrintJob.setState("print")
-// }
-// else if(printer.activePrintJob.state == "printing")
-// {
-// printer.activePrintJob.setState("pause")
-// }
-// popup.close()
-// }
-// width: parent.width
-// enabled: printer.activePrintJob != null && ["paused", "printing"].indexOf(printer.activePrintJob.state) >= 0
-// visible: enabled
-// anchors.top: parent.top
-// anchors.topMargin: 18 * screenScaleFactor
-// height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
-// hoverEnabled: true
-// background: Rectangle
-// {
-// opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
-// color: UM.Theme.getColor("viewport_background")
-// }
-// contentItem: Label
-// {
-// text: pauseButton.text
-// horizontalAlignment: Text.AlignLeft
-// verticalAlignment: Text.AlignVCenter
-// }
-// }
-
-// Button
-// {
-// id: abortButton
-// text: catalog.i18nc("@label", "Abort")
-// onClicked:
-// {
-// abortConfirmationDialog.visible = true;
-// popup.close();
-// }
-// width: parent.width
-// height: 39 * screenScaleFactor
-// anchors.top: pauseButton.bottom
-// hoverEnabled: true
-// enabled: printer.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(printer.activePrintJob.state) >= 0
-// background: Rectangle
-// {
-// opacity: abortButton.down || abortButton.hovered ? 1 : 0
-// color: UM.Theme.getColor("viewport_background")
-// }
-// contentItem: Label
-// {
-// text: abortButton.text
-// horizontalAlignment: Text.AlignLeft
-// verticalAlignment: Text.AlignVCenter
-// }
-// }
-
-// MessageDialog
-// {
-// id: abortConfirmationDialog
-// title: catalog.i18nc("@window:title", "Abort print")
-// icon: StandardIcon.Warning
-// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printer.activePrintJob.name)
-// standardButtons: StandardButton.Yes | StandardButton.No
-// Component.onCompleted: visible = false
-// onYes: printer.activePrintJob.setState("abort")
-// }
-// }
-
-// background: Item
-// {
-// width: popup.width
-// height: popup.height
-
-// DropShadow
-// {
-// anchors.fill: pointedRectangle
-// radius: 5
-// color: "#3F000000" // 25% shadow
-// source: pointedRectangle
-// transparentBorder: true
-// verticalOffset: 2
-// }
-
-// Item
-// {
-// id: pointedRectangle
-// width: parent.width - 10 * screenScaleFactor // Because of the shadow
-// height: parent.height - 10 * screenScaleFactor // Because of the shadow
-// anchors.horizontalCenter: parent.horizontalCenter
-// anchors.verticalCenter: parent.verticalCenter
-
-// Rectangle
-// {
-// id: point
-// height: 14 * screenScaleFactor
-// width: 14 * screenScaleFactor
-// color: UM.Theme.getColor("setting_control")
-// transform: Rotation { angle: 45}
-// anchors.right: bloop.right
-// anchors.rightMargin: 24
-// y: 1
-// }
-
-// Rectangle
-// {
-// id: bloop
-// color: UM.Theme.getColor("setting_control")
-// width: parent.width
-// anchors.top: parent.top
-// anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
-// anchors.bottom: parent.bottom
-// anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
-// }
-// }
-// }
-
-// exit: Transition
-// {
-// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
-// NumberAnimation { property: "visible"; duration: 75; }
-// }
-// enter: Transition
-// {
-// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
-// NumberAnimation { property: "visible"; duration: 75; }
-// }
-
-// onClosed: visible = false
-// onOpened: visible = true
-// }
-
-// Image
-// {
-// id: printJobPreview
-// source: printer.activePrintJob != null ? printer.activePrintJob.previewImageUrl : ""
-// anchors.top: ownerName.bottom
-// anchors.horizontalCenter: parent.horizontalCenter
-// width: parent.width / 2
-// height: width
-// opacity:
-// {
-// if(printer.activePrintJob == null)
-// {
-// return 1.0
-// }
-
-// switch(printer.activePrintJob.state)
-// {
-// case "wait_cleanup":
-// case "wait_user_action":
-// case "paused":
-// return 0.5
-// default:
-// return 1.0
-// }
-// }
-
-
-// }
-
-// UM.RecolorImage
-// {
-// id: statusImage
-// anchors.centerIn: printJobPreview
-// source:
-// {
-// if(printer.activePrintJob == null)
-// {
-// return ""
-// }
-// switch(printer.activePrintJob.state)
-// {
-// case "paused":
-// return "../svg/paused-icon.svg"
-// case "wait_cleanup":
-// if(printer.activePrintJob.timeElapsed < printer.activePrintJob.timeTotal)
-// {
-// return "../svg/aborted-icon.svg"
-// }
-// return "../svg/approved-icon.svg"
-// case "wait_user_action":
-// return "../svg/aborted-icon.svg"
-// default:
-// return ""
-// }
-// }
-// visible: source != ""
-// width: 0.5 * printJobPreview.width
-// height: 0.5 * printJobPreview.height
-// sourceSize.width: width
-// sourceSize.height: height
-// color: "black"
-// }
-
-// CameraButton
-// {
-// id: showCameraButton
-// iconSource: "../svg/camera-icon.svg"
-// anchors
-// {
-// left: parent.left
-// bottom: printJobPreview.bottom
-// }
-// }
-// }
-// }
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
index 1b3a83d024..d116df8b28 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -24,8 +24,7 @@ Item {
anchors {
left: parent.left;
right: parent.right;
- bottom: extrudersInfo.top;
- bottomMargin: UM.Theme.getSize("default_margin").height;
+
}
height: childrenRect.height;
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
@@ -52,6 +51,8 @@ Item {
left: parent.left;
right: parent.right;
rightMargin: UM.Theme.getSize("default_margin").width;
+ top: printerFamilyPills.bottom;
+ topMargin: UM.Theme.getSize("default_margin").height;
}
height: childrenRect.height;
spacing: UM.Theme.getSize("default_margin").width;
From 00ce3b0083fd159b2903b1021dc80e2db1e0c101 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 1 Oct 2018 16:32:30 +0200
Subject: [PATCH 12/31] Review feedback
Contributes to CL-1051
---
.../resources/qml/PrintJobInfoBlock.qml | 17 ++++++-----------
.../resources/qml/PrinterInfoBlock.qml | 10 ++++------
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 8a6a6d297c..c97f16b29c 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -48,15 +48,13 @@ Item {
height: childrenRect.height;
// Main content
- Rectangle {
+ Item {
id: mainContent;
- color: root.debug ? "red" : "transparent";
width: parent.width;
height: 200; // TODO: Theme!
// Left content
- Rectangle {
- color: root.debug ? "lightblue" : "transparent";
+ Item {
anchors {
left: parent.left;
right: parent.horizontalCenter;
@@ -179,8 +177,7 @@ Item {
}
// Right content
- Rectangle {
- color: root.debug ? "blue" : "transparent";
+ Item {
anchors {
left: parent.horizontalCenter;
right: parent.right;
@@ -238,7 +235,7 @@ Item {
}
}
- Rectangle {
+ Item {
id: configChangesBox;
width: parent.width;
height: childrenRect.height;
@@ -322,9 +319,8 @@ Item {
}
// Config change details
- Rectangle {
+ Item {
id: configChangeDetails;
- color: "transparent";
width: parent.width;
visible: false;
// In case of really massive multi-line configuration changes
@@ -332,8 +328,7 @@ Item {
Behavior on height { NumberAnimation { duration: 100 } }
anchors.top: configChangeToggle.bottom;
- Rectangle {
- color: "transparent";
+ Item {
clip: true;
anchors {
fill: parent;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
index d116df8b28..ded249b9c9 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -73,12 +73,10 @@ Item {
if (root.printJob) {
// Use more-specific print job if possible
return root.printJob.configuration.extruderConfigurations[i];
- } else {
- if (root.printer) {
- return root.printer.printerConfiguration.extruderConfigurations[i];
- } else {
- return null;
- }
}
+ if (root.printer) {
+ return root.printer.printerConfiguration.extruderConfigurations[i];
+ }
+ return null;
}
}
\ No newline at end of file
From ae9faadca6d6587e711cc0915da5a92808d3a584 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 1 Oct 2018 16:36:22 +0200
Subject: [PATCH 13/31] Add i18nc string
Contributes to CL-1051
---
plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index c97f16b29c..9bee5499da 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -285,7 +285,7 @@ Item {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
}
- text: "Configuration change"; // TODO: i18n!
+ text: catalog.i18nc("@label", "Configuration change");
}
UM.RecolorImage {
From 82cddf07ad469ccec269999584ee07e2f47f53eb Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 1 Oct 2018 17:12:05 +0200
Subject: [PATCH 14/31] Move ConfigurationChangeModel to plugin
Contributes to CL-897
---
cura/PrinterOutput/PrintJobOutputModel.py | 17 +----------
.../src/ClusterUM3OutputDevice.py | 24 +++++++--------
.../src}/ConfigurationChangeModel.py | 0
.../src/UM3PrintJobOutputModel.py | 29 +++++++++++++++++++
4 files changed, 42 insertions(+), 28 deletions(-)
rename {cura/PrinterOutput => plugins/UM3NetworkPrinting/src}/ConfigurationChangeModel.py (100%)
create mode 100644 plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py
diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py
index c194f5df32..ce3c20fcfb 100644
--- a/cura/PrinterOutput/PrintJobOutputModel.py
+++ b/cura/PrinterOutput/PrintJobOutputModel.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Ultimaker B.V.
+# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
@@ -12,9 +12,6 @@ if TYPE_CHECKING:
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel
-from cura.PrinterOutput.ConfigurationChangeModel import ConfigurationChangeModel
-
-
class PrintJobOutputModel(QObject):
stateChanged = pyqtSignal()
timeTotalChanged = pyqtSignal()
@@ -26,7 +23,6 @@ class PrintJobOutputModel(QObject):
configurationChanged = pyqtSignal()
previewImageChanged = pyqtSignal()
compatibleMachineFamiliesChanged = pyqtSignal()
- configurationChangesChanged = pyqtSignal()
def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None:
super().__init__(parent)
@@ -44,7 +40,6 @@ class PrintJobOutputModel(QObject):
self._preview_image_id = 0
self._preview_image = None # type: Optional[QImage]
- self._configuration_changes = [] # type: List[ConfigurationChangeModel]
@pyqtProperty("QStringList", notify=compatibleMachineFamiliesChanged)
def compatibleMachineFamilies(self):
@@ -152,13 +147,3 @@ class PrintJobOutputModel(QObject):
@pyqtSlot(str)
def setState(self, state):
self._output_controller.setJobState(self, state)
-
- @pyqtProperty("QVariantList", notify=configurationChangesChanged)
- def configurationChanges(self) -> List[ConfigurationChangeModel]:
- return self._configuration_changes
-
- def updateConfigurationChanges(self, changes: List[ConfigurationChangeModel]) -> None:
- if len(self._configuration_changes) == 0 and len(changes) == 0:
- return
- self._configuration_changes = changes
- self.configurationChangesChanged.emit()
diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
index 79040373ae..88ac1c1e76 100644
--- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
+++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
@@ -17,17 +17,17 @@ from UM.Scene.SceneNode import SceneNode # For typing.
from UM.Version import Version # To check against firmware versions for support.
from cura.CuraApplication import CuraApplication
-from cura.PrinterOutput.ConfigurationChangeModel import ConfigurationChangeModel
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
-from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel
from cura.PrinterOutput.NetworkCamera import NetworkCamera
from .ClusterUM3PrinterOutputController import ClusterUM3PrinterOutputController
from .SendMaterialJob import SendMaterialJob
+from .ConfigurationChangeModel import ConfigurationChangeModel
+from .UM3PrintJobOutputModel import UM3PrintJobOutputModel
from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
from PyQt5.QtGui import QDesktopServices, QImage
@@ -61,7 +61,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._dummy_lambdas = ("", {}, io.BytesIO()) #type: Tuple[str, Dict, Union[io.StringIO, io.BytesIO]]
- self._print_jobs = [] # type: List[PrintJobOutputModel]
+ self._print_jobs = [] # type: List[UM3PrintJobOutputModel]
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterMonitorItem.qml")
self._control_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterControlItem.qml")
@@ -91,7 +91,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._printer_uuid_to_unique_name_mapping = {} # type: Dict[str, str]
- self._finished_jobs = [] # type: List[PrintJobOutputModel]
+ self._finished_jobs = [] # type: List[UM3PrintJobOutputModel]
self._cluster_size = int(properties.get(b"cluster_size", 0)) # type: int
@@ -350,15 +350,15 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
QDesktopServices.openUrl(QUrl("http://" + self._address + "/printers"))
@pyqtProperty("QVariantList", notify = printJobsChanged)
- def printJobs(self)-> List[PrintJobOutputModel]:
+ def printJobs(self)-> List[UM3PrintJobOutputModel]:
return self._print_jobs
@pyqtProperty("QVariantList", notify = printJobsChanged)
- def queuedPrintJobs(self) -> List[PrintJobOutputModel]:
+ def queuedPrintJobs(self) -> List[UM3PrintJobOutputModel]:
return [print_job for print_job in self._print_jobs if print_job.state == "queued" or print_job.state == "error"]
@pyqtProperty("QVariantList", notify = printJobsChanged)
- def activePrintJobs(self) -> List[PrintJobOutputModel]:
+ def activePrintJobs(self) -> List[UM3PrintJobOutputModel]:
return [print_job for print_job in self._print_jobs if print_job.assignedPrinter is not None and print_job.state != "queued"]
@pyqtProperty("QVariantList", notify = clusterPrintersChanged)
@@ -543,8 +543,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._printers.append(printer)
return printer
- def _createPrintJobModel(self, data: Dict[str, Any]) -> PrintJobOutputModel:
- print_job = PrintJobOutputModel(output_controller=ClusterUM3PrinterOutputController(self),
+ def _createPrintJobModel(self, data: Dict[str, Any]) -> UM3PrintJobOutputModel:
+ print_job = UM3PrintJobOutputModel(output_controller=ClusterUM3PrinterOutputController(self),
key=data["uuid"], name= data["name"])
configuration = ConfigurationModel()
@@ -564,7 +564,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
print_job.stateChanged.connect(self._printJobStateChanged)
return print_job
- def _updatePrintJob(self, print_job: PrintJobOutputModel, data: Dict[str, Any]) -> None:
+ def _updatePrintJob(self, print_job: UM3PrintJobOutputModel, data: Dict[str, Any]) -> None:
print_job.updateTimeTotal(data["time_total"])
print_job.updateTimeElapsed(data["time_elapsed"])
impediments_to_printing = data.get("impediments_to_printing", [])
@@ -647,7 +647,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
material = self._createMaterialOutputModel(material_data)
extruder.updateActiveMaterial(material)
- def _removeJob(self, job: PrintJobOutputModel) -> bool:
+ def _removeJob(self, job: UM3PrintJobOutputModel) -> bool:
if job not in self._print_jobs:
return False
@@ -691,7 +691,7 @@ def checkValidGetReply(reply: QNetworkReply) -> bool:
return True
-def findByKey(lst: List[Union[PrintJobOutputModel, PrinterOutputModel]], key: str) -> Optional[PrintJobOutputModel]:
+def findByKey(lst: List[Union[UM3PrintJobOutputModel, PrinterOutputModel]], key: str) -> Optional[UM3PrintJobOutputModel]:
for item in lst:
if item.key == key:
return item
diff --git a/cura/PrinterOutput/ConfigurationChangeModel.py b/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py
similarity index 100%
rename from cura/PrinterOutput/ConfigurationChangeModel.py
rename to plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py
diff --git a/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py b/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py
new file mode 100644
index 0000000000..2ac3e6ba4f
--- /dev/null
+++ b/plugins/UM3NetworkPrinting/src/UM3PrintJobOutputModel.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2018 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
+
+from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
+from typing import Optional, TYPE_CHECKING, List
+from PyQt5.QtCore import QUrl
+from PyQt5.QtGui import QImage
+
+from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
+
+from .ConfigurationChangeModel import ConfigurationChangeModel
+
+
+class UM3PrintJobOutputModel(PrintJobOutputModel):
+ configurationChangesChanged = pyqtSignal()
+
+ def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None:
+ super().__init__(output_controller, key, name, parent)
+ self._configuration_changes = [] # type: List[ConfigurationChangeModel]
+
+ @pyqtProperty("QVariantList", notify=configurationChangesChanged)
+ def configurationChanges(self) -> List[ConfigurationChangeModel]:
+ return self._configuration_changes
+
+ def updateConfigurationChanges(self, changes: List[ConfigurationChangeModel]) -> None:
+ if len(self._configuration_changes) == 0 and len(changes) == 0:
+ return
+ self._configuration_changes = changes
+ self.configurationChangesChanged.emit()
From 2c5095befb5b0eda3e39130fa097839ae43d5c02 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 3 Oct 2018 09:43:13 +0200
Subject: [PATCH 15/31] Add copyright headers
---
plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml | 3 +++
.../UM3NetworkPrinting/resources/qml/ClusterControlItem.qml | 3 +++
.../UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml | 3 +++
.../resources/qml/ConfigurationChangeBlock.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml | 3 +++
.../resources/qml/PrintCoreConfiguration.qml | 3 +++
.../UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml | 3 +++
.../resources/qml/PrintJobContextMenuItem.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml | 3 +++
.../UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml | 3 +++
.../resources/qml/PrinterCardProgressBar.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml | 3 +++
.../UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml | 3 +++
plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml | 3 +++
19 files changed, 57 insertions(+)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
index 1ceebccf89..c8c40541bc 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.3
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
index 3dfabdfb86..a42d8a2d6c 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index a027043b85..06b8e9f2be 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index 48e2e9ce3c..f4eda3f75c 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml
index b5b80a3010..58443115a9 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import UM 1.2 as UM
import Cura 1.0 as Cura
diff --git a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
index fcf2330fe7..e9cee177fa 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Controls 2.0
import UM 1.3 as UM
diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
index bbbc3feee6..091b1fc1fa 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index 289b3f3f00..151ae7ab36 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 8d523c322a..0c185386b2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
index e20f5fd1a1..3a55978a3f 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 9bee5499da..4ffcb8342e 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
index 7fae974d8f..2bec0906a8 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index 29a90960ba..c13a4c4b93 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index 411c76d97a..7cce0d5c0d 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
index a89ffd51d8..809a3c651a 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Controls.Styles 1.3
import QtQuick.Controls 1.4
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
index 24bc82224d..118da2f42b 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Controls 1.4
import UM 1.2 as UM
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
index ded249b9c9..51d9e1f462 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.3
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
index d0213a4571..5e5c972fbe 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
diff --git a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
index a19d1be60d..6af4b2c6a6 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
@@ -1,3 +1,6 @@
+// Copyright (c) 2018 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
import UM 1.2 as UM
import Cura 1.0 as Cura
From 5ca0c599e928394435c8f8d88d38cd1a649deef7 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 3 Oct 2018 10:55:38 +0200
Subject: [PATCH 16/31] Review feedback
Now with unified style as agreed upon by Simon & Ian.
Rules:
- ID before all other props.
- All props before children.
- All props after ID in alphabetical order.
- Empty line between children.
- Semi-colons.
Note: I didn't touch the DiscoverUM3Action because that's it's whole own UI part.
---
.../resources/qml/CameraButton.qml | 57 ++---
.../resources/qml/ClusterControlItem.qml | 170 ++++++-------
.../resources/qml/ClusterMonitorItem.qml | 228 +++++++++---------
.../qml/ConfigurationChangeBlock.qml | 77 +++---
.../resources/qml/MonitorItem.qml | 63 ++---
.../resources/qml/PrintCoreConfiguration.qml | 49 ++--
.../resources/qml/PrintJobContextMenu.qml | 24 +-
.../resources/qml/PrintJobInfoBlock.qml | 170 ++++++-------
.../resources/qml/PrintJobPreview.qml | 26 +-
.../resources/qml/PrintJobTitle.qml | 22 +-
.../resources/qml/PrintWindow.qml | 171 ++++++-------
.../resources/qml/PrinterCard.qml | 29 +--
.../resources/qml/PrinterCardDetails.qml | 7 +-
.../resources/qml/PrinterCardProgressBar.qml | 121 ++++------
.../resources/qml/PrinterFamilyPill.qml | 37 +--
.../resources/qml/PrinterInfoBlock.qml | 13 +-
.../resources/qml/PrinterVideoStream.qml | 96 +++-----
.../resources/qml/UM3InfoComponents.qml | 182 +++++++-------
18 files changed, 721 insertions(+), 821 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
index c8c40541bc..4b78448a8d 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
@@ -4,46 +4,37 @@
import QtQuick 2.3
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.3
-import QtQuick.Controls 2.0 as Controls2
-import QtGraphicalEffects 1.0
-
import UM 1.3 as UM
import Cura 1.0 as Cura
-Rectangle
-{
- property var iconSource: null
+Rectangle {
+ property var iconSource: null;
+ color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary");
+ height: width;
+ radius: 0.5 * width;
+ width: 36 * screenScaleFactor;
- width: 36 * screenScaleFactor
- height: width
- radius: 0.5 * width
- color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary")
-
- UM.RecolorImage
- {
- id: icon
- width: parent.width / 2
- height: width
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- color: UM.Theme.getColor("primary_text")
- source: iconSource
+ UM.RecolorImage {
+ id: icon;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ color: UM.Theme.getColor("primary_text");
+ height: width;
+ source: iconSource;
+ width: parent.width / 2;
}
- MouseArea
- {
- id: clickArea
- anchors.fill:parent
- hoverEnabled: true
- onClicked:
- {
- if (OutputDevice.activeCamera !== null)
- {
+ MouseArea {
+ id: clickArea;
+ anchors.fill: parent;
+ hoverEnabled: true;
+ onClicked: {
+ if (OutputDevice.activeCamera !== null) {
OutputDevice.setActiveCamera(null)
- }
- else
- {
- OutputDevice.setActiveCamera(modelData.camera)
+ } else {
+ OutputDevice.setActiveCamera(modelData.camera);
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
index a42d8a2d6c..3da155cfad 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
@@ -2,130 +2,108 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.3
-import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.3
-import QtGraphicalEffects 1.0
-
-import QtQuick.Controls 2.0 as Controls2
-
import UM 1.3 as UM
import Cura 1.0 as Cura
+Component {
+ Rectangle {
+ id: base;
+ property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme.
+ property var shadowRadius: 5 * screenScaleFactor;
+ property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme.
+ anchors.fill: parent;
+ color: "white";
+ visible: OutputDevice != null;
-Component
-{
- Rectangle
- {
- id: base
- property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
- property var shadowRadius: 5 * screenScaleFactor
- property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
- visible: OutputDevice != null
- anchors.fill: parent
- color: "white"
-
- UM.I18nCatalog
- {
- id: catalog
- name: "cura"
+ UM.I18nCatalog {
+ id: catalog;
+ name: "cura";
}
- Label
- {
- id: printingLabel
- font: UM.Theme.getFont("large")
- anchors
- {
- margins: 2 * UM.Theme.getSize("default_margin").width
- leftMargin: 4 * UM.Theme.getSize("default_margin").width
- top: parent.top
- left: parent.left
- right: parent.right
+ Label {
+ id: printingLabel;
+ anchors {
+ left: parent.left;
+ leftMargin: 4 * UM.Theme.getSize("default_margin").width;
+ margins: 2 * UM.Theme.getSize("default_margin").width;
+ right: parent.right;
+ top: parent.top;
}
-
- text: catalog.i18nc("@label", "Printing")
- elide: Text.ElideRight
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("large");
+ text: catalog.i18nc("@label", "Printing");
}
- Label
- {
- id: managePrintersLabel
- anchors.rightMargin: 4 * UM.Theme.getSize("default_margin").width
- anchors.right: printerScrollView.right
- anchors.bottom: printingLabel.bottom
- text: catalog.i18nc("@label link to connect manager", "Manage printers")
- font: UM.Theme.getFont("default")
- color: UM.Theme.getColor("primary")
- linkColor: UM.Theme.getColor("primary")
+ Label {
+ id: managePrintersLabel;
+ anchors {
+ bottom: printingLabel.bottom;
+ right: printerScrollView.right;
+ rightMargin: 4 * UM.Theme.getSize("default_margin").width;
+ }
+ color: UM.Theme.getColor("primary");
+ font: UM.Theme.getFont("default");
+ linkColor: UM.Theme.getColor("primary");
+ text: catalog.i18nc("@label link to connect manager", "Manage printers");
}
- MouseArea
- {
- anchors.fill: managePrintersLabel
- hoverEnabled: true
- onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel()
- onEntered: managePrintersLabel.font.underline = true
- onExited: managePrintersLabel.font.underline = false
+ MouseArea {
+ anchors.fill: managePrintersLabel;
+ hoverEnabled: true;
+ onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel();
+ onEntered: managePrintersLabel.font.underline = true;
+ onExited: managePrintersLabel.font.underline = false;
}
// Skeleton loading
- Column
- {
- id: skeletonLoader
+ Column {
+ id: skeletonLoader;
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("wide_margin").width;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("wide_margin").width;
+ top: printingLabel.bottom;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ }
+ spacing: UM.Theme.getSize("default_margin").height - 10;
visible: printerList.count === 0;
- anchors
- {
- top: printingLabel.bottom
- topMargin: UM.Theme.getSize("default_margin").height
- left: parent.left
- leftMargin: UM.Theme.getSize("wide_margin").width
- right: parent.right
- rightMargin: UM.Theme.getSize("wide_margin").width
- }
- spacing: UM.Theme.getSize("default_margin").height - 10
- PrinterCard
- {
- printer: null
+ PrinterCard {
+ printer: null;
}
- PrinterCard
- {
- printer: null
+ PrinterCard {
+ printer: null;
}
}
// Actual content
- ScrollView
- {
- id: printerScrollView
- anchors
- {
- top: printingLabel.bottom
- topMargin: UM.Theme.getSize("default_margin").height
- left: parent.left
- right: parent.right
+ ScrollView {
+ id: printerScrollView;
+ anchors {
bottom: parent.bottom;
+ left: parent.left;
+ right: parent.right;
+ top: printingLabel.bottom;
+ topMargin: UM.Theme.getSize("default_margin").height;
}
+ style: UM.Theme.styles.scrollview;
- style: UM.Theme.styles.scrollview
-
- ListView
- {
- id: printerList
- property var currentIndex: -1
- anchors
- {
- fill: parent
- leftMargin: UM.Theme.getSize("wide_margin").width
- rightMargin: UM.Theme.getSize("wide_margin").width
+ ListView {
+ id: printerList;
+ property var currentIndex: -1;
+ anchors {
+ fill: parent;
+ leftMargin: UM.Theme.getSize("wide_margin").width;
+ rightMargin: UM.Theme.getSize("wide_margin").width;
}
- spacing: UM.Theme.getSize("default_margin").height - 10
- model: OutputDevice.printers
- delegate: PrinterCard
- {
- printer: modelData
+ delegate: PrinterCard {
+ printer: modelData;
}
+ model: OutputDevice.printers;
+ spacing: UM.Theme.getSize("default_margin").height - 10;
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index 06b8e9f2be..778a6da2eb 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -4,141 +4,129 @@
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
-
import UM 1.3 as UM
import Cura 1.0 as Cura
-Component
-{
- Rectangle
- {
- id: monitorFrame
- width: maximumWidth
- height: maximumHeight
- color: UM.Theme.getColor("viewport_background")
- property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight")
- property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
- property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
-
- UM.I18nCatalog
- {
- id: catalog
- name: "cura"
- }
-
- Label
- {
- id: manageQueueLabel
- anchors.rightMargin: 3 * UM.Theme.getSize("default_margin").width
- anchors.right: queuedPrintJobs.right
- anchors.bottom: queuedLabel.bottom
- text: catalog.i18nc("@label link to connect manager", "Manage queue")
- font: UM.Theme.getFont("default")
- color: UM.Theme.getColor("primary")
- linkColor: UM.Theme.getColor("primary")
- }
-
- MouseArea
- {
- anchors.fill: manageQueueLabel
- hoverEnabled: true
- onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel()
- onEntered: manageQueueLabel.font.underline = true
- onExited: manageQueueLabel.font.underline = false
- }
-
- Label
- {
- id: queuedLabel
- anchors.left: queuedPrintJobs.left
- anchors.top: parent.top
- anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
- anchors.leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5
- text: catalog.i18nc("@label", "Queued")
- font: UM.Theme.getFont("large")
- color: UM.Theme.getColor("text")
- }
-
- Column
- {
- id: skeletonLoader
- visible: printJobList.count === 0;
- width: Math.min(800 * screenScaleFactor, maximumWidth)
- anchors
- {
- top: queuedLabel.bottom
- topMargin: UM.Theme.getSize("default_margin").height
- horizontalCenter: parent.horizontalCenter
- bottomMargin: UM.Theme.getSize("default_margin").height
- bottom: parent.bottom
- }
- PrintJobInfoBlock
- {
- printJob: null // Use as skeleton
- anchors
- {
- left: parent.left
- right: parent.right
- rightMargin: UM.Theme.getSize("default_margin").width
- leftMargin: UM.Theme.getSize("default_margin").width
- }
- }
- PrintJobInfoBlock
- {
- printJob: null // Use as skeleton
- anchors
- {
- left: parent.left
- right: parent.right
- rightMargin: UM.Theme.getSize("default_margin").width
- leftMargin: UM.Theme.getSize("default_margin").width
- }
+Component {
+ Rectangle {
+ id: monitorFrame;
+ property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight");
+ property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme.
+ property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme.
+ color: UM.Theme.getColor("viewport_background");
+ height: maximumHeight;
+ onVisibleChanged: {
+ if (monitorFrame != null && !monitorFrame.visible) {
+ OutputDevice.setActiveCamera(null);
}
}
+ width: maximumWidth;
- ScrollView
- {
- id: queuedPrintJobs
+ UM.I18nCatalog {
+ id: catalog;
+ name: "cura";
+ }
+
+ Label {
+ id: manageQueueLabel;
anchors {
- top: queuedLabel.bottom
- topMargin: UM.Theme.getSize("default_margin").height
- horizontalCenter: parent.horizontalCenter
- bottomMargin: UM.Theme.getSize("default_margin").height
- bottom: parent.bottom
+ bottom: queuedLabel.bottom;
+ right: queuedPrintJobs.right;
+ rightMargin: 3 * UM.Theme.getSize("default_margin").width;
}
- style: UM.Theme.styles.scrollview
- width: Math.min(800 * screenScaleFactor, maximumWidth)
+ color: UM.Theme.getColor("primary");
+ font: UM.Theme.getFont("default");
+ linkColor: UM.Theme.getColor("primary");
+ text: catalog.i18nc("@label link to connect manager", "Manage queue");
+ }
- ListView
- {
- id: printJobList;
- anchors.fill: parent
- spacing: UM.Theme.getSize("default_margin").height - 10 // 2x the shadow radius
- model: OutputDevice.queuedPrintJobs
- delegate: PrintJobInfoBlock
- {
- printJob: modelData
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.rightMargin: UM.Theme.getSize("default_margin").width
- anchors.leftMargin: UM.Theme.getSize("default_margin").width
+ MouseArea {
+ anchors.fill: manageQueueLabel;
+ hoverEnabled: true;
+ onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel();
+ onEntered: manageQueueLabel.font.underline = true;
+ onExited: manageQueueLabel.font.underline = false;
+ }
+
+ Label {
+ id: queuedLabel;
+ anchors {
+ left: queuedPrintJobs.left;
+ leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5;
+ top: parent.top;
+ topMargin: 2 * UM.Theme.getSize("default_margin").height;
+ }
+ color: UM.Theme.getColor("text");
+ font: UM.Theme.getFont("large");
+ text: catalog.i18nc("@label", "Queued");
+ }
+
+ Column {
+ id: skeletonLoader;
+ anchors {
+ bottom: parent.bottom;
+ bottomMargin: UM.Theme.getSize("default_margin").height;
+ horizontalCenter: parent.horizontalCenter;
+ top: queuedLabel.bottom;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ }
+ visible: printJobList.count === 0;
+ width: Math.min(800 * screenScaleFactor, maximumWidth);
+
+ PrintJobInfoBlock {
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
}
+ printJob: null; // Use as skeleton
+ }
+
+ PrintJobInfoBlock {
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ }
+ printJob: null; // Use as skeleton
}
}
- PrinterVideoStream
- {
- visible: OutputDevice.activeCamera != null
- anchors.fill: parent
- camera: OutputDevice.activeCamera
+ ScrollView {
+ id: queuedPrintJobs;
+ anchors {
+ top: queuedLabel.bottom;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ horizontalCenter: parent.horizontalCenter;
+ bottomMargin: UM.Theme.getSize("default_margin").height;
+ bottom: parent.bottom;
+ }
+ style: UM.Theme.styles.scrollview;
+ width: Math.min(800 * screenScaleFactor, maximumWidth);
+
+ ListView {
+ id: printJobList;
+ anchors.fill: parent;
+ delegate: PrintJobInfoBlock; {
+ anchors {
+ left: parent.left;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ right: parent.right;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ }
+ printJob: modelData;
+ }
+ model: OutputDevice.queuedPrintJobs;
+ spacing: UM.Theme.getSize("default_margin").height - 10; // 2x the shadow radius
+ }
}
- onVisibleChanged:
- {
- if (monitorFrame != null && !monitorFrame.visible)
- {
- OutputDevice.setActiveCamera(null)
- }
+ PrinterVideoStream {
+ anchors.fill: parent;
+ camera: OutputDevice.activeCamera;
+ visible: OutputDevice.activeCamera != null;
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index f4eda3f75c..250449a763 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -10,7 +10,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import UM 1.3 as UM
-Rectangle {
+Item {
id: root;
property var job: null;
property var materialsAreKnown: {
@@ -24,7 +24,6 @@ Rectangle {
}
return true;
}
- color: "pink";
width: parent.width;
height: childrenRect.height;
@@ -34,6 +33,11 @@ Rectangle {
// Config change toggle
Rectangle {
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ top: parent.top;
+ }
color: {
if(configurationChangeToggle.containsMouse) {
return UM.Theme.getColor("viewport_background"); // TODO: Theme!
@@ -41,32 +45,29 @@ Rectangle {
return "transparent";
}
}
- width: parent.width;
height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme!
- anchors {
- left: parent.left;
- right: parent.right;
- top: parent.top;
- }
+ width: parent.width;
Rectangle {
- width: parent.width;
- height: UM.Theme.getSize("default_lining").height;
color: "#e6e6e6"; // TODO: Theme!
+ height: UM.Theme.getSize("default_lining").height;
+ width: parent.width;
}
UM.RecolorImage {
- width: 23; // TODO: Theme!
- height: 23; // TODO: Theme!
anchors {
right: configChangeToggleLabel.left;
rightMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter;
}
- sourceSize.width: width;
- sourceSize.height: height;
- source: "../svg/warning-icon.svg";
color: UM.Theme.getColor("text");
+ height: 23 * screenScaleFactor; // TODO: Theme!
+ source: "../svg/warning-icon.svg";
+ sourceSize {
+ width: width;
+ height: height;
+ }
+ width: 23 * screenScaleFactor; // TODO: Theme!
}
Label {
@@ -79,15 +80,13 @@ Rectangle {
}
UM.RecolorImage {
- width: 15; // TODO: Theme!
- height: 15; // TODO: Theme!
anchors {
left: configChangeToggleLabel.right;
leftMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter;
}
- sourceSize.width: width;
- sourceSize.height: height;
+ color: UM.Theme.getColor("text");
+ height: 15 * screenScaleFactor; // TODO: Theme!
source: {
if (configChangeDetails.visible) {
return UM.Theme.getIcon("arrow_top");
@@ -95,7 +94,11 @@ Rectangle {
return UM.Theme.getIcon("arrow_bottom");
}
}
- color: UM.Theme.getColor("text");
+ sourceSize {
+ width: width;
+ height: height;
+ }
+ width: 15 * screenScaleFactor; // TODO: Theme!
}
MouseArea {
@@ -111,26 +114,25 @@ Rectangle {
// Config change details
Rectangle {
id: configChangeDetails
- color: "transparent";
- width: parent.width;
- visible: false;
- height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0;
Behavior on height { NumberAnimation { duration: 100 } }
+ color: "transparent";
+ height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0;
+ visible: false;
+ width: parent.width;
Rectangle {
- color: "transparent";
- clip: true;
anchors {
- fill: parent;
- topMargin: UM.Theme.getSize("wide_margin").height;
bottomMargin: UM.Theme.getSize("wide_margin").height;
+ fill: parent;
leftMargin: UM.Theme.getSize("wide_margin").height * 4;
rightMargin: UM.Theme.getSize("wide_margin").height * 4;
+ topMargin: UM.Theme.getSize("wide_margin").height;
}
+ color: "transparent";
+ clip: true;
Label {
anchors.fill: parent;
- wrapMode: Text.WordWrap;
elide: Text.ElideRight;
font: UM.Theme.getFont("large_nonbold");
text: {
@@ -167,6 +169,7 @@ Rectangle {
}
return result;
}
+ wrapMode: Text.WordWrap;
}
Button {
@@ -174,6 +177,10 @@ Rectangle {
bottom: parent.bottom;
left: parent.left;
}
+ onClicked: {
+ overrideConfirmationDialog.visible = true;
+ }
+ text: catalog.i18nc("@label", "Override");
visible: {
var length = root.job.configurationChanges.length;
for (var i = 0; i < length; i++) {
@@ -184,10 +191,6 @@ Rectangle {
}
return true;
}
- text: catalog.i18nc("@label", "Override");
- onClicked: {
- overrideConfirmationDialog.visible = true;
- }
}
}
}
@@ -195,16 +198,16 @@ Rectangle {
MessageDialog {
id: overrideConfirmationDialog;
- title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
+ Component.onCompleted: visible = false;
icon: StandardIcon.Warning;
+ onYes: OutputDevice.forceSendJob(root.job.key);
+ standardButtons: StandardButton.Yes | StandardButton.No;
text: {
var printJobName = formatPrintJobName(root.job.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText;
}
- standardButtons: StandardButton.Yes | StandardButton.No;
- Component.onCompleted: visible = false;
- onYes: OutputDevice.forceSendJob(root.job.key);
+ title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
}
// Utils
diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
index 091b1fc1fa..4b863ff9ed 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
@@ -2,56 +2,45 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
-
-
import UM 1.3 as UM
import Cura 1.0 as Cura
-Component
-{
- Item
- {
- width: maximumWidth
- height: maximumHeight
- Image
- {
- id: cameraImage
- width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth)
- height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width)
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- z: 1
- Component.onCompleted:
- {
- if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
- {
- OutputDevice.activePrinter.camera.start()
+Component {
+ Item {
+ height: maximumHeight;
+ width: maximumWidth;
+
+ Image {
+ id: cameraImage;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ Component.onCompleted: {
+ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
+ OutputDevice.activePrinter.camera.start();
}
}
- onVisibleChanged:
- {
- if(visible)
- {
- if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
- {
- OutputDevice.activePrinter.camera.start()
+ height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width);
+ onVisibleChanged: {
+ if (visible) {
+ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
+ OutputDevice.activePrinter.camera.start();
}
- } else
- {
- if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
- {
- OutputDevice.activePrinter.camera.stop()
+ } else {
+ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
+ OutputDevice.activePrinter.camera.stop();
}
}
}
- source:
- {
- if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage)
- {
+ source: {
+ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) {
return OutputDevice.activePrinter.camera.latestImage;
}
return "";
}
+ width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth);
+ z: 1;
}
}
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index 151ae7ab36..bede597287 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -7,34 +7,29 @@ import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM
Item {
- id: extruderInfo
-
+ id: extruderInfo;
property var printCoreConfiguration: null;
-
- width: Math.round(parent.width / 2);
height: childrenRect.height;
+ width: Math.round(parent.width / 2);
// Extruder circle
Item {
- id: extruderCircle
-
- width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
- height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
+ id: extruderCircle;
anchors.verticalCenter: parent.verticalCenter;
+ height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
+ width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
// Loading skeleton
Rectangle {
- visible: !printCoreConfiguration;
anchors.fill: parent;
- radius: Math.round(width / 2);
color: UM.Theme.getColor("viewport_background");
+ radius: Math.round(width / 2);
+ visible: !printCoreConfiguration;
}
// Actual content
Rectangle {
- visible: printCoreConfiguration;
anchors.fill: parent;
- radius: Math.round(width / 2);
border.width: UM.Theme.getSize("monitor_tab_thick_lining").width;
border.color: UM.Theme.getColor("monitor_tab_lining_active");
opacity: {
@@ -43,6 +38,8 @@ Item {
}
return 1;
}
+ radius: Math.round(width / 2);
+ visible: printCoreConfiguration;
Label {
anchors.centerIn: parent;
@@ -55,68 +52,66 @@ Item {
// Print core and material labels
Item {
id: materialLabel
-
anchors {
left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width;
- top: parent.top;
right: parent.right;
+ top: parent.top;
}
height: UM.Theme.getSize("monitor_tab_text_line").height;
// Loading skeleton
Rectangle {
- visible: !extruderInfo.printCoreConfiguration;
anchors.fill: parent;
color: UM.Theme.getColor("viewport_background");
+ visible: !extruderInfo.printCoreConfiguration;
}
// Actual content
Label {
- visible: extruderInfo.printCoreConfiguration;
anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
text: {
if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) {
return printCoreConfiguration.activeMaterial.name;
}
return "";
}
- font: UM.Theme.getFont("default");
- elide: Text.ElideRight;
+ visible: extruderInfo.printCoreConfiguration;
}
}
Item {
id: printCoreLabel;
-
anchors {
- right: parent.right;
+ bottom: parent.bottom;
left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width;
- bottom: parent.bottom;
+ right: parent.right;
}
height: UM.Theme.getSize("monitor_tab_text_line").height;
// Loading skeleton
Rectangle {
+ color: UM.Theme.getColor("viewport_background");
+ height: parent.height;
visible: !extruderInfo.printCoreConfiguration;
width: parent.width / 3;
- height: parent.height;
- color: UM.Theme.getColor("viewport_background");
}
// Actual content
Label {
- visible: extruderInfo.printCoreConfiguration;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
+ opacity: 0.6;
text: {
if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) {
return printCoreConfiguration.hotendID;
}
return "";
}
- elide: Text.ElideRight;
- opacity: 0.6;
- font: UM.Theme.getFont("default");
+ visible: extruderInfo.printCoreConfiguration;
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 0c185386b2..dc613ff9ef 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -2,17 +2,13 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
-import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
-import QtQuick.Layouts 1.1
-import QtQuick.Dialogs 1.1
import UM 1.3 as UM
Item {
id: root;
-
property var printJob: null;
property var running: isRunning(printJob);
@@ -55,16 +51,20 @@ Item {
}
Item {
- id: pointedRectangle
- width: parent.width - 10 * screenScaleFactor; // Because of the shadow
+ id: pointedRectangle;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
height: parent.height - 10 * screenScaleFactor; // Because of the shadow
- anchors.horizontalCenter: parent.horizontalCenter;
- anchors.verticalCenter: parent.verticalCenter;
+ width: parent.width - 10 * screenScaleFactor; // Because of the shadow
Rectangle {
- id: point
- anchors.right: bloop.right;
- anchors.rightMargin: 24;
+ id: point;
+ anchors {
+ right: bloop.right;
+ rightMargin: 24;
+ }
color: UM.Theme.getColor("setting_control");
height: 14 * screenScaleFactor;
transform: Rotation {
@@ -75,7 +75,7 @@ Item {
}
Rectangle {
- id: bloop
+ id: bloop;
anchors {
bottom: parent.bottom;
bottomMargin: 8 * screenScaleFactor; // Because of the shadow
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 4ffcb8342e..335ee2ba47 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -11,13 +11,11 @@ import QtQuick.Dialogs 1.1
import UM 1.3 as UM
Item {
- id: root
-
- property var shadowRadius: 5;
- property var shadowOffset: 2;
+ id: root;
+ property var shadowRadius: 5 * screenScaleFactor;
+ property var shadowOffset: 2 * screenScaleFactor;
property var debug: false;
property var printJob: null;
-
width: parent.width; // Bubbles downward
height: childrenRect.height + shadowRadius * 2; // Bubbles upward
@@ -28,87 +26,84 @@ Item {
// The actual card (white block)
Rectangle {
- color: "white"; // TODO: Theme!
- height: childrenRect.height;
- width: parent.width - shadowRadius * 2;
-
// 5px margin, but shifted 2px vertically because of the shadow
anchors {
- topMargin: root.shadowRadius - root.shadowOffset;
bottomMargin: root.shadowRadius + root.shadowOffset;
leftMargin: root.shadowRadius;
rightMargin: root.shadowRadius;
+ topMargin: root.shadowRadius - root.shadowOffset;
}
+ color: "white"; // TODO: Theme!
+ height: childrenRect.height;
layer.enabled: true
layer.effect: DropShadow {
radius: root.shadowRadius
verticalOffset: 2 * screenScaleFactor
color: "#3F000000" // 25% shadow
}
+ width: parent.width - shadowRadius * 2;
Column {
- width: parent.width;
height: childrenRect.height;
+ width: parent.width;
// Main content
Item {
id: mainContent;
+ height: 200 * screenScaleFactor; // TODO: Theme!
width: parent.width;
- height: 200; // TODO: Theme!
// Left content
Item {
anchors {
+ bottom: parent.bottom;
left: parent.left;
+ margins: UM.Theme.getSize("wide_margin").width;
right: parent.horizontalCenter;
top: parent.top;
- bottom: parent.bottom;
- margins: UM.Theme.getSize("wide_margin").width
}
Item {
id: printJobName;
-
width: parent.width;
height: UM.Theme.getSize("monitor_tab_text_line").height;
Rectangle {
- visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: parent.height;
+ visible: !printJob;
width: parent.width / 3;
}
Label {
- visible: printJob;
- text: printJob ? printJob.name : ""; // Supress QML warnings
- font: UM.Theme.getFont("default_bold");
- elide: Text.ElideRight;
anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default_bold");
+ text: printJob ? printJob.name : ""; // Supress QML warnings
+ visible: printJob;
}
}
Item {
id: printJobOwnerName;
-
- width: parent.width;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
anchors {
top: printJobName.bottom;
topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2);
}
+ height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width;
Rectangle {
- visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: parent.height;
+ visible: !printJob;
width: parent.width / 2;
}
Label {
- visible: printJob;
- text: printJob ? printJob.owner : ""; // Supress QML warnings
- font: UM.Theme.getFont("default");
- elide: Text.ElideRight;
anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
+ text: printJob ? printJob.owner : ""; // Supress QML warnings
+ visible: printJob;
}
}
@@ -116,90 +111,96 @@ Item {
id: printJobPreview;
property var useUltibot: false;
anchors {
- top: printJobOwnerName.bottom;
- horizontalCenter: parent.horizontalCenter;
- topMargin: UM.Theme.getSize("default_margin").height;
bottom: parent.bottom;
+ horizontalCenter: parent.horizontalCenter;
+ top: printJobOwnerName.bottom;
+ topMargin: UM.Theme.getSize("default_margin").height;
}
width: height;
// Skeleton
Rectangle {
- visible: !printJob;
anchors.fill: parent;
- radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ visible: !printJob;
}
// Actual content
Image {
id: previewImage;
- visible: printJob;
- source: printJob ? printJob.previewImageUrl : "";
- opacity: printJob && printJob.state == "error" ? 0.5 : 1.0;
anchors.fill: parent;
+ opacity: printJob && printJob.state == "error" ? 0.5 : 1.0;
+ source: printJob ? printJob.previewImageUrl : "";
+ visible: printJob;
}
UM.RecolorImage {
id: ultiBotImage;
+
anchors.centerIn: printJobPreview;
+ color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
+ height: printJobPreview.height;
source: "../svg/ultibot.svg";
+ sourceSize {
+ height: height;
+ width: width;
+ }
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */
visible: printJob && previewImage.status == Image.Error;
width: printJobPreview.width;
- height: printJobPreview.height;
- sourceSize.width: width;
- sourceSize.height: height;
- color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
}
UM.RecolorImage {
id: statusImage;
anchors.centerIn: printJobPreview;
+ color: "black";
+ height: 0.5 * printJobPreview.height;
source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : "";
+ sourceSize {
+ height: height;
+ width: width;
+ }
visible: source != "";
width: 0.5 * printJobPreview.width;
- height: 0.5 * printJobPreview.height;
- sourceSize.width: width;
- sourceSize.height: height;
- color: "black";
}
}
}
// Divider
Rectangle {
- height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
- width: UM.Theme.getSize("default_lining").width;
- color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
anchors {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
}
+ color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
+ height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
+ width: UM.Theme.getSize("default_lining").width;
}
// Right content
Item {
anchors {
+ bottom: parent.bottom;
left: parent.horizontalCenter;
+ margins: UM.Theme.getSize("wide_margin").width;
right: parent.right;
top: parent.top;
- bottom: parent.bottom;
- margins: UM.Theme.getSize("wide_margin").width;
}
Item {
id: targetPrinterLabel;
- width: parent.width;
height: UM.Theme.getSize("monitor_tab_text_line").height;
+ width: parent.width;
+
Rectangle {
visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
anchors.fill: parent;
}
+
Label {
- visible: printJob;
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: {
@@ -215,13 +216,14 @@ Item {
}
return "";
}
+ visible: printJob;
}
}
PrinterInfoBlock {
+ anchors.bottom: parent.bottom;
printer: root.printJob.assignedPrinter;
printJob: root.printJob;
- anchors.bottom: parent.bottom;
}
}
@@ -240,15 +242,15 @@ Item {
Item {
id: configChangesBox;
- width: parent.width;
height: childrenRect.height;
visible: printJob && printJob.configurationChanges.length !== 0;
+ width: parent.width;
// Config change toggle
Rectangle {
id: configChangeToggle;
color: {
- if(configChangeToggleArea.containsMouse) {
+ if (configChangeToggleArea.containsMouse) {
return UM.Theme.getColor("viewport_background"); // TODO: Theme!
} else {
return "transparent";
@@ -263,23 +265,25 @@ Item {
}
Rectangle {
- width: parent.width;
- height: UM.Theme.getSize("default_lining").height;
color: "#e6e6e6"; // TODO: Theme!
+ height: UM.Theme.getSize("default_lining").height;
+ width: parent.width;
}
UM.RecolorImage {
- width: 23; // TODO: Theme!
- height: 23; // TODO: Theme!
anchors {
right: configChangeToggleLabel.left;
rightMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter;
}
- sourceSize.width: width;
- sourceSize.height: height;
- source: "../svg/warning-icon.svg";
color: UM.Theme.getColor("text");
+ height: 23 * screenScaleFactor; // TODO: Theme!
+ source: "../svg/warning-icon.svg";
+ sourceSize {
+ height: height;
+ width: width;
+ }
+ width: 23 * screenScaleFactor; // TODO: Theme!
}
Label {
@@ -292,15 +296,13 @@ Item {
}
UM.RecolorImage {
- width: 15; // TODO: Theme!
- height: 15; // TODO: Theme!
anchors {
left: configChangeToggleLabel.right;
leftMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter;
}
- sourceSize.width: width;
- sourceSize.height: height;
+ color: UM.Theme.getColor("text");
+ height: 15 * screenScaleFactor; // TODO: Theme!
source: {
if (configChangeDetails.visible) {
return UM.Theme.getIcon("arrow_top");
@@ -308,7 +310,11 @@ Item {
return UM.Theme.getIcon("arrow_bottom");
}
}
- color: UM.Theme.getColor("text");
+ sourceSize {
+ width: width;
+ height: height;
+ }
+ width: 15 * screenScaleFactor; // TODO: Theme!
}
MouseArea {
@@ -324,26 +330,25 @@ Item {
// Config change details
Item {
id: configChangeDetails;
- width: parent.width;
- visible: false;
+ anchors.top: configChangeToggle.bottom;
+ Behavior on height { NumberAnimation { duration: 100 } }
// In case of really massive multi-line configuration changes
height: visible ? Math.max(UM.Theme.getSize("monitor_tab_config_override_box").height, childrenRect.height) : 0;
- Behavior on height { NumberAnimation { duration: 100 } }
- anchors.top: configChangeToggle.bottom;
+ visible: false;
+ width: parent.width;
Item {
- clip: true;
anchors {
- fill: parent;
- topMargin: UM.Theme.getSize("wide_margin").height;
bottomMargin: UM.Theme.getSize("wide_margin").height;
+ fill: parent;
leftMargin: UM.Theme.getSize("wide_margin").height * 4;
rightMargin: UM.Theme.getSize("wide_margin").height * 4;
+ topMargin: UM.Theme.getSize("wide_margin").height;
}
+ clip: true;
Label {
anchors.fill: parent;
- wrapMode: Text.WordWrap;
elide: Text.ElideRight;
font: UM.Theme.getFont("large_nonbold");
text: {
@@ -380,6 +385,7 @@ Item {
}
return result;
}
+ wrapMode: Text.WordWrap;
}
Button {
@@ -387,6 +393,10 @@ Item {
bottom: parent.bottom;
left: parent.left;
}
+ onClicked: {
+ overrideConfirmationDialog.visible = true;
+ }
+ text: catalog.i18nc("@label", "Override");
visible: {
var length = printJob.configurationChanges.length;
for (var i = 0; i < length; i++) {
@@ -397,26 +407,22 @@ Item {
}
return true;
}
- text: catalog.i18nc("@label", "Override");
- onClicked: {
- overrideConfirmationDialog.visible = true;
- }
}
}
}
MessageDialog {
id: overrideConfirmationDialog;
- title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
+ Component.onCompleted: visible = false;
icon: StandardIcon.Warning;
+ onYes: OutputDevice.forceSendJob(printJob.key);
+ standardButtons: StandardButton.Yes | StandardButton.No;
text: {
var printJobName = formatPrintJobName(printJob.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText;
}
- standardButtons: StandardButton.Yes | StandardButton.No;
- Component.onCompleted: visible = false;
- onYes: OutputDevice.forceSendJob(printJob.key);
+ title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
}
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
index 2bec0906a8..8d80377e99 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
@@ -14,15 +14,15 @@ import UM 1.3 as UM
Item {
property var job: null;
property var useUltibot: false;
- height: 100;
+ height: 100 * screenScaleFactor;
width: height;
// Skeleton
Rectangle {
- visible: !job;
anchors.fill: parent;
- radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ visible: !job;
}
// Actual content
@@ -46,26 +46,30 @@ Item {
UM.RecolorImage {
id: ultibotImage;
anchors.centerIn: parent;
+ color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
+ height: parent.height;
source: "../svg/ultibot.svg";
+ sourceSize {
+ height: height;
+ width: width;
+ }
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */
visible: job && previewImage.status == Image.Error;
width: parent.width;
- height: parent.height;
- sourceSize.width: width;
- sourceSize.height: height;
- color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
}
UM.RecolorImage {
id: statusImage;
anchors.centerIn: parent;
+ color: "black"; // TODO: Theme!
+ height: 0.5 * parent.height;
source: job && job.state == "error" ? "../svg/aborted-icon.svg" : "";
+ sourceSize {
+ height: height;
+ width: width;
+ }
visible: source != "";
width: 0.5 * parent.width;
- height: 0.5 * parent.height;
- sourceSize.width: width;
- sourceSize.height: height;
- color: "black";
}
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
index 604b5ce862..9dc7dff62e 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
@@ -17,17 +17,18 @@ Column {
width: parent.width;
Rectangle {
- visible: !job;
color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
height: parent.height;
+ visible: !job;
width: parent.width / 3;
}
+
Label {
- visible: job;
- text: job ? job.name : "";
- font: UM.Theme.getFont("default_bold");
- elide: Text.ElideRight;
anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default_bold");
+ text: job ? job.name : "";
+ visible: job;
}
}
@@ -37,17 +38,18 @@ Column {
width: parent.width;
Rectangle {
- visible: !job;
color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
height: parent.height;
+ visible: !job;
width: parent.width / 2;
}
+
Label {
- visible: job;
- text: job ? job.owner : "";
- font: UM.Theme.getFont("default");
- elide: Text.ElideRight;
anchors.fill: parent;
+ elide: Text.ElideRight;
+ font: UM.Theme.getFont("default");
+ text: job ? job.owner : "";
+ visible: job;
}
}
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml
index 9793b218fc..a28167d260 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml
@@ -4,112 +4,101 @@
import QtQuick 2.2
import QtQuick.Window 2.2
import QtQuick.Controls 1.2
-
import UM 1.1 as UM
-UM.Dialog
-{
+UM.Dialog {
id: base;
-
- minimumWidth: 500 * screenScaleFactor
- minimumHeight: 140 * screenScaleFactor
- maximumWidth: minimumWidth
- maximumHeight: minimumHeight
- width: minimumWidth
- height: minimumHeight
-
- visible: true
- modality: Qt.ApplicationModal
- onVisibleChanged:
- {
- if(visible)
- {
- resetPrintersModel()
- }
- else
- {
- OutputDevice.cancelPrintSelection()
- }
+ property var printersModel: {
+ return ListModel{};
}
- title: catalog.i18nc("@title:window", "Print over network")
-
- property var printersModel: ListModel{}
- function resetPrintersModel() {
- printersModel.clear()
- printersModel.append({ name: "Automatic", key: ""})
-
- for (var index in OutputDevice.printers)
- {
- printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key})
- }
- }
-
- Column
- {
- id: printerSelection
- anchors.fill: parent
- anchors.top: parent.top
- anchors.topMargin: UM.Theme.getSize("default_margin").height
- anchors.leftMargin: UM.Theme.getSize("default_margin").width
- anchors.rightMargin: UM.Theme.getSize("default_margin").width
- height: 50 * screenScaleFactor
- Label
- {
- id: manualPrinterSelectionLabel
- anchors
- {
- left: parent.left
- topMargin: UM.Theme.getSize("default_margin").height
- right: parent.right
- }
- text: catalog.i18nc("@label", "Printer selection")
- wrapMode: Text.Wrap
- height: 20 * screenScaleFactor
- }
-
- ComboBox
- {
- id: printerSelectionCombobox
- model: base.printersModel
- textRole: "name"
-
- width: parent.width
- height: 40 * screenScaleFactor
- Behavior on height { NumberAnimation { duration: 100 } }
- }
-
- SystemPalette
- {
- id: palette
- }
-
- UM.I18nCatalog { id: catalog; name: "cura"; }
- }
-
+ height: minimumHeight;
leftButtons: [
- Button
- {
- text: catalog.i18nc("@action:button","Cancel")
- enabled: true
+ Button {
+ enabled: true;
onClicked: {
base.visible = false;
- printerSelectionCombobox.currentIndex = 0
- OutputDevice.cancelPrintSelection()
+ printerSelectionCombobox.currentIndex = 0;
+ OutputDevice.cancelPrintSelection();
}
+ text: catalog.i18nc("@action:button","Cancel");
}
]
-
+ maximumHeight: minimumHeight;
+ maximumWidth: minimumWidth;
+ minimumHeight: 140 * screenScaleFactor;
+ minimumWidth: 500 * screenScaleFactor;
+ modality: Qt.ApplicationModal;
+ onVisibleChanged: {
+ if (visible) {
+ resetPrintersModel();
+ } else {
+ OutputDevice.cancelPrintSelection();
+ }
+ }
rightButtons: [
- Button
- {
- text: catalog.i18nc("@action:button","Print")
- enabled: true
+ Button {
+ enabled: true;
onClicked: {
base.visible = false;
- OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key)
+ OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key);
// reset to defaults
- printerSelectionCombobox.currentIndex = 0
+ printerSelectionCombobox.currentIndex = 0;
}
+ text: catalog.i18nc("@action:button","Print");
}
]
+ title: catalog.i18nc("@title:window", "Print over network");
+ visible: true;
+ width: minimumWidth;
+
+ Column {
+ id: printerSelection;
+ anchors {
+ fill: parent;
+ leftMargin: UM.Theme.getSize("default_margin").width;
+ rightMargin: UM.Theme.getSize("default_margin").width;
+ top: parent.top;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ }
+ height: 50 * screenScaleFactor;
+
+ SystemPalette {
+ id: palette;
+ }
+
+ UM.I18nCatalog {
+ id: catalog;
+ name: "cura";
+ }
+
+ Label {
+ id: manualPrinterSelectionLabel;
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ topMargin: UM.Theme.getSize("default_margin").height;
+ }
+ height: 20 * screenScaleFactor;
+ text: catalog.i18nc("@label", "Printer selection");
+ wrapMode: Text.Wrap;
+ }
+
+ ComboBox {
+ id: printerSelectionCombobox;
+ Behavior on height { NumberAnimation { duration: 100 } }
+ height: 40 * screenScaleFactor;
+ model: base.printersModel;
+ textRole: "name";
+ width: parent.width;
+ }
+ }
+
+ // Utils
+ function resetPrintersModel() {
+ printersModel.clear();
+ printersModel.append({ name: "Automatic", key: ""});
+ for (var index in OutputDevice.printers) {
+ printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key});
+ }
+ }
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index c13a4c4b93..ebfe160e06 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -6,17 +6,14 @@ import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.3
import QtGraphicalEffects 1.0
-import QtQuick.Controls 1.4 as LegacyControls
import UM 1.3 as UM
Item {
id: root;
-
property var shadowRadius: 5;
property var shadowOffset: 2;
property var printer: null;
property var collapsed: true;
-
height: childrenRect.height + shadowRadius * 2; // Bubbles upward
width: parent.width; // Bubbles downward
@@ -24,10 +21,10 @@ Item {
Rectangle {
// 5px margin, but shifted 2px vertically because of the shadow
anchors {
- topMargin: root.shadowRadius - root.shadowOffset;
bottomMargin: root.shadowRadius + root.shadowOffset;
leftMargin: root.shadowRadius;
rightMargin: root.shadowRadius;
+ topMargin: root.shadowRadius - root.shadowOffset;
}
color: {
if (printer.state == "disabled") {
@@ -46,8 +43,8 @@ Item {
width: parent.width - 2 * shadowRadius;
Column {
- width: parent.width;
height: childrenRect.height;
+ width: parent.width;
// Main card
Item {
@@ -65,15 +62,12 @@ Item {
margins: UM.Theme.getSize("default_margin").width;
top: parent.top;
}
- height: 58;
- width: 58;
+ height: 58 * screenScaleFactor;
+ width: 58 * screenScaleFactor;
// Skeleton
Rectangle {
- anchors {
- fill: parent;
- // margins: Math.round(UM.Theme.getSize("default_margin").width / 4);
- }
+ anchors.fill: parent;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
visible: !printer;
@@ -153,7 +147,6 @@ Item {
height: UM.Theme.getSize("monitor_tab_text_line").height;
width: parent.width * 0.75;
-
// Skeleton
Rectangle {
anchors.fill: parent;
@@ -192,12 +185,14 @@ Item {
verticalCenter: parent.verticalCenter;
}
color: UM.Theme.getColor("text");
- height: 15; // TODO: Theme!
+ height: 15 * screenScaleFactor; // TODO: Theme!
source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom");
- sourceSize.height: height;
- sourceSize.width: width;
+ sourceSize {
+ height: height;
+ width: width;
+ }
visible: printer;
- width: 15; // TODO: Theme!
+ width: 15 * screenScaleFactor; // TODO: Theme!
}
MouseArea {
@@ -213,7 +208,7 @@ Item {
}
Connections {
- target: printerList
+ target: printerList;
onCurrentIndexChanged: {
if (!model) {
return;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index 7cce0d5c0d..0971776cc6 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -10,17 +10,14 @@ import QtQuick.Controls 1.4 as LegacyControls
import UM 1.3 as UM
Item {
-
property var printer: null;
property var printJob: printer ? printer.activePrintJob : null;
property var collapsed: true;
-
Behavior on height { NumberAnimation { duration: 100 } }
Behavior on opacity { NumberAnimation { duration: 100 } }
-
- width: parent.width;
height: collapsed ? 0 : childrenRect.height;
opacity: collapsed ? 0 : 1;
+ width: parent.width;
Column {
id: contentColumn;
@@ -44,8 +41,8 @@ Item {
HorizontalLine {}
Row {
- width: parent.width;
height: childrenRect.height;
+ width: parent.width;
PrintJobTitle {
job: root.printer.activePrintJob;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
index 809a3c651a..4fac99f7a2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -17,107 +17,90 @@ ProgressBar {
}
return result;
}
- value: progress;
- width: parent.width;
-
style: ProgressBarStyle {
- property var remainingTime:
- {
- if(printer.activePrintJob == null)
- {
- return 0
+ property var remainingTime: {
+ if (printer.activePrintJob == null) {
+ return 0;
}
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
time from ever being less than 0. Negative durations cause strange behavior such
as displaying "-1h -1m". */
- var activeJob = printer.activePrintJob
+ var activeJob = printer.activePrintJob;
return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
}
- property var progressText:
- {
- if(printer.activePrintJob == null)
- {
- return ""
+ property var progressText: {
+ if (printer.activePrintJob == null) {
+ return "";
}
- switch(printer.activePrintJob.state)
- {
+ switch (printer.activePrintJob.state) {
case "wait_cleanup":
- if(printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed)
- {
- return catalog.i18nc("@label:status", "Aborted")
+ if (printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed) {
+ return catalog.i18nc("@label:status", "Aborted");
}
- return catalog.i18nc("@label:status", "Finished")
+ return catalog.i18nc("@label:status", "Finished");
case "pre_print":
case "sent_to_printer":
- return catalog.i18nc("@label:status", "Preparing")
+ return catalog.i18nc("@label:status", "Preparing");
case "aborted":
- return catalog.i18nc("@label:status", "Aborted")
+ return catalog.i18nc("@label:status", "Aborted");
case "wait_user_action":
- return catalog.i18nc("@label:status", "Aborted")
+ return catalog.i18nc("@label:status", "Aborted");
case "pausing":
- return catalog.i18nc("@label:status", "Pausing")
+ return catalog.i18nc("@label:status", "Pausing");
case "paused":
- return OutputDevice.formatDuration( remainingTime )
+ return OutputDevice.formatDuration( remainingTime );
case "resuming":
- return catalog.i18nc("@label:status", "Resuming")
+ return catalog.i18nc("@label:status", "Resuming");
case "queued":
- return catalog.i18nc("@label:status", "Action required")
+ return catalog.i18nc("@label:status", "Action required");
default:
- return OutputDevice.formatDuration( remainingTime )
+ return OutputDevice.formatDuration( remainingTime );
}
}
-
- background: Rectangle
- {
- implicitWidth: 100
- implicitHeight: visible ? 24 : 0
- color: UM.Theme.getColor("viewport_background")
+ background: Rectangle {
+ color: UM.Theme.getColor("viewport_background");
+ implicitHeight: visible ? 24 : 0;
+ implicitWidth: 100;
}
-
- progress: Rectangle
- {
- color:
- {
+ progress: Rectangle {
+ id: progressItem;
+ color: {
var state = printer.activePrintJob.state
var inactiveStates = [
"pausing",
"paused",
"resuming",
"wait_cleanup"
- ]
- if(inactiveStates.indexOf(state) > -1 && remainingTime > 0)
- {
- return UM.Theme.getColor("monitor_tab_text_inactive")
- }
- else
- {
- return UM.Theme.getColor("primary")
- }
- }
- id: progressItem
- function getTextOffset()
- {
- if(progressItem.width + progressLabel.width + 16 < control.width)
- {
- return progressItem.width + UM.Theme.getSize("default_margin").width
- }
- else
- {
- return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width
+ ];
+ if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) {
+ return UM.Theme.getColor("monitor_tab_text_inactive");
+ } else {
+ return UM.Theme.getColor("primary");
}
}
- Label
- {
- id: progressLabel
- anchors.left: parent.left
- anchors.leftMargin: getTextOffset()
- text: progressText
- anchors.verticalCenter: parent.verticalCenter
- color: progressItem.width + progressLabel.width < control.width ? "black" : "white"
- width: contentWidth
- font: UM.Theme.getFont("default")
+ Label {
+ id: progressLabel;
+ anchors {
+ left: parent.left;
+ leftMargin: getTextOffset();
+ }
+ text: progressText;
+ anchors.verticalCenter: parent.verticalCenter;
+ color: progressItem.width + progressLabel.width < control.width ? "black" : "white";
+ width: contentWidth;
+ font: UM.Theme.getFont("default");
+ }
+
+ function getTextOffset() {
+ if (progressItem.width + progressLabel.width + 16 < control.width) {
+ return progressItem.width + UM.Theme.getSize("default_margin").width;
+ } else {
+ return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width;
+ }
}
}
}
+ value: progress;
+ width: parent.width;
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
index 118da2f42b..24de732faf 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
@@ -5,26 +5,27 @@ import QtQuick 2.2
import QtQuick.Controls 1.4
import UM 1.2 as UM
-Item
-{
- property alias text: familyNameLabel.text
+Item {
+ property alias text: familyNameLabel.text;
property var padding: 3 * screenScaleFactor; // TODO: Theme!
- implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom.
- implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off.
- Rectangle
- {
- id: background
- height: parent.height
- width: parent.width
+ implicitHeight: familyNameLabel.contentHeight + 2 * padding; // Apply the padding to top and bottom.
+ implicitWidth: familyNameLabel.contentWidth + implicitHeight; // The extra height is added to ensure the radius doesn't cut something off.
+
+ Rectangle {
+ id: background;
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ right: parent.right;
+ }
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- anchors.right: parent.right
- anchors.horizontalCenter: parent.horizontalCenter
- radius: 0.5 * height
+ height: parent.height;
+ radius: 0.5 * height;
+ width: parent.width;
}
- Label
- {
- id: familyNameLabel
- anchors.centerIn: parent
- text: ""
+
+ Label {
+ id: familyNameLabel;
+ anchors.centerIn: parent;
+ text: "";
}
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
index 51d9e1f462..b054eb458f 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -13,17 +13,14 @@ import UM 1.3 as UM
Item {
id: root;
-
property var printer: null;
property var printJob: null;
-
width: parent.width;
height: childrenRect.height;
// Printer family pills
Row {
id: printerFamilyPills;
-
anchors {
left: parent.left;
right: parent.right;
@@ -35,21 +32,23 @@ Item {
Repeater {
id: compatiblePills;
- visible: printJob;
+ delegate: PrinterFamilyPill {
+ text: modelData;
+ }
model: printJob ? printJob.compatibleMachineFamilies : [];
- delegate: PrinterFamilyPill { text: modelData; }
+ visible: printJob;
+
}
PrinterFamilyPill {
- visible: !compatiblePills.visible && printer;
text: printer.type;
+ visible: !compatiblePills.visible && printer;
}
}
// Extruder info
Row {
id: extrudersInfo;
-
anchors {
left: parent.left;
right: parent.right;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
index 5e5c972fbe..b9e2525dd5 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
@@ -4,84 +4,66 @@
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
-
import UM 1.3 as UM
+Item {
+ property var camera: null;
-Item
-{
- property var camera: null
-
- Rectangle
- {
- anchors.fill:parent
- color: UM.Theme.getColor("viewport_overlay")
- opacity: 0.5
+ Rectangle {
+ anchors.fill:parent;
+ color: UM.Theme.getColor("viewport_overlay");
+ opacity: 0.5;
}
- MouseArea
- {
- anchors.fill: parent
- onClicked: OutputDevice.setActiveCamera(null)
- z: 0
+ MouseArea {
+ anchors.fill: parent;
+ onClicked: OutputDevice.setActiveCamera(null);
+ z: 0;
}
- CameraButton
- {
- id: closeCameraButton
- iconSource: UM.Theme.getIcon("cross1")
- anchors
- {
- top: cameraImage.top
- topMargin: UM.Theme.getSize("default_margin").height
+ CameraButton {
+ id: closeCameraButton;
+ anchors {
right: cameraImage.right
rightMargin: UM.Theme.getSize("default_margin").width
+ top: cameraImage.top
+ topMargin: UM.Theme.getSize("default_margin").height
}
- z: 999
+ iconSource: UM.Theme.getIcon("cross1");
+ z: 999;
}
- Image
- {
+ Image {
id: cameraImage
- width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth)
- height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width)
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- z: 1
- onVisibleChanged:
- {
- if(visible)
- {
- if(camera != null)
- {
- camera.start()
+ anchors.horizontalCenter: parent.horizontalCenter;
+ anchors.verticalCenter: parent.verticalCenter;
+ height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width);
+ onVisibleChanged: {
+ if (visible) {
+ if (camera != null) {
+ camera.start();
}
- } else
- {
- if(camera != null)
- {
- camera.stop()
+ } else {
+ if (camera != null) {
+ camera.stop();
}
}
}
-
- source:
- {
- if(camera != null && camera.latestImage != null)
- {
+ source: {
+ if (camera != null && camera.latestImage != null) {
return camera.latestImage;
}
return "";
}
- }
-
- MouseArea
- {
- anchors.fill: cameraImage
- onClicked:
- {
- OutputDevice.setActiveCamera(null)
- }
+ width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth);
z: 1
}
+
+ MouseArea {
+ anchors.fill: cameraImage;
+ onClicked: {
+ OutputDevice.setActiveCamera(null);
+ }
+ z: 1;
+ }
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
index 6af4b2c6a6..105143c851 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
@@ -1,128 +1,126 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
-import UM 1.2 as UM
-import Cura 1.0 as Cura
-
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
+import UM 1.2 as UM
+import Cura 1.0 as Cura
-Item
-{
- id: base
+Item {
+ id: base;
+ property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId;
+ property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null;
+ property bool printerConnected: Cura.MachineManager.printerConnected;
+ property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands;
+ property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5); // AuthState.AuthenticationRequested or AuthenticationReceived.
- property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId
- property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null
- property bool printerConnected: Cura.MachineManager.printerConnected
- property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
- property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5) // AuthState.AuthenticationRequested or AuthenticationReceived.
+ UM.I18nCatalog {
+ id: catalog;
+ name: "cura";
+ }
- Row
- {
- objectName: "networkPrinterConnectButton"
- visible: isUM3
- spacing: UM.Theme.getSize("default_margin").width
+ Row {
+ objectName: "networkPrinterConnectButton";
+ spacing: UM.Theme.getSize("default_margin").width;
+ visible: isUM3;
- Button
- {
- height: UM.Theme.getSize("save_button_save_to_button").height
- tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
- text: catalog.i18nc("@action:button", "Request Access")
- style: UM.Theme.styles.sidebar_action_button
- onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
- visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
+ Button {
+ height: UM.Theme.getSize("save_button_save_to_button").height;
+ onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication();
+ style: UM.Theme.styles.sidebar_action_button;
+ text: catalog.i18nc("@action:button", "Request Access");
+ tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer");
+ visible: printerConnected && !printerAcceptsCommands && !authenticationRequested;
}
- Button
- {
- height: UM.Theme.getSize("save_button_save_to_button").height
- tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer")
- text: catalog.i18nc("@action:button", "Connect")
- style: UM.Theme.styles.sidebar_action_button
- onClicked: connectActionDialog.show()
- visible: !printerConnected
+ Button {
+ height: UM.Theme.getSize("save_button_save_to_button").height;
+ onClicked: connectActionDialog.show();
+ style: UM.Theme.styles.sidebar_action_button;
+ text: catalog.i18nc("@action:button", "Connect");
+ tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer");
+ visible: !printerConnected;
}
}
- UM.Dialog
- {
- id: connectActionDialog
- Loader
- {
- anchors.fill: parent
- source: "DiscoverUM3Action.qml"
+ UM.Dialog {
+ id: connectActionDialog;
+ rightButtons: Button {
+ iconName: "dialog-close";
+ onClicked: connectActionDialog.reject();
+ text: catalog.i18nc("@action:button", "Close");
}
- rightButtons: Button
- {
- text: catalog.i18nc("@action:button", "Close")
- iconName: "dialog-close"
- onClicked: connectActionDialog.reject()
+
+ Loader {
+ anchors.fill: parent;
+ source: "DiscoverUM3Action.qml";
}
}
+ Column {
+ anchors.fill: parent;
+ objectName: "networkPrinterConnectionInfo";
+ spacing: UM.Theme.getSize("default_margin").width;
+ visible: isUM3;
- Column
- {
- objectName: "networkPrinterConnectionInfo"
- visible: isUM3
- spacing: UM.Theme.getSize("default_margin").width
- anchors.fill: parent
-
- Button
- {
- tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
- text: catalog.i18nc("@action:button", "Request Access")
- onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
- visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
+ Button {
+ onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication();
+ text: catalog.i18nc("@action:button", "Request Access");
+ tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer");
+ visible: printerConnected && !printerAcceptsCommands && !authenticationRequested;
}
- Row
- {
- visible: printerConnected
- spacing: UM.Theme.getSize("default_margin").width
+ Row {
+ anchors {
+ left: parent.left;
+ right: parent.right;
+ }
+ height: childrenRect.height;
+ spacing: UM.Theme.getSize("default_margin").width;
+ visible: printerConnected;
- anchors.left: parent.left
- anchors.right: parent.right
- height: childrenRect.height
+ Column {
+ Repeater {
+ model: Cura.ExtrudersModel {
+ simpleNames: true;
+ }
- Column
- {
- Repeater
- {
- model: Cura.ExtrudersModel { simpleNames: true }
- Label { text: model.name }
+ Label {
+ text: model.name;
+ }
}
}
- Column
- {
- Repeater
- {
- id: nozzleColumn
- model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null
- Label { text: nozzleColumn.model[index] }
+
+ Column {
+ Repeater {
+ id: nozzleColumn;
+ model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null;
+
+ Label {
+ text: nozzleColumn.model[index];
+ }
}
}
- Column
- {
- Repeater
- {
- id: materialColumn
- model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null
- Label { text: materialColumn.model[index] }
+
+ Column {
+ Repeater {
+ id: materialColumn;
+ model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null;
+
+ Label {
+ text: materialColumn.model[index];
+ }
}
}
}
- Button
- {
- tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura")
- text: catalog.i18nc("@action:button", "Activate Configuration")
- visible: false // printerConnected && !isClusterPrinter()
- onClicked: manager.loadConfigurationFromPrinter()
+ Button {
+ onClicked: manager.loadConfigurationFromPrinter();
+ text: catalog.i18nc("@action:button", "Activate Configuration");
+ tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura");
+ visible: false; // printerConnected && !isClusterPrinter()
}
}
-
- UM.I18nCatalog{id: catalog; name:"cura"}
}
From 7f370a75745c4932b1ed6313e986e0f9521842c3 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 3 Oct 2018 12:28:35 +0200
Subject: [PATCH 17/31] Clean-up mistakes
Oops!
---
plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml | 2 +-
.../UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index 778a6da2eb..6148a53343 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -109,7 +109,7 @@ Component {
ListView {
id: printJobList;
anchors.fill: parent;
- delegate: PrintJobInfoBlock; {
+ delegate: PrintJobInfoBlock {
anchors {
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").width;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index dc613ff9ef..41d28c89f1 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -4,6 +4,7 @@
import QtQuick 2.2
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
+import QtQuick.Dialogs 1.1
import QtGraphicalEffects 1.0
import UM 1.3 as UM
From 1fa7a8880be988389a59e31fedea1a98fce4cb16 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 15 Oct 2018 17:02:27 +0200
Subject: [PATCH 18/31] Clean up some QML warnings
Contributes to CL-1051
---
.../qml/ConfigurationChangeBlock.qml | 18 +++++++++++-----
.../resources/qml/PrintCoreConfiguration.qml | 2 +-
.../resources/qml/PrintJobContextMenu.qml | 15 +++++++++----
.../resources/qml/PrintJobInfoBlock.qml | 21 ++++++++++++-------
.../resources/qml/PrintJobTitle.qml | 2 +-
.../resources/qml/PrinterCard.qml | 5 ++++-
.../resources/qml/PrinterCardDetails.qml | 2 +-
.../resources/qml/PrinterCardProgressBar.qml | 10 +++++----
.../resources/qml/PrinterInfoBlock.qml | 2 +-
9 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index 250449a763..63815b58bf 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -136,6 +136,9 @@ Item {
elide: Text.ElideRight;
font: UM.Theme.getFont("large_nonbold");
text: {
+ if (root.job === null) {
+ return "";
+ }
if (root.job.configurationChanges.length === 0) {
return "";
}
@@ -182,11 +185,13 @@ Item {
}
text: catalog.i18nc("@label", "Override");
visible: {
- var length = root.job.configurationChanges.length;
- for (var i = 0; i < length; i++) {
- var typeOfChange = root.job.configurationChanges[i].typeOfChange;
- if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
- return false;
+ if (root.job & root.job.configurationChanges) {
+ var length = root.job.configurationChanges.length;
+ for (var i = 0; i < length; i++) {
+ var typeOfChange = root.job.configurationChanges[i].typeOfChange;
+ if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
+ return false;
+ }
}
}
return true;
@@ -203,6 +208,9 @@ Item {
onYes: OutputDevice.forceSendJob(root.job.key);
standardButtons: StandardButton.Yes | StandardButton.No;
text: {
+ if (!root.job) {
+ return "";
+ }
var printJobName = formatPrintJobName(root.job.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index bede597287..e8abb8109e 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -73,7 +73,7 @@ Item {
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: {
- if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) {
+ if (printCoreConfiguration && printCoreConfiguration.activeMaterial != undefined) {
return printCoreConfiguration.activeMaterial.name;
}
return "";
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 41d28c89f1..7b956a2101 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -101,7 +101,14 @@ Item {
width: parent.width;
PrintJobContextMenuItem {
- enabled: printJob && !running ? OutputDevice.queuedPrintJobs[0].key != printJob.key : false;
+ enabled: {
+ if (printJob && !running) {
+ if (OutputDevice && OutputDevice.queuedPrintJobs[0]) {
+ return OutputDevice.queuedPrintJobs[0].key != printJob.key;
+ }
+ }
+ return false;
+ }
onClicked: {
sendToTopConfirmationDialog.visible = true;
popup.close();
@@ -169,7 +176,7 @@ Item {
icon: StandardIcon.Warning;
onYes: OutputDevice.sendJobToTop(printJob.key);
standardButtons: StandardButton.Yes | StandardButton.No;
- text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
+ text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
title: catalog.i18nc("@window:title", "Move print job to top");
}
@@ -179,7 +186,7 @@ Item {
icon: StandardIcon.Warning;
onYes: OutputDevice.deleteJobFromQueue(printJob.key);
standardButtons: StandardButton.Yes | StandardButton.No;
- text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
+ text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
title: catalog.i18nc("@window:title", "Delete print job");
}
@@ -189,7 +196,7 @@ Item {
icon: StandardIcon.Warning;
onYes: printJob.setState("abort");
standardButtons: StandardButton.Yes | StandardButton.No;
- text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "";
+ text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "";
title: catalog.i18nc("@window:title", "Abort print");
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 335ee2ba47..fcdf3ba955 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -78,7 +78,7 @@ Item {
anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
- text: printJob ? printJob.name : ""; // Supress QML warnings
+ text: printJob && printJob.name ? printJob.name : ""; // Supress QML warnings
visible: printJob;
}
}
@@ -204,7 +204,7 @@ Item {
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: {
- if (printJob) {
+ if (printJob !== null) {
if (printJob.assignedPrinter == null) {
if (printJob.state == "error") {
return catalog.i18nc("@label", "Waiting for: Unavailable printer");
@@ -222,7 +222,7 @@ Item {
PrinterInfoBlock {
anchors.bottom: parent.bottom;
- printer: root.printJob.assignedPrinter;
+ printer: root.printJon && root.printJob.assignedPrinter;
printJob: root.printJob;
}
}
@@ -398,11 +398,13 @@ Item {
}
text: catalog.i18nc("@label", "Override");
visible: {
- var length = printJob.configurationChanges.length;
- for (var i = 0; i < length; i++) {
- var typeOfChange = printJob.configurationChanges[i].typeOfChange;
- if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
- return false;
+ if (printJob && printJob.configurationChanges) {
+ var length = printJob.configurationChanges.length;
+ for (var i = 0; i < length; i++) {
+ var typeOfChange = printJob.configurationChanges[i].typeOfChange;
+ if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
+ return false;
+ }
}
}
return true;
@@ -418,6 +420,9 @@ Item {
onYes: OutputDevice.forceSendJob(printJob.key);
standardButtons: StandardButton.Yes | StandardButton.No;
text: {
+ if (!root.job) {
+ return "";
+ }
var printJobName = formatPrintJobName(printJob.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
index 9dc7dff62e..bfbddb7dce 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
@@ -27,7 +27,7 @@ Column {
anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
- text: job ? job.name : "";
+ text: job && job.name ? job.name : "";
visible: job;
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index ebfe160e06..1dcf5fd3ad 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -161,12 +161,15 @@ Item {
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: {
+ if (!printer) {
+ return "";
+ }
if (printer.state == "disabled") {
return catalog.i18nc("@label", "Not available");
} else if (printer.state == "unreachable") {
return catalog.i18nc("@label", "Unreachable");
}
- if (printer.activePrintJob != null) {
+ if (printer.activePrintJob != null && printer.activePrintJob.name) {
return printer.activePrintJob.name;
}
return catalog.i18nc("@label", "Available");
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index 0971776cc6..35a9372713 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -60,7 +60,7 @@ Item {
PrintJobPreview {
- job: root.printer.activePrintJob;
+ job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null;
anchors.horizontalCenter: parent.horizontalCenter;
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
index 4fac99f7a2..81ad95bea9 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -8,7 +8,7 @@ import UM 1.3 as UM
ProgressBar {
property var progress: {
- if (printer.activePrintJob == null) {
+ if (!printer || printer.activePrintJob == null) {
return 0;
}
var result = printer.activePrintJob.timeElapsed / printer.activePrintJob.timeTotal;
@@ -25,11 +25,10 @@ ProgressBar {
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
time from ever being less than 0. Negative durations cause strange behavior such
as displaying "-1h -1m". */
- var activeJob = printer.activePrintJob;
- return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
+ return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0);
}
property var progressText: {
- if (printer.activePrintJob == null) {
+ if (!printer.activePrintJob || !printer.activePrintJob.state ) {
return "";
}
switch (printer.activePrintJob.state) {
@@ -65,6 +64,9 @@ ProgressBar {
progress: Rectangle {
id: progressItem;
color: {
+ if (!printer.activePrintJob) {
+ return "black";
+ }
var state = printer.activePrintJob.state
var inactiveStates = [
"pausing",
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
index b054eb458f..1b20593f9a 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -41,7 +41,7 @@ Item {
}
PrinterFamilyPill {
- text: printer.type;
+ text: printer ? printer.type : "";
visible: !compatiblePills.visible && printer;
}
}
From b99bc06d1cc8a3353981cee13135da9ebb8b3e7a Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Tue, 16 Oct 2018 09:34:50 +0200
Subject: [PATCH 19/31] Clean up more errors
Contributes to CL-1051
---
.../resources/qml/PrintJobContextMenu.qml | 4 ++--
plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml | 3 +++
.../UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml | 4 ++--
.../resources/qml/PrinterCardProgressBar.qml | 6 +++---
.../UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml | 1 -
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 7b956a2101..da4499adf6 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -39,8 +39,8 @@ Item {
Popup {
id: popup;
background: Item {
- height: popup.height;
- width: popup.width;
+ height: childrenRect.height;
+ width: childrenRect.width;
DropShadow {
anchors.fill: pointedRectangle;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index 1dcf5fd3ad..61009a0ec3 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -77,6 +77,9 @@ Item {
UM.RecolorImage {
anchors.centerIn: parent;
color: {
+ if (!printer) {
+ return "black";
+ }
if (printer.state == "disabled") {
return UM.Theme.getColor("monitor_tab_text_inactive");
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index 35a9372713..d0aa4bf80a 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -35,7 +35,7 @@ Item {
PrinterInfoBlock {
printer: root.printer;
- printJob: root.printer.activePrintJob;
+ printJob: root.printer ? root.printer.activePrintJob : null;
}
HorizontalLine {}
@@ -45,7 +45,7 @@ Item {
width: parent.width;
PrintJobTitle {
- job: root.printer.activePrintJob;
+ job: root.printer ? root.printer.activePrintJob : null;
}
PrintJobContextMenu {
id: contextButton;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
index 81ad95bea9..d31dd09af3 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -19,7 +19,7 @@ ProgressBar {
}
style: ProgressBarStyle {
property var remainingTime: {
- if (printer.activePrintJob == null) {
+ if (!printer || printer.activePrintJob == null) {
return 0;
}
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
@@ -28,7 +28,7 @@ ProgressBar {
return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0);
}
property var progressText: {
- if (!printer.activePrintJob || !printer.activePrintJob.state ) {
+ if (printer === null ) {
return "";
}
switch (printer.activePrintJob.state) {
@@ -64,7 +64,7 @@ ProgressBar {
progress: Rectangle {
id: progressItem;
color: {
- if (!printer.activePrintJob) {
+ if (! printer || !printer.activePrintJob) {
return "black";
}
var state = printer.activePrintJob.state
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
index 1b20593f9a..92a8f1dcb3 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
@@ -24,7 +24,6 @@ Item {
anchors {
left: parent.left;
right: parent.right;
-
}
height: childrenRect.height;
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
From 2dcfc049bae3acfebd6ece56fac7e28f940950fc Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 17 Oct 2018 14:28:17 +0200
Subject: [PATCH 20/31] Remove skeleton loading after print jobs received
Contributes to CL-1051
---
.../resources/qml/ClusterMonitorItem.qml | 3 ++-
plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index 6148a53343..eb52bdc513 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -70,7 +70,7 @@ Component {
top: queuedLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
}
- visible: printJobList.count === 0;
+ visible: !queuedPrintJobs.visible;
width: Math.min(800 * screenScaleFactor, maximumWidth);
PrintJobInfoBlock {
@@ -104,6 +104,7 @@ Component {
bottom: parent.bottom;
}
style: UM.Theme.styles.scrollview;
+ visible: OutputDevice.receivedPrintJobs;
width: Math.min(800 * screenScaleFactor, maximumWidth);
ListView {
diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
index 88ac1c1e76..4c7b93c145 100644
--- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
+++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py
@@ -48,6 +48,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
printJobsChanged = pyqtSignal()
activePrinterChanged = pyqtSignal()
activeCameraChanged = pyqtSignal()
+ receivedPrintJobsChanged = pyqtSignal()
# This is a bit of a hack, as the notify can only use signals that are defined by the class that they are in.
# Inheritance doesn't seem to work. Tying them together does work, but i'm open for better suggestions.
@@ -62,6 +63,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._dummy_lambdas = ("", {}, io.BytesIO()) #type: Tuple[str, Dict, Union[io.StringIO, io.BytesIO]]
self._print_jobs = [] # type: List[UM3PrintJobOutputModel]
+ self._received_print_jobs = False # type: bool
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterMonitorItem.qml")
self._control_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterControlItem.qml")
@@ -353,6 +355,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
def printJobs(self)-> List[UM3PrintJobOutputModel]:
return self._print_jobs
+ @pyqtProperty(bool, notify = receivedPrintJobsChanged)
+ def receivedPrintJobs(self) -> bool:
+ return self._received_print_jobs
+
@pyqtProperty("QVariantList", notify = printJobsChanged)
def queuedPrintJobs(self) -> List[UM3PrintJobOutputModel]:
return [print_job for print_job in self._print_jobs if print_job.state == "queued" or print_job.state == "error"]
@@ -461,6 +467,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self.get("print_jobs/{uuid}/preview_image".format(uuid=print_job.key), on_finished=self._onGetPreviewImageFinished)
def _onGetPrintJobsFinished(self, reply: QNetworkReply) -> None:
+ self._received_print_jobs = True
+ self.receivedPrintJobsChanged.emit()
+
if not checkValidGetReply(reply):
return
From 6f33c4410c090166112909bd4e38290066a5ff43 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 17 Oct 2018 14:39:42 +0200
Subject: [PATCH 21/31] Review tweaks
Contributes to CL-897 and CL-1051
---
.../resources/qml/ConfigurationChangeBlock.qml | 2 +-
plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index 63815b58bf..3d55ee40e2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -185,7 +185,7 @@ Item {
}
text: catalog.i18nc("@label", "Override");
visible: {
- if (root.job & root.job.configurationChanges) {
+ if (root.job && root.job.configurationChanges) {
var length = root.job.configurationChanges.length;
for (var i = 0; i < length; i++) {
var typeOfChange = root.job.configurationChanges[i].typeOfChange;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index 61009a0ec3..fa4fada0bb 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -233,7 +233,7 @@ Item {
// Progress bar
PrinterCardProgressBar {
- visible: printer && printer.activePrintJob != null && printer.activePrintJob != undefined;
+ visible: printer && printer.activePrintJob != null;
}
}
}
From 1ad008f45cbea479a1a99c31e8188eb731732d8d Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 17 Oct 2018 16:32:30 +0200
Subject: [PATCH 22/31] Style improvements
Contributes to CL-897 and CL-1051
---
.../resources/qml/ConfigurationChangeBlock.qml | 1 -
.../resources/qml/PrintCoreConfiguration.qml | 1 -
.../resources/qml/PrintJobContextMenu.qml | 4 ++--
.../resources/qml/PrinterCardDetails.qml | 10 ++++++++--
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index 3d55ee40e2..29996e405f 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -36,7 +36,6 @@ Item {
anchors {
left: parent.left;
right: parent.right;
- top: parent.top;
}
color: {
if(configurationChangeToggle.containsMouse) {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index e8abb8109e..84ecd71d7c 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -15,7 +15,6 @@ Item {
// Extruder circle
Item {
id: extruderCircle;
- anchors.verticalCenter: parent.verticalCenter;
height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index da4499adf6..7b956a2101 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -39,8 +39,8 @@ Item {
Popup {
id: popup;
background: Item {
- height: childrenRect.height;
- width: childrenRect.width;
+ height: popup.height;
+ width: popup.width;
DropShadow {
anchors.fill: pointedRectangle;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index d0aa4bf80a..bc819b3aaa 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -10,6 +10,7 @@ import QtQuick.Controls 1.4 as LegacyControls
import UM 1.3 as UM
Item {
+ id: root;
property var printer: null;
property var printJob: printer ? printer.activePrintJob : null;
property var collapsed: true;
@@ -38,10 +39,13 @@ Item {
printJob: root.printer ? root.printer.activePrintJob : null;
}
- HorizontalLine {}
+ HorizontalLine {
+ visible: root.printJob;
+ }
Row {
height: childrenRect.height;
+ visible: root.printJob;
width: parent.width;
PrintJobTitle {
@@ -60,8 +64,9 @@ Item {
PrintJobPreview {
- job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null;
anchors.horizontalCenter: parent.horizontalCenter;
+ job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null;
+ visible: root.printJob;
}
}
@@ -74,5 +79,6 @@ Item {
leftMargin: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
}
iconSource: "../svg/camera-icon.svg";
+ visible: root.printJob;
}
}
From 817899686ac1cb40c84c7795e9066eb54dee9a27 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Fri, 19 Oct 2018 16:23:16 +0200
Subject: [PATCH 23/31] Dark mode theme improvements
Contributes to CL-1111
---
.../resources/qml/CameraButton.qml | 2 +-
.../resources/qml/ClusterControlItem.qml | 12 +++----
.../resources/qml/ClusterMonitorItem.qml | 3 +-
.../qml/ConfigurationChangeBlock.qml | 2 +-
.../resources/qml/HorizontalLine.qml | 2 +-
.../resources/qml/PrintCoreConfiguration.qml | 25 +++++++------
.../resources/qml/PrintJobContextMenu.qml | 22 ++++++------
.../resources/qml/PrintJobContextMenuItem.qml | 3 +-
.../resources/qml/PrintJobInfoBlock.qml | 35 +++++++++++--------
.../resources/qml/PrintJobPreview.qml | 6 ++--
.../resources/qml/PrintJobTitle.qml | 12 ++++---
.../resources/qml/PrinterCard.qml | 32 ++++++++---------
.../resources/qml/PrinterCardProgressBar.qml | 8 ++---
.../resources/qml/PrinterFamilyPill.qml | 7 ++--
resources/themes/cura-dark/theme.json | 21 ++++++++++-
resources/themes/cura-light/theme.json | 35 +++++++++++++------
16 files changed, 137 insertions(+), 90 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
index 4b78448a8d..f9c0d6d1e2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
@@ -9,7 +9,7 @@ import Cura 1.0 as Cura
Rectangle {
property var iconSource: null;
- color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary");
+ color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary"); // "Cura Blue"
height: width;
radius: 0.5 * width;
width: 36 * screenScaleFactor;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
index 3da155cfad..068c369a3f 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
@@ -10,11 +10,10 @@ import Cura 1.0 as Cura
Component {
Rectangle {
id: base;
- property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme.
- property var shadowRadius: 5 * screenScaleFactor;
- property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme.
+ property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width;
+ property var cornerRadius: UM.Theme.getSize("monitor_corner_radius").width;
anchors.fill: parent;
- color: "white";
+ color: UM.Theme.getColor("sidebar");
visible: OutputDevice != null;
UM.I18nCatalog {
@@ -31,6 +30,7 @@ Component {
right: parent.right;
top: parent.top;
}
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("large");
text: catalog.i18nc("@label", "Printing");
@@ -43,9 +43,9 @@ Component {
right: printerScrollView.right;
rightMargin: 4 * UM.Theme.getSize("default_margin").width;
}
- color: UM.Theme.getColor("primary");
+ color: UM.Theme.getColor("primary"); // "Cura Blue"
font: UM.Theme.getFont("default");
- linkColor: UM.Theme.getColor("primary");
+ linkColor: UM.Theme.getColor("primary"); // "Cura Blue"
text: catalog.i18nc("@label link to connect manager", "Manage printers");
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index eb52bdc513..c26425cd3e 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -11,8 +11,7 @@ Component {
Rectangle {
id: monitorFrame;
property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight");
- property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme.
- property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme.
+ property var cornerRadius: UM.Theme.getSize("monitor_corner_radius").width;
color: UM.Theme.getColor("viewport_background");
height: maximumHeight;
onVisibleChanged: {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index 29996e405f..b1ebca3680 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -115,7 +115,7 @@ Item {
id: configChangeDetails
Behavior on height { NumberAnimation { duration: 100 } }
color: "transparent";
- height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0;
+ height: visible ? UM.Theme.getSize("monitor_config_override_box").height : 0;
visible: false;
width: parent.width;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
index e9cee177fa..aeb92697ad 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
@@ -6,7 +6,7 @@ import QtQuick.Controls 2.0
import UM 1.3 as UM
Rectangle {
- color: UM.Theme.getColor("monitor_tab_lining_inactive"); // TODO: Maybe theme separately? Maybe not.
+ color: UM.Theme.getColor("monitor_lining_light"); // TODO: Maybe theme separately? Maybe not.
height: UM.Theme.getSize("default_lining").height;
width: parent.width;
}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index 84ecd71d7c..54f82142c2 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -15,13 +15,13 @@ Item {
// Extruder circle
Item {
id: extruderCircle;
- height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
- width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
+ height: UM.Theme.getSize("monitor_extruder_circle").height;
+ width: UM.Theme.getSize("monitor_extruder_circle").width;
// Loading skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background");
+ color: UM.Theme.getColor("monitor_skeleton_fill");
radius: Math.round(width / 2);
visible: !printCoreConfiguration;
}
@@ -29,8 +29,9 @@ Item {
// Actual content
Rectangle {
anchors.fill: parent;
- border.width: UM.Theme.getSize("monitor_tab_thick_lining").width;
- border.color: UM.Theme.getColor("monitor_tab_lining_active");
+ border.width: UM.Theme.getSize("monitor_thick_lining").width;
+ border.color: UM.Theme.getColor("monitor_lining_heavy");
+ color: "transparent";
opacity: {
if (printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null) {
return 0.5;
@@ -42,6 +43,7 @@ Item {
Label {
anchors.centerIn: parent;
+ color: UM.Theme.getColor("text");
font: UM.Theme.getFont("default_bold");
text: printCoreConfiguration ? printCoreConfiguration.position + 1 : 0;
}
@@ -57,12 +59,12 @@ Item {
right: parent.right;
top: parent.top;
}
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
// Loading skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background");
+ color: UM.Theme.getColor("monitor_skeleton_fill");
visible: !extruderInfo.printCoreConfiguration;
}
@@ -70,6 +72,7 @@ Item {
Label {
anchors.fill: parent;
elide: Text.ElideRight;
+ color: UM.Theme.getColor("text");
font: UM.Theme.getFont("default");
text: {
if (printCoreConfiguration && printCoreConfiguration.activeMaterial != undefined) {
@@ -84,16 +87,17 @@ Item {
Item {
id: printCoreLabel;
anchors {
- bottom: parent.bottom;
left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width;
right: parent.right;
+ top: materialLabel.bottom;
+ topMargin: Math.floor(UM.Theme.getSize("default_margin").height/4);
}
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
// Loading skeleton
Rectangle {
- color: UM.Theme.getColor("viewport_background");
+ color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !extruderInfo.printCoreConfiguration;
width: parent.width / 3;
@@ -101,6 +105,7 @@ Item {
// Actual content
Label {
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
opacity: 0.6;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 7b956a2101..618bc1337b 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -16,15 +16,15 @@ Item {
Button {
id: button;
background: Rectangle {
- color: UM.Theme.getColor("viewport_background");
+ color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: button.height;
opacity: button.down || button.hovered ? 1 : 0;
radius: 0.5 * width;
width: button.width;
}
contentItem: Label {
- color: UM.Theme.getColor("monitor_tab_text_inactive");
- font.pixelSize: 25;
+ color: UM.Theme.getColor("monitor_context_menu_dots");
+ font.pixelSize: 25 * screenScaleFactor;
horizontalAlignment: Text.AlignHCenter;
text: button.text;
verticalAlignment: Text.AlignVCenter;
@@ -33,7 +33,7 @@ Item {
hoverEnabled: true;
onClicked: parent.switchPopupState();
text: "\u22EE"; //Unicode; Three stacked points.
- width: 35;
+ width: 35 * screenScaleFactor; // TODO: Theme!
}
Popup {
@@ -45,10 +45,10 @@ Item {
DropShadow {
anchors.fill: pointedRectangle;
color: "#3F000000"; // 25% shadow
- radius: 5;
+ radius: UM.Theme.getSize("monitor_shadow_radius").width;
source: pointedRectangle;
transparentBorder: true;
- verticalOffset: 2;
+ verticalOffset: 2 * screenScaleFactor;
}
Item {
@@ -64,15 +64,15 @@ Item {
id: point;
anchors {
right: bloop.right;
- rightMargin: 24;
+ rightMargin: 24 * screenScaleFactor;
}
- color: UM.Theme.getColor("setting_control");
+ color: UM.Theme.getColor("monitor_context_menu_background");
height: 14 * screenScaleFactor;
transform: Rotation {
angle: 45;
}
width: 14 * screenScaleFactor;
- y: 1;
+ y: 1 * screenScaleFactor;
}
Rectangle {
@@ -83,7 +83,7 @@ Item {
top: parent.top;
topMargin: 8 * screenScaleFactor; // Because of the shadow + point
}
- color: UM.Theme.getColor("setting_control");
+ color: UM.Theme.getColor("monitor_context_menu_background");
width: parent.width;
}
}
@@ -162,7 +162,7 @@ Item {
height: contentItem.height + 2 * padding;
onClosed: visible = false;
onOpened: visible = true;
- padding: 5 * screenScaleFactor; // Because shadow
+ padding: UM.Theme.getSize("monitor_shadow_radius").width;
transformOrigin: Popup.Top;
visible: false;
width: 182 * screenScaleFactor;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
index 3a55978a3f..1b0777a8c0 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml
@@ -9,9 +9,10 @@ import UM 1.3 as UM
Button {
background: Rectangle {
opacity: parent.down || parent.hovered ? 1 : 0;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_context_menu_highlight");
}
contentItem: Label {
+ color: UM.Theme.getColor("text");
text: parent.text
horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignVCenter;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index fcdf3ba955..8426834721 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -12,7 +12,7 @@ import UM 1.3 as UM
Item {
id: root;
- property var shadowRadius: 5 * screenScaleFactor;
+ property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width;
property var shadowOffset: 2 * screenScaleFactor;
property var debug: false;
property var printJob: null;
@@ -33,7 +33,7 @@ Item {
rightMargin: root.shadowRadius;
topMargin: root.shadowRadius - root.shadowOffset;
}
- color: "white"; // TODO: Theme!
+ color: UM.Theme.getColor("monitor_card_background");
height: childrenRect.height;
layer.enabled: true
layer.effect: DropShadow {
@@ -66,16 +66,17 @@ Item {
Item {
id: printJobName;
width: parent.width;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
Rectangle {
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !printJob;
width: parent.width / 3;
}
Label {
anchors.fill: parent;
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: printJob && printJob.name ? printJob.name : ""; // Supress QML warnings
@@ -89,17 +90,18 @@ Item {
top: printJobName.bottom;
topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2);
}
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
width: parent.width;
Rectangle {
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !printJob;
width: parent.width / 2;
}
Label {
anchors.fill: parent;
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: printJob ? printJob.owner : ""; // Supress QML warnings
@@ -121,8 +123,8 @@ Item {
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill");
+ radius: UM.Theme.getSize("default_margin").width;
visible: !printJob;
}
@@ -139,7 +141,7 @@ Item {
id: ultiBotImage;
anchors.centerIn: printJobPreview;
- color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_placeholder_image");
height: printJobPreview.height;
source: "../svg/ultibot.svg";
sourceSize {
@@ -155,7 +157,7 @@ Item {
UM.RecolorImage {
id: statusImage;
anchors.centerIn: printJobPreview;
- color: "black";
+ color: UM.Theme.getColor("monitor_image_overlay");
height: 0.5 * printJobPreview.height;
source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : "";
sourceSize {
@@ -174,7 +176,7 @@ Item {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
}
- color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
+ color: !printJob ? UM.Theme.getColor("monitor_skeleton_fill") : UM.Theme.getColor("monitor_lining_light");
height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
width: UM.Theme.getSize("default_lining").width;
}
@@ -191,16 +193,17 @@ Item {
Item {
id: targetPrinterLabel;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
width: parent.width;
Rectangle {
visible: !printJob;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill");
anchors.fill: parent;
}
Label {
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: {
@@ -265,7 +268,7 @@ Item {
}
Rectangle {
- color: "#e6e6e6"; // TODO: Theme!
+ color: !printJob ? UM.Theme.getColor("monitor_skeleton_fill") : UM.Theme.getColor("monitor_lining_light");
height: UM.Theme.getSize("default_lining").height;
width: parent.width;
}
@@ -292,6 +295,7 @@ Item {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
}
+ color: UM.Theme.getColor("text");
text: catalog.i18nc("@label", "Configuration change");
}
@@ -333,7 +337,7 @@ Item {
anchors.top: configChangeToggle.bottom;
Behavior on height { NumberAnimation { duration: 100 } }
// In case of really massive multi-line configuration changes
- height: visible ? Math.max(UM.Theme.getSize("monitor_tab_config_override_box").height, childrenRect.height) : 0;
+ height: visible ? Math.max(UM.Theme.getSize("monitor_config_override_box").height, childrenRect.height) : 0;
visible: false;
width: parent.width;
@@ -350,6 +354,7 @@ Item {
Label {
anchors.fill: parent;
elide: Text.ElideRight;
+ color: UM.Theme.getColor("text");
font: UM.Theme.getFont("large_nonbold");
text: {
if (!printJob || printJob.configurationChanges.length === 0) {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
index 8d80377e99..50308e28a9 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
@@ -20,8 +20,8 @@ Item {
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
- radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill");
+ radius: UM.Theme.getSize("default_margin").width;
visible: !job;
}
@@ -46,7 +46,7 @@ Item {
UM.RecolorImage {
id: ultibotImage;
anchors.centerIn: parent;
- color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_placeholder_image"); // TODO: Theme!
height: parent.height;
source: "../svg/ultibot.svg";
sourceSize {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
index bfbddb7dce..5e226d19e9 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
@@ -13,11 +13,12 @@ Column {
Item {
id: jobName;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
width: parent.width;
+ // Skeleton loading
Rectangle {
- color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
+ color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !job;
width: parent.width / 3;
@@ -25,6 +26,7 @@ Column {
Label {
anchors.fill: parent;
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: job && job.name ? job.name : "";
@@ -34,11 +36,12 @@ Column {
Item {
id: ownerName;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
width: parent.width;
+ // Skeleton loading
Rectangle {
- color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
+ color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !job;
width: parent.width / 2;
@@ -46,6 +49,7 @@ Column {
Label {
anchors.fill: parent;
+ color: UM.Theme.getColor("text")
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: job ? job.owner : "";
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index fa4fada0bb..bd72ccb3dd 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -27,10 +27,13 @@ Item {
topMargin: root.shadowRadius - root.shadowOffset;
}
color: {
+ if (!printer) {
+ return UM.Theme.getColor("monitor_card_background_inactive");
+ }
if (printer.state == "disabled") {
- return UM.Theme.getColor("monitor_tab_background_inactive");
+ return UM.Theme.getColor("monitor_card_background_inactive");
} else {
- return UM.Theme.getColor("monitor_tab_background_active");
+ return UM.Theme.getColor("monitor_card_background");
}
}
height: childrenRect.height;
@@ -68,7 +71,7 @@ Item {
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill"); // TODO: Theme!
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
visible: !printer;
}
@@ -77,16 +80,10 @@ Item {
UM.RecolorImage {
anchors.centerIn: parent;
color: {
- if (!printer) {
- return "black";
+ if (printer && printer.activePrintJob != undefined) {
+ return UM.Theme.getColor("monitor_printer_icon");
}
- if (printer.state == "disabled") {
- return UM.Theme.getColor("monitor_tab_text_inactive");
- }
- if (printer.activePrintJob != undefined) {
- return UM.Theme.getColor("primary");
- }
- return UM.Theme.getColor("monitor_tab_text_inactive");
+ return UM.Theme.getColor("monitor_printer_icon_inactive");
}
height: sourceSize.height;
source: {
@@ -119,19 +116,20 @@ Item {
// Machine name
Item {
id: machineNameLabel;
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
width: parent.width * 0.3;
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill"); // TODO: Theme!
visible: !printer;
}
// Actual content
Label {
anchors.fill: parent;
+ color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: printer.name;
@@ -147,20 +145,20 @@ Item {
top: machineNameLabel.bottom;
topMargin: Math.round(UM.Theme.getSize("default_margin").height / 2);
}
- height: UM.Theme.getSize("monitor_tab_text_line").height;
+ height: UM.Theme.getSize("monitor_text_line").height;
width: parent.width * 0.75;
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill"); // TODO: Theme!
visible: !printer;
}
// Actual content
Label {
anchors.fill: parent;
- color: UM.Theme.getColor("monitor_tab_text_inactive");
+ color: UM.Theme.getColor("monitor_text_inactive");
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
index d31dd09af3..e86c959b8c 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml
@@ -57,7 +57,7 @@ ProgressBar {
}
}
background: Rectangle {
- color: UM.Theme.getColor("viewport_background");
+ color: UM.Theme.getColor("monitor_progress_background");
implicitHeight: visible ? 24 : 0;
implicitWidth: 100;
}
@@ -75,9 +75,9 @@ ProgressBar {
"wait_cleanup"
];
if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) {
- return UM.Theme.getColor("monitor_tab_text_inactive");
+ return UM.Theme.getColor("monitor_progress_fill_inactive");
} else {
- return UM.Theme.getColor("primary");
+ return UM.Theme.getColor("monitor_progress_fill");
}
}
@@ -89,7 +89,7 @@ ProgressBar {
}
text: progressText;
anchors.verticalCenter: parent.verticalCenter;
- color: progressItem.width + progressLabel.width < control.width ? "black" : "white";
+ color: progressItem.width + progressLabel.width < control.width ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_progress_fill_text");
width: contentWidth;
font: UM.Theme.getFont("default");
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
index 24de732faf..0a88b053a8 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml
@@ -8,8 +8,8 @@ import UM 1.2 as UM
Item {
property alias text: familyNameLabel.text;
property var padding: 3 * screenScaleFactor; // TODO: Theme!
- implicitHeight: familyNameLabel.contentHeight + 2 * padding; // Apply the padding to top and bottom.
- implicitWidth: familyNameLabel.contentWidth + implicitHeight; // The extra height is added to ensure the radius doesn't cut something off.
+ implicitHeight: familyNameLabel.contentHeight + 2 * padding; // Apply the padding to top and bottom.
+ implicitWidth: Math.max(48 * screenScaleFactor, familyNameLabel.contentWidth + implicitHeight); // The extra height is added to ensure the radius doesn't cut something off.
Rectangle {
id: background;
@@ -17,7 +17,7 @@ Item {
horizontalCenter: parent.horizontalCenter;
right: parent.right;
}
- color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ color: familyNameLabel.text.length < 1 ? UM.Theme.getColor("monitor_skeleton_fill") : UM.Theme.getColor("monitor_pill_background");
height: parent.height;
radius: 0.5 * height;
width: parent.width;
@@ -26,6 +26,7 @@ Item {
Label {
id: familyNameLabel;
anchors.centerIn: parent;
+ color: UM.Theme.getColor("text");
text: "";
}
}
\ No newline at end of file
diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json
index 26e6c2ac8b..cb18979891 100644
--- a/resources/themes/cura-dark/theme.json
+++ b/resources/themes/cura-dark/theme.json
@@ -221,6 +221,25 @@
"quality_slider_available": [255, 255, 255, 255],
"quality_slider_handle": [255, 255, 255, 255],
"quality_slider_handle_hover": [127, 127, 127, 255],
- "quality_slider_text": [255, 255, 255, 255]
+ "quality_slider_text": [255, 255, 255, 255],
+
+ "monitor_card_background_inactive": [43, 48, 52, 255],
+ "monitor_card_background": [43, 48, 52, 255],
+ "monitor_context_menu_background": [80, 84, 87, 255],
+ "monitor_context_menu_dots": [0, 167, 233, 255],
+ "monitor_context_menu_highlight": [0, 167, 233, 255],
+ "monitor_image_overlay": [255, 255, 255, 255],
+ "monitor_lining_heavy": [255, 255, 255, 255],
+ "monitor_lining_light": [102, 102, 102, 255],
+ "monitor_pill_background": [102, 102, 102, 255],
+ "monitor_placeholder_image": [102, 102, 102, 255],
+ "monitor_printer_icon": [255, 255, 255, 255],
+ "monitor_progress_background_text": [102, 102, 102, 255],
+ "monitor_progress_background": [80, 84, 87, 255],
+ "monitor_progress_fill_inactive": [216, 216, 216, 255],
+ "monitor_progress_fill_text": [0, 0, 0, 255],
+ "monitor_progress_fill": [216, 216, 216, 255],
+ "monotir_printer_icon_inactive": [154, 154, 154, 255],
+ "monitor_skeleton_fill": [31, 36, 39, 255]
}
}
diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json
index 390f0ba995..9e45cbb410 100644
--- a/resources/themes/cura-light/theme.json
+++ b/resources/themes/cura-light/theme.json
@@ -323,12 +323,25 @@
"favorites_header_text_hover": [31, 36, 39, 255],
"favorites_row_selected": [196, 239, 255, 255],
- "monitor_tab_background_active": [255, 255, 255, 255],
- "monitor_tab_background_inactive": [240, 240, 240, 255],
- "monitor_tab_lining_active": [0, 0, 0, 255],
- "monitor_tab_lining_inactive": [230, 230, 230, 255],
- "monitor_tab_placeholder_image": [230, 230, 230, 255],
- "monitor_tab_text_inactive": [154, 154, 154, 255]
+ "monitor_card_background_inactive": [240, 240, 240, 255],
+ "monitor_card_background": [255, 255, 255, 255],
+ "monitor_context_menu_background": [255, 255, 255, 255],
+ "monitor_context_menu_dots": [154, 154, 154, 255],
+ "monitor_context_menu_highlight": [245, 245, 245, 255],
+ "monitor_image_overlay": [0, 0, 0, 255],
+ "monitor_lining_heavy": [0, 0, 0, 255],
+ "monitor_lining_light": [230, 230, 230, 255],
+ "monitor_pill_background": [245, 245, 245, 255],
+ "monitor_placeholder_image": [230, 230, 230, 255],
+ "monitor_printer_icon_inactive": [154, 154, 154, 255],
+ "monitor_printer_icon": [12, 169, 227, 255],
+ "monitor_progress_background_text": [0,0,0,255],
+ "monitor_progress_background": [245, 245, 245, 255],
+ "monitor_progress_fill_inactive": [154, 154, 154, 255],
+ "monitor_progress_fill_text": [255,255,255,255],
+ "monitor_progress_fill": [12, 169, 227, 255],
+ "monitor_skeleton_fill": [245, 245, 245, 255],
+ "monitor_text_inactive": [154, 154, 154, 255]
},
"sizes": {
@@ -478,9 +491,11 @@
"toolbox_action_button": [8.0, 2.5],
"toolbox_loader": [2.0, 2.0],
- "monitor_tab_config_override_box": [1.0, 14.0],
- "monitor_tab_extruder_circle": [2.75, 2.75],
- "monitor_tab_text_line": [1.16, 1.16],
- "monitor_tab_thick_lining": [0.16, 0.16]
+ "monitor_config_override_box": [1.0, 14.0],
+ "monitor_extruder_circle": [2.75, 2.75],
+ "monitor_text_line": [1.16, 1.16],
+ "monitor_thick_lining": [0.16, 0.16],
+ "monitor_corner_radius": [0.3, 0.3],
+ "monitor_shadow_radius": [0.4, 0.4]
}
}
From 34abc48a1a491de879649c259127edfbfc49902b Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 22 Oct 2018 15:31:38 +0200
Subject: [PATCH 24/31] Remove binding loops
Contributes to CL-1051
---
.../resources/qml/PrintJobContextMenu.qml | 8 ++---
.../resources/qml/PrinterCard.qml | 29 ++++++++-----------
.../resources/qml/PrinterCardDetails.qml | 4 +--
resources/themes/cura-light/theme.json | 4 ++-
4 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 618bc1337b..52edf0ed17 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -39,12 +39,11 @@ Item {
Popup {
id: popup;
background: Item {
- height: popup.height;
- width: popup.width;
+ anchors.fill: parent;
DropShadow {
anchors.fill: pointedRectangle;
- color: "#3F000000"; // 25% shadow
+ color: UM.Theme.getColor("monitor_shadow");
radius: UM.Theme.getSize("monitor_shadow_radius").width;
source: pointedRectangle;
transparentBorder: true;
@@ -96,7 +95,8 @@ Item {
top: parent.top;
topMargin: UM.Theme.getSize("default_margin").height + 10 * screenScaleFactor; // Account for the point of the box
}
- height: childrenRect.height + spacing * popupOptions.children.length + UM.Theme.getSize("default_margin").height;
+ // height: childrenRect.height + spacing * popupOptions.children.length + UM.Theme.getSize("default_margin").height;
+ height: 200;
spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2);
width: parent.width;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index bd72ccb3dd..cfa3279845 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -10,8 +10,8 @@ import UM 1.3 as UM
Item {
id: root;
- property var shadowRadius: 5;
- property var shadowOffset: 2;
+ property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width;
+ property var shadowOffset: UM.Theme.getSize("monitor_shadow_offset").width;
property var printer: null;
property var collapsed: true;
height: childrenRect.height + shadowRadius * 2; // Bubbles upward
@@ -52,21 +52,18 @@ Item {
// Main card
Item {
id: mainCard;
- // I don't know why the extra height is needed but it is in order to look proportional.
- height: childrenRect.height + 2;
+ height: 60 * screenScaleFactor + 2 * UM.Theme.getSize("default_margin").width;
width: parent.width;
// Machine icon
Item {
id: machineIcon;
anchors {
- left: parent.left;
leftMargin: UM.Theme.getSize("wide_margin").width;
margins: UM.Theme.getSize("default_margin").width;
- top: parent.top;
}
- height: 58 * screenScaleFactor;
- width: 58 * screenScaleFactor;
+ height: parent.height;
+ width: height;
// Skeleton
Rectangle {
@@ -87,6 +84,9 @@ Item {
}
height: sourceSize.height;
source: {
+ if (!printer) {
+ return "";
+ }
switch(printer.type) {
case "Ultimaker 3":
return "../svg/UM3-icon.svg";
@@ -104,20 +104,18 @@ Item {
// Printer info
Item {
id: printerInfo;
- height: childrenRect.height
anchors {
left: machineIcon.right;
- leftMargin: UM.Theme.getSize("default_margin").width;
right: collapseIcon.left;
- rightMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: machineIcon.verticalCenter;
}
+ height: childrenRect.height;
// Machine name
Item {
id: machineNameLabel;
height: UM.Theme.getSize("monitor_text_line").height;
- width: parent.width * 0.3;
+ width: Math.round(parent.width * 0.3);
// Skeleton
Rectangle {
@@ -132,7 +130,7 @@ Item {
color: UM.Theme.getColor("text");
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
- text: printer.name;
+ text: printer ? printer.name : "";
visible: printer;
width: parent.width;
}
@@ -146,7 +144,7 @@ Item {
topMargin: Math.round(UM.Theme.getSize("default_margin").height / 2);
}
height: UM.Theme.getSize("monitor_text_line").height;
- width: parent.width * 0.75;
+ width: Math.round(parent.width * 0.75);
// Skeleton
Rectangle {
@@ -214,9 +212,6 @@ Item {
Connections {
target: printerList;
onCurrentIndexChanged: {
- if (!model) {
- return;
- }
root.collapsed = printerList.currentIndex != model.index;
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
index bc819b3aaa..d7102d5493 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
@@ -57,8 +57,8 @@ Item {
right: parent.right;
rightMargin: UM.Theme.getSize("wide_margin").width;
}
- printJob: root.printer.activePrintJob;
- visible: root.printer.activePrintJob;
+ printJob: root.printer ? root.printer.activePrintJob : null;
+ visible: printJob;
}
}
diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json
index 9e45cbb410..05482d0b1f 100644
--- a/resources/themes/cura-light/theme.json
+++ b/resources/themes/cura-light/theme.json
@@ -340,6 +340,7 @@
"monitor_progress_fill_inactive": [154, 154, 154, 255],
"monitor_progress_fill_text": [255,255,255,255],
"monitor_progress_fill": [12, 169, 227, 255],
+ "monitor_shadow": [0, 0, 0, 63],
"monitor_skeleton_fill": [245, 245, 245, 255],
"monitor_text_inactive": [154, 154, 154, 255]
},
@@ -496,6 +497,7 @@
"monitor_text_line": [1.16, 1.16],
"monitor_thick_lining": [0.16, 0.16],
"monitor_corner_radius": [0.3, 0.3],
- "monitor_shadow_radius": [0.4, 0.4]
+ "monitor_shadow_radius": [0.4, 0.4],
+ "monitor_shadow_offset": [0.15, 0.15]
}
}
From 9a16d45be5060f77f7a0028c5f2265f3bd666d88 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Mon, 22 Oct 2018 16:02:55 +0200
Subject: [PATCH 25/31] Round divisions
Contributes to CL-1051, CL-897, CL-1111
---
plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml | 2 +-
.../resources/qml/PrintCoreConfiguration.qml | 2 +-
.../UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml | 4 ++--
plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
index f9c0d6d1e2..2fcf52c463 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
@@ -23,7 +23,7 @@ Rectangle {
color: UM.Theme.getColor("primary_text");
height: width;
source: iconSource;
- width: parent.width / 2;
+ width: Math.round(parent.width / 2);
}
MouseArea {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
index 54f82142c2..7bcd9ce6e4 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml
@@ -100,7 +100,7 @@ Item {
color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !extruderInfo.printCoreConfiguration;
- width: parent.width / 3;
+ width: Math.round(parent.width / 3);
}
// Actual content
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index 8426834721..dd0f2f88cf 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -72,7 +72,7 @@ Item {
color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !printJob;
- width: parent.width / 3;
+ width: Math.round(parent.width / 3);
}
Label {
anchors.fill: parent;
@@ -97,7 +97,7 @@ Item {
color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !printJob;
- width: parent.width / 2;
+ width: Math.round(parent.width / 2);
}
Label {
anchors.fill: parent;
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
index 5e226d19e9..f9f7b5ae87 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml
@@ -21,7 +21,7 @@ Column {
color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !job;
- width: parent.width / 3;
+ width: Math.round(parent.width / 3);
}
Label {
@@ -44,7 +44,7 @@ Column {
color: UM.Theme.getColor("monitor_skeleton_fill");
height: parent.height;
visible: !job;
- width: parent.width / 2;
+ width: Math.round(parent.width / 2);
}
Label {
From 1bd488dd6ca83d21ea42ff3c8c33f9374348a9e6 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Tue, 23 Oct 2018 15:25:42 +0200
Subject: [PATCH 26/31] Remove comments
Contributes to CL-897
---
plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py b/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py
index f40a0c2e6b..ef8a212b76 100644
--- a/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py
+++ b/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py
@@ -15,8 +15,6 @@ class ConfigurationChangeModel(QObject):
@pyqtProperty(int, constant = True)
def index(self) -> int:
return self._index
- # "target_id": fields.String(required=True, description="Target material guid or hotend id"),
- # "origin_id": fields.String(required=True, description="Original/current material guid or hotend id"),
@pyqtProperty(str, constant = True)
def typeOfChange(self) -> str:
From f9545a339d32e4b3d6a09c8858876bee3f5cc674 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Tue, 23 Oct 2018 15:41:56 +0200
Subject: [PATCH 27/31] QML Clean-up
Contributes to CL-897, CL-1051, CL-1111
---
plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml | 2 +-
.../UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml | 4 ++--
.../resources/qml/ConfigurationChangeBlock.qml | 6 +++---
.../UM3NetworkPrinting/resources/qml/PrintJobPreview.qml | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
index 2fcf52c463..f8dd3bc467 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml
@@ -11,7 +11,7 @@ Rectangle {
property var iconSource: null;
color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary"); // "Cura Blue"
height: width;
- radius: 0.5 * width;
+ radius: Math.round(0.5 * width);
width: 36 * screenScaleFactor;
UM.RecolorImage {
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
index c26425cd3e..c79092863e 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
@@ -51,7 +51,7 @@ Component {
id: queuedLabel;
anchors {
left: queuedPrintJobs.left;
- leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5;
+ leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5 * screenScaleFactor;
top: parent.top;
topMargin: 2 * UM.Theme.getSize("default_margin").height;
}
@@ -119,7 +119,7 @@ Component {
printJob: modelData;
}
model: OutputDevice.queuedPrintJobs;
- spacing: UM.Theme.getSize("default_margin").height - 10; // 2x the shadow radius
+ spacing: UM.Theme.getSize("default_margin").height - 2 * UM.Theme.getSize("monitor_shadow_radius").width;
}
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
index b1ebca3680..4b11a2b6be 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
@@ -39,16 +39,16 @@ Item {
}
color: {
if(configurationChangeToggle.containsMouse) {
- return UM.Theme.getColor("viewport_background"); // TODO: Theme!
+ return UM.Theme.getColor("viewport_background");
} else {
return "transparent";
}
}
- height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme!
+ height: UM.Theme.getSize("default_margin").height * 4;
width: parent.width;
Rectangle {
- color: "#e6e6e6"; // TODO: Theme!
+ color: UM.Theme.getColor("monitor_lining_light");
height: UM.Theme.getSize("default_lining").height;
width: parent.width;
}
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
index 50308e28a9..b1a73255f4 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml
@@ -63,13 +63,13 @@ Item {
id: statusImage;
anchors.centerIn: parent;
color: "black"; // TODO: Theme!
- height: 0.5 * parent.height;
+ height: Math.round(0.5 * parent.height);
source: job && job.state == "error" ? "../svg/aborted-icon.svg" : "";
sourceSize {
height: height;
width: width;
}
visible: source != "";
- width: 0.5 * parent.width;
+ width: Math.round(0.5 * parent.width);
}
}
\ No newline at end of file
From 0045559d0173b469df75ce513da79aa8c9d4e9c0 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Tue, 23 Oct 2018 15:45:44 +0200
Subject: [PATCH 28/31] QML Clean-up
Contributes to CL-897, CL-1051, CL-1111
---
.../UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 52edf0ed17..7fbd36fc83 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -19,7 +19,7 @@ Item {
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: button.height;
opacity: button.down || button.hovered ? 1 : 0;
- radius: 0.5 * width;
+ radius: Math.round(0.5 * width);
width: button.width;
}
contentItem: Label {
From a247fe204fe41a93fadb3eb314ffb2719cf24b92 Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Tue, 23 Oct 2018 16:27:45 +0200
Subject: [PATCH 29/31] Fix print job context menu height
Contributes to CL-897, CL-1051, CL-1111
---
.../UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
index 7fbd36fc83..55d3c66eb4 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml
@@ -95,8 +95,7 @@ Item {
top: parent.top;
topMargin: UM.Theme.getSize("default_margin").height + 10 * screenScaleFactor; // Account for the point of the box
}
- // height: childrenRect.height + spacing * popupOptions.children.length + UM.Theme.getSize("default_margin").height;
- height: 200;
+ height: childrenRect.height + spacing * popupOptions.children.length + UM.Theme.getSize("default_margin").height;
spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2);
width: parent.width;
From 8662e1a125fd0704785272e9819c651e64ff67dd Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 24 Oct 2018 11:13:12 +0200
Subject: [PATCH 30/31] Fix override dialog box
Contributes to CL-897
---
.../qml/ConfigurationChangeBlock.qml | 256 ------------------
.../resources/qml/PrintJobInfoBlock.qml | 2 +-
2 files changed, 1 insertion(+), 257 deletions(-)
delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
deleted file mode 100644
index 4b11a2b6be..0000000000
--- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml
+++ /dev/null
@@ -1,256 +0,0 @@
-// Copyright (c) 2018 Ultimaker B.V.
-// Cura is released under the terms of the LGPLv3 or higher.
-
-import QtQuick 2.2
-import QtQuick.Dialogs 1.1
-import QtQuick.Controls 2.0
-import QtQuick.Controls.Styles 1.4
-import QtGraphicalEffects 1.0
-import QtQuick.Layouts 1.1
-import QtQuick.Dialogs 1.1
-import UM 1.3 as UM
-
-Item {
- id: root;
- property var job: null;
- property var materialsAreKnown: {
- var conf0 = job.configuration[0];
- if (conf0 && !conf0.material.material) {
- return false;
- }
- var conf1 = job.configuration[1];
- if (conf1 && !conf1.material.material) {
- return false;
- }
- return true;
- }
- width: parent.width;
- height: childrenRect.height;
-
- Column {
- width: parent.width;
- height: childrenRect.height;
-
- // Config change toggle
- Rectangle {
- anchors {
- left: parent.left;
- right: parent.right;
- }
- color: {
- if(configurationChangeToggle.containsMouse) {
- return UM.Theme.getColor("viewport_background");
- } else {
- return "transparent";
- }
- }
- height: UM.Theme.getSize("default_margin").height * 4;
- width: parent.width;
-
- Rectangle {
- color: UM.Theme.getColor("monitor_lining_light");
- height: UM.Theme.getSize("default_lining").height;
- width: parent.width;
- }
-
- UM.RecolorImage {
- anchors {
- right: configChangeToggleLabel.left;
- rightMargin: UM.Theme.getSize("default_margin").width;
- verticalCenter: parent.verticalCenter;
- }
- color: UM.Theme.getColor("text");
- height: 23 * screenScaleFactor; // TODO: Theme!
- source: "../svg/warning-icon.svg";
- sourceSize {
- width: width;
- height: height;
- }
- width: 23 * screenScaleFactor; // TODO: Theme!
- }
-
- Label {
- id: configChangeToggleLabel;
- anchors {
- horizontalCenter: parent.horizontalCenter;
- verticalCenter: parent.verticalCenter;
- }
- text: "Configuration change"; // TODO: i18n!
- }
-
- UM.RecolorImage {
- anchors {
- left: configChangeToggleLabel.right;
- leftMargin: UM.Theme.getSize("default_margin").width;
- verticalCenter: parent.verticalCenter;
- }
- color: UM.Theme.getColor("text");
- height: 15 * screenScaleFactor; // TODO: Theme!
- source: {
- if (configChangeDetails.visible) {
- return UM.Theme.getIcon("arrow_top");
- } else {
- return UM.Theme.getIcon("arrow_bottom");
- }
- }
- sourceSize {
- width: width;
- height: height;
- }
- width: 15 * screenScaleFactor; // TODO: Theme!
- }
-
- MouseArea {
- id: configurationChangeToggle;
- anchors.fill: parent;
- hoverEnabled: true;
- onClicked: {
- configChangeDetails.visible = !configChangeDetails.visible;
- }
- }
- }
-
- // Config change details
- Rectangle {
- id: configChangeDetails
- Behavior on height { NumberAnimation { duration: 100 } }
- color: "transparent";
- height: visible ? UM.Theme.getSize("monitor_config_override_box").height : 0;
- visible: false;
- width: parent.width;
-
- Rectangle {
- anchors {
- bottomMargin: UM.Theme.getSize("wide_margin").height;
- fill: parent;
- leftMargin: UM.Theme.getSize("wide_margin").height * 4;
- rightMargin: UM.Theme.getSize("wide_margin").height * 4;
- topMargin: UM.Theme.getSize("wide_margin").height;
- }
- color: "transparent";
- clip: true;
-
- Label {
- anchors.fill: parent;
- elide: Text.ElideRight;
- font: UM.Theme.getFont("large_nonbold");
- text: {
- if (root.job === null) {
- return "";
- }
- if (root.job.configurationChanges.length === 0) {
- return "";
- }
- var topLine;
- if (root.materialsAreKnown) {
- topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").arg(root.job.assignedPrinter.name);
- } else {
- topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(root.job.assignedPrinter.name);
- }
- var result = "" + topLine +"
";
- for (var i = 0; i < root.job.configurationChanges.length; i++) {
- var change = root.job.configurationChanges[i];
- var text;
- switch (change.typeOfChange) {
- case 'material_change':
- text = catalog.i18nc("@label", "Change material %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName);
- break;
- case 'material_insert':
- text = catalog.i18nc("@label", "Load %3 as material %1 (This cannot be overridden).").arg(change.index + 1).arg(change.targetName);
- break;
- case 'print_core_change':
- text = catalog.i18nc("@label", "Change print core %1 from %2 to %3.").arg(change.index + 1).arg(change.originName).arg(change.targetName);
- break;
- case 'buildplate_change':
- text = catalog.i18nc("@label", "Change build plate to %1 (This cannot be overridden).").arg(formatBuildPlateType(change.target_name));
- break;
- default:
- text = "";
- }
- result += "" + text + "
";
- }
- return result;
- }
- wrapMode: Text.WordWrap;
- }
-
- Button {
- anchors {
- bottom: parent.bottom;
- left: parent.left;
- }
- onClicked: {
- overrideConfirmationDialog.visible = true;
- }
- text: catalog.i18nc("@label", "Override");
- visible: {
- if (root.job && root.job.configurationChanges) {
- var length = root.job.configurationChanges.length;
- for (var i = 0; i < length; i++) {
- var typeOfChange = root.job.configurationChanges[i].typeOfChange;
- if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
- return false;
- }
- }
- }
- return true;
- }
- }
- }
- }
- }
-
- MessageDialog {
- id: overrideConfirmationDialog;
- Component.onCompleted: visible = false;
- icon: StandardIcon.Warning;
- onYes: OutputDevice.forceSendJob(root.job.key);
- standardButtons: StandardButton.Yes | StandardButton.No;
- text: {
- if (!root.job) {
- return "";
- }
- var printJobName = formatPrintJobName(root.job.name);
- var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
- return confirmText;
- }
- title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
- }
-
- // Utils
- function formatPrintJobName(name) {
- var extensions = [ ".gz", ".gcode", ".ufp" ];
- for (var i = 0; i < extensions.length; i++) {
- var extension = extensions[i];
- if (name.slice(-extension.length) === extension) {
- name = name.substring(0, name.length - extension.length);
- }
- }
- return name;
- }
- function materialsAreKnown(job) {
- var conf0 = job.configuration[0];
- if (conf0 && !conf0.material.material) {
- return false;
- }
- var conf1 = job.configuration[1];
- if (conf1 && !conf1.material.material) {
- return false;
- }
- return true;
- }
- function formatBuildPlateType(buildPlateType) {
- var translationText = "";
- switch (buildPlateType) {
- case 'glass':
- translationText = catalog.i18nc("@label", "Glass");
- break;
- case 'aluminum':
- translationText = catalog.i18nc("@label", "Aluminum");
- break;
- default:
- translationText = null;
- }
- return translationText;
- }
-}
\ No newline at end of file
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
index dd0f2f88cf..0fa65ba4c4 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
@@ -425,7 +425,7 @@ Item {
onYes: OutputDevice.forceSendJob(printJob.key);
standardButtons: StandardButton.Yes | StandardButton.No;
text: {
- if (!root.job) {
+ if (!printJob) {
return "";
}
var printJobName = formatPrintJobName(printJob.name);
From d077dcc851ea5b1cb693979bfedeabf494a8f2cc Mon Sep 17 00:00:00 2001
From: Ian Paschal
Date: Wed, 24 Oct 2018 11:13:38 +0200
Subject: [PATCH 31/31] Fix printer card skeleton colors
Contributes to CL-1051
---
.../resources/qml/PrinterCard.qml | 13 ++++++++-----
resources/themes/cura-dark/theme.json | 3 ++-
resources/themes/cura-light/theme.json | 1 +
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
index cfa3279845..79a915d0d1 100644
--- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
+++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml
@@ -60,16 +60,18 @@ Item {
id: machineIcon;
anchors {
leftMargin: UM.Theme.getSize("wide_margin").width;
+ top: parent.top;
+ left: parent.left;
margins: UM.Theme.getSize("default_margin").width;
}
- height: parent.height;
+ height: parent.height - 2 * UM.Theme.getSize("default_margin").width;
width: height;
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("monitor_skeleton_fill"); // TODO: Theme!
- radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill_dark");
+ radius: UM.Theme.getSize("default_margin").width;
visible: !printer;
}
@@ -106,6 +108,7 @@ Item {
id: printerInfo;
anchors {
left: machineIcon.right;
+ leftMargin: UM.Theme.getSize("default_margin").width;
right: collapseIcon.left;
verticalCenter: machineIcon.verticalCenter;
}
@@ -120,7 +123,7 @@ Item {
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("monitor_skeleton_fill"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill_dark");
visible: !printer;
}
@@ -149,7 +152,7 @@ Item {
// Skeleton
Rectangle {
anchors.fill: parent;
- color: UM.Theme.getColor("monitor_skeleton_fill"); // TODO: Theme!
+ color: UM.Theme.getColor("monitor_skeleton_fill_dark");
visible: !printer;
}
diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json
index cb18979891..39546b6370 100644
--- a/resources/themes/cura-dark/theme.json
+++ b/resources/themes/cura-dark/theme.json
@@ -240,6 +240,7 @@
"monitor_progress_fill_text": [0, 0, 0, 255],
"monitor_progress_fill": [216, 216, 216, 255],
"monotir_printer_icon_inactive": [154, 154, 154, 255],
- "monitor_skeleton_fill": [31, 36, 39, 255]
+ "monitor_skeleton_fill": [31, 36, 39, 255],
+ "monitor_skeleton_fill_dark": [31, 36, 39, 255]
}
}
diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json
index 05482d0b1f..25c9a678c1 100644
--- a/resources/themes/cura-light/theme.json
+++ b/resources/themes/cura-light/theme.json
@@ -342,6 +342,7 @@
"monitor_progress_fill": [12, 169, 227, 255],
"monitor_shadow": [0, 0, 0, 63],
"monitor_skeleton_fill": [245, 245, 245, 255],
+ "monitor_skeleton_fill_dark": [216, 216, 216, 255],
"monitor_text_inactive": [154, 154, 154, 255]
},