mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 13:03:59 -06:00
Merge pull request #4959 from Ultimaker/CL-1152_config_change_monitor_tab
CL-1152 config change monitor tab
This commit is contained in:
commit
d43ba59b7c
20 changed files with 227 additions and 1444 deletions
|
@ -1,110 +0,0 @@
|
|||
// 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
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Component {
|
||||
Rectangle {
|
||||
id: base;
|
||||
property var shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width;
|
||||
property var cornerRadius: UM.Theme.getSize("monitor_corner_radius").width;
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("main_background");
|
||||
visible: OutputDevice != null;
|
||||
|
||||
UM.I18nCatalog {
|
||||
id: catalog;
|
||||
name: "cura";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
color: UM.Theme.getColor("text");
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("large");
|
||||
text: catalog.i18nc("@label", "Printing");
|
||||
}
|
||||
|
||||
Label {
|
||||
id: managePrintersLabel;
|
||||
anchors {
|
||||
bottom: printingLabel.bottom;
|
||||
right: printerScrollView.right;
|
||||
rightMargin: 4 * UM.Theme.getSize("default_margin").width;
|
||||
}
|
||||
color: UM.Theme.getColor("primary"); // "Cura Blue"
|
||||
font: UM.Theme.getFont("default");
|
||||
linkColor: UM.Theme.getColor("primary"); // "Cura Blue"
|
||||
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;
|
||||
}
|
||||
|
||||
// Skeleton loading
|
||||
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;
|
||||
|
||||
PrinterCard {
|
||||
printer: null;
|
||||
}
|
||||
PrinterCard {
|
||||
printer: null;
|
||||
}
|
||||
}
|
||||
|
||||
// Actual content
|
||||
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;
|
||||
|
||||
ListView {
|
||||
id: printerList;
|
||||
property var currentIndex: -1;
|
||||
anchors {
|
||||
fill: parent;
|
||||
leftMargin: UM.Theme.getSize("wide_margin").width;
|
||||
rightMargin: UM.Theme.getSize("wide_margin").width;
|
||||
}
|
||||
delegate: PrinterCard {
|
||||
printer: modelData;
|
||||
}
|
||||
model: OutputDevice.printers;
|
||||
spacing: UM.Theme.getSize("default_margin").height - 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,7 +57,7 @@ Cura.MachineAction
|
|||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
SystemPalette { id: palette }
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
UM.I18nCatalog { id: catalog; name:"cura" }
|
||||
Label
|
||||
{
|
||||
id: pageTitle
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// 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
|
||||
|
||||
Rectangle {
|
||||
color: UM.Theme.getColor("monitor_lining_light"); // TODO: Maybe theme separately? Maybe not.
|
||||
height: UM.Theme.getSize("default_lining").height;
|
||||
width: parent.width;
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
// 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.Layouts 1.3
|
||||
import QtQuick.Dialogs 1.2
|
||||
import UM 1.3 as UM
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
id: overrideConfirmationDialog
|
||||
|
||||
property var printer: null
|
||||
|
||||
minimumWidth: screenScaleFactor * 640;
|
||||
minimumHeight: screenScaleFactor * 320;
|
||||
width: minimumWidth
|
||||
height: minimumHeight
|
||||
title: catalog.i18nc("@title:window", "Configuration Changes")
|
||||
rightButtons:
|
||||
[
|
||||
Button
|
||||
{
|
||||
id: overrideButton
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
text: catalog.i18nc("@action:button", "Override")
|
||||
onClicked:
|
||||
{
|
||||
OutputDevice.forceSendJob(printer.activePrintJob.key)
|
||||
overrideConfirmationDialog.close()
|
||||
}
|
||||
},
|
||||
Button
|
||||
{
|
||||
id: cancelButton
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
text: catalog.i18nc("@action:button", "Cancel")
|
||||
onClicked:
|
||||
{
|
||||
overrideConfirmationDialog.reject()
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Label
|
||||
{
|
||||
anchors
|
||||
{
|
||||
fill: parent
|
||||
margins: 36 * screenScaleFactor // TODO: Theme!
|
||||
bottomMargin: 56 * screenScaleFactor // TODO: Theme!
|
||||
}
|
||||
wrapMode: Text.WordWrap
|
||||
text:
|
||||
{
|
||||
if (!printer.activePrintJob)
|
||||
{
|
||||
return ""
|
||||
}
|
||||
var topLine
|
||||
if (materialsAreKnown(printer.activePrintJob))
|
||||
{
|
||||
topLine = catalog.i18ncp("@label", "The assigned printer, %1, requires the following configuration change:", "The assigned printer, %1, requires the following configuration changes:").arg(printer.name)
|
||||
}
|
||||
else
|
||||
{
|
||||
topLine = catalog.i18nc("@label", "The printer %1 is assigned, but the job contains an unknown material configuration.").arg(printer.name)
|
||||
}
|
||||
var result = "<p>" + topLine +"</p>\n\n"
|
||||
for (var i = 0; i < printer.activePrintJob.configurationChanges.length; i++)
|
||||
{
|
||||
var change = printer.activePrintJob.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 = "unknown"
|
||||
}
|
||||
result += "<p><b>" + text + "</b></p>"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
// Utils
|
||||
function formatPrintJobName(name)
|
||||
{
|
||||
var extensions = [ ".gcode.gz", ".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
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ Item
|
|||
|
||||
ExpandableCard
|
||||
{
|
||||
borderColor: printJob.configurationChanges.length !== 0 ? "#f5a623" : "#EAEAEC" // TODO: Theme!
|
||||
headerItem: Row
|
||||
{
|
||||
height: 48 * screenScaleFactor // TODO: Theme!
|
||||
|
|
|
@ -23,7 +23,7 @@ Item
|
|||
anchors.fill: parent
|
||||
opacity:
|
||||
{
|
||||
if (printJob && (printJob.state == "error" || !printJob.isActive))
|
||||
if (printJob && (printJob.state == "error" || printJob.configurationChanges.length > 0 || !printJob.isActive))
|
||||
{
|
||||
return 0.5
|
||||
}
|
||||
|
@ -60,6 +60,14 @@ Item
|
|||
height: 0.5 * printJobPreview.height
|
||||
source:
|
||||
{
|
||||
if (!printJob)
|
||||
{
|
||||
return ""
|
||||
}
|
||||
if (printJob.configurationChanges.length > 0)
|
||||
{
|
||||
return "../svg/warning-icon.svg"
|
||||
}
|
||||
switch(printJob.state)
|
||||
{
|
||||
case "error":
|
||||
|
@ -75,6 +83,7 @@ Item
|
|||
default:
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
}
|
||||
sourceSize
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ Item
|
|||
left: progressBar.right
|
||||
leftMargin: 18 * screenScaleFactor // TODO: Theme!
|
||||
}
|
||||
text: Math.round(printJob.progress * 100) + "%"
|
||||
text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%"
|
||||
color: printJob && printJob.isActive ? "#374355" : "#babac1" // TODO: Theme!
|
||||
width: contentWidth
|
||||
font: UM.Theme.getFont("medium") // 14pt, regular
|
||||
|
@ -88,6 +88,8 @@ Item
|
|||
return catalog.i18nc("@label:status", "Aborted")
|
||||
}
|
||||
return catalog.i18nc("@label:status", "Finished")
|
||||
case "finished":
|
||||
return catalog.i18nc("@label:status", "Finished")
|
||||
case "sent_to_printer":
|
||||
return catalog.i18nc("@label:status", "Preparing...")
|
||||
case "pre_print":
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Dialogs 1.1
|
||||
import UM 1.3 as UM
|
||||
|
||||
/**
|
||||
|
@ -66,7 +67,7 @@ Item
|
|||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
width: 216 * screenScaleFactor // TODO: Theme!
|
||||
width: 180 * screenScaleFactor // TODO: Theme!
|
||||
height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme!
|
||||
|
||||
Label
|
||||
|
@ -150,7 +151,7 @@ Item
|
|||
}
|
||||
border
|
||||
{
|
||||
color: "#EAEAEC" // TODO: Theme!
|
||||
color: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 ? "#f5a623" : "#EAEAEC" // TODO: Theme!
|
||||
width: borderSize // TODO: Remove once themed
|
||||
}
|
||||
color: "white" // TODO: Theme!
|
||||
|
@ -185,14 +186,15 @@ Item
|
|||
}
|
||||
if (printer && printer.state == "unreachable")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Unreachable")
|
||||
return catalog.i18nc("@label:status", "Unavailable")
|
||||
}
|
||||
if (printer && printer.state == "idle")
|
||||
if (printer && !printer.activePrintJob && printer.state == "idle")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Idle")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
visible: text !== ""
|
||||
}
|
||||
|
||||
Item
|
||||
|
@ -218,7 +220,7 @@ Item
|
|||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
width: 216 * screenScaleFactor // TODO: Theme!
|
||||
width: 180 * screenScaleFactor // TODO: Theme!
|
||||
height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme!
|
||||
visible: printer.activePrintJob
|
||||
|
||||
|
@ -247,7 +249,7 @@ Item
|
|||
}
|
||||
color: printer.activePrintJob && printer.activePrintJob.isActive ? "#53657d" : "#babac1" // TODO: Theme!
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("very_small") // 12pt, regular
|
||||
font: UM.Theme.getFont("default") // 12pt, regular
|
||||
text: printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N
|
||||
width: parent.width
|
||||
|
||||
|
@ -264,8 +266,67 @@ Item
|
|||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
printJob: printer.activePrintJob
|
||||
visible: printer.activePrintJob
|
||||
visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length === 0
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
anchors
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
font: UM.Theme.getFont("default")
|
||||
text: "Requires configuration changes"
|
||||
visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0
|
||||
|
||||
// FIXED-LINE-HEIGHT:
|
||||
height: 18 * screenScaleFactor // TODO: Theme!
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: detailsButton
|
||||
anchors
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 18 * screenScaleFactor // TODO: Theme!
|
||||
}
|
||||
background: Rectangle
|
||||
{
|
||||
color: "#d8d8d8" // TODO: Theme!
|
||||
radius: 2 * screenScaleFactor // Todo: Theme!
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme!
|
||||
color: detailsButton.hovered ? "#e4e4e4" : "#f0f0f0" // TODO: Theme!
|
||||
radius: 2 * screenScaleFactor // Todo: Theme!
|
||||
}
|
||||
}
|
||||
contentItem: Label
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme!
|
||||
color: "#1e66d7" // TODO: Theme!
|
||||
font: UM.Theme.getFont("medium") // 14pt, regular
|
||||
text: "Details" // TODO: I18NC!
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
height: 18 * screenScaleFactor // TODO: Theme!
|
||||
}
|
||||
implicitHeight: 32 * screenScaleFactor // TODO: Theme!
|
||||
implicitWidth: 96 * screenScaleFactor // TODO: Theme!
|
||||
visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0
|
||||
onClicked: overrideConfirmationDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
MonitorConfigOverrideDialog
|
||||
{
|
||||
id: overrideConfirmationDialog
|
||||
printer: base.printer
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import UM 1.3 as UM
|
|||
import Cura 1.0 as Cura
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
// Root component for the monitor tab (stage)
|
||||
Component
|
||||
{
|
||||
Item
|
||||
|
@ -130,7 +131,7 @@ Component
|
|||
verticalCenter: externalLinkIcon.verticalCenter
|
||||
}
|
||||
color: UM.Theme.getColor("primary")
|
||||
font: UM.Theme.getFont("default")
|
||||
font: UM.Theme.getFont("default") // 12pt, regular
|
||||
linkColor: UM.Theme.getColor("primary")
|
||||
text: catalog.i18nc("@label link to connect manager", "Manage queue in Cura Connect")
|
||||
}
|
|
@ -1,121 +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.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import UM 1.2 as UM
|
||||
|
||||
Item {
|
||||
id: extruderInfo;
|
||||
property var printCoreConfiguration: null;
|
||||
height: childrenRect.height;
|
||||
width: Math.round(parent.width / 2);
|
||||
|
||||
// Extruder circle
|
||||
Item {
|
||||
id: extruderCircle;
|
||||
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("monitor_skeleton_fill");
|
||||
radius: Math.round(width / 2);
|
||||
visible: !printCoreConfiguration;
|
||||
}
|
||||
|
||||
// Actual content
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
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;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
radius: Math.round(width / 2);
|
||||
visible: printCoreConfiguration;
|
||||
|
||||
Label {
|
||||
anchors.centerIn: parent;
|
||||
color: UM.Theme.getColor("text");
|
||||
font: UM.Theme.getFont("default_bold");
|
||||
text: printCoreConfiguration ? printCoreConfiguration.position + 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Print core and material labels
|
||||
Item {
|
||||
id: materialLabel
|
||||
anchors {
|
||||
left: extruderCircle.right;
|
||||
leftMargin: UM.Theme.getSize("default_margin").width;
|
||||
right: parent.right;
|
||||
top: parent.top;
|
||||
}
|
||||
height: UM.Theme.getSize("monitor_text_line").height;
|
||||
|
||||
// Loading skeleton
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
visible: !extruderInfo.printCoreConfiguration;
|
||||
}
|
||||
|
||||
// Actual content
|
||||
Label {
|
||||
anchors.fill: parent;
|
||||
elide: Text.ElideRight;
|
||||
color: UM.Theme.getColor("text");
|
||||
font: UM.Theme.getFont("default");
|
||||
text: {
|
||||
if (printCoreConfiguration && printCoreConfiguration.activeMaterial != undefined) {
|
||||
return printCoreConfiguration.activeMaterial.name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
visible: extruderInfo.printCoreConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: printCoreLabel;
|
||||
anchors {
|
||||
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_text_line").height;
|
||||
|
||||
// Loading skeleton
|
||||
Rectangle {
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
height: parent.height;
|
||||
visible: !extruderInfo.printCoreConfiguration;
|
||||
width: Math.round(parent.width / 3);
|
||||
}
|
||||
|
||||
// Actual content
|
||||
Label {
|
||||
color: UM.Theme.getColor("text");
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("default");
|
||||
opacity: 0.6;
|
||||
text: {
|
||||
if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) {
|
||||
return printCoreConfiguration.hotendID;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
visible: extruderInfo.printCoreConfiguration;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -182,7 +182,7 @@ Item {
|
|||
abortConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort");
|
||||
text: printJob && printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort");
|
||||
visible: {
|
||||
if (!printJob) {
|
||||
return false;
|
||||
|
|
|
@ -1,505 +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 shadowRadius: UM.Theme.getSize("monitor_shadow_radius").width;
|
||||
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
|
||||
|
||||
UM.I18nCatalog {
|
||||
id: catalog;
|
||||
name: "cura";
|
||||
}
|
||||
|
||||
// The actual card (white block)
|
||||
Rectangle {
|
||||
// 5px margin, but shifted 2px vertically because of the shadow
|
||||
anchors {
|
||||
bottomMargin: root.shadowRadius + root.shadowOffset;
|
||||
leftMargin: root.shadowRadius;
|
||||
rightMargin: root.shadowRadius;
|
||||
topMargin: root.shadowRadius - root.shadowOffset;
|
||||
}
|
||||
color: UM.Theme.getColor("monitor_card_background");
|
||||
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 {
|
||||
height: childrenRect.height;
|
||||
width: parent.width;
|
||||
|
||||
// Main content
|
||||
Item {
|
||||
id: mainContent;
|
||||
height: 200 * screenScaleFactor; // TODO: Theme!
|
||||
width: parent.width;
|
||||
|
||||
// Left content
|
||||
Item {
|
||||
anchors {
|
||||
bottom: parent.bottom;
|
||||
left: parent.left;
|
||||
margins: UM.Theme.getSize("wide_margin").width;
|
||||
right: parent.horizontalCenter;
|
||||
top: parent.top;
|
||||
}
|
||||
|
||||
Item {
|
||||
id: printJobName;
|
||||
width: parent.width;
|
||||
height: UM.Theme.getSize("monitor_text_line").height;
|
||||
|
||||
Rectangle {
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
height: parent.height;
|
||||
visible: !printJob;
|
||||
width: Math.round(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
|
||||
visible: printJob;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: printJobOwnerName;
|
||||
anchors {
|
||||
top: printJobName.bottom;
|
||||
topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2);
|
||||
}
|
||||
height: UM.Theme.getSize("monitor_text_line").height;
|
||||
width: parent.width;
|
||||
|
||||
Rectangle {
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
height: parent.height;
|
||||
visible: !printJob;
|
||||
width: Math.round(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
|
||||
visible: printJob;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: printJobPreview;
|
||||
property var useUltibot: false;
|
||||
anchors {
|
||||
bottom: parent.bottom;
|
||||
horizontalCenter: parent.horizontalCenter;
|
||||
top: printJobOwnerName.bottom;
|
||||
topMargin: UM.Theme.getSize("default_margin").height;
|
||||
}
|
||||
width: height;
|
||||
|
||||
// Skeleton
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
radius: UM.Theme.getSize("default_margin").width;
|
||||
visible: !printJob;
|
||||
}
|
||||
|
||||
// Actual content
|
||||
Image {
|
||||
id: previewImage;
|
||||
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_placeholder_image");
|
||||
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;
|
||||
}
|
||||
|
||||
UM.RecolorImage {
|
||||
id: statusImage;
|
||||
anchors.centerIn: printJobPreview;
|
||||
color: UM.Theme.getColor("monitor_image_overlay");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: totalTimeLabel;
|
||||
anchors {
|
||||
bottom: parent.bottom;
|
||||
right: parent.right;
|
||||
}
|
||||
color: UM.Theme.getColor("text");
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("default");
|
||||
text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : "";
|
||||
}
|
||||
}
|
||||
|
||||
// Divider
|
||||
Rectangle {
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter;
|
||||
verticalCenter: parent.verticalCenter;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
// Right content
|
||||
Item {
|
||||
anchors {
|
||||
bottom: parent.bottom;
|
||||
left: parent.horizontalCenter;
|
||||
margins: UM.Theme.getSize("wide_margin").width;
|
||||
right: parent.right;
|
||||
top: parent.top;
|
||||
}
|
||||
|
||||
Item {
|
||||
id: targetPrinterLabel;
|
||||
height: UM.Theme.getSize("monitor_text_line").height;
|
||||
width: parent.width;
|
||||
|
||||
Rectangle {
|
||||
visible: !printJob;
|
||||
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: {
|
||||
if (printJob !== null) {
|
||||
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 "";
|
||||
}
|
||||
visible: printJob;
|
||||
}
|
||||
}
|
||||
|
||||
PrinterInfoBlock {
|
||||
anchors.bottom: parent.bottom;
|
||||
printer: root.printJon && root.printJob.assignedPrinter;
|
||||
printJob: root.printJob;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: configChangesBox;
|
||||
height: childrenRect.height;
|
||||
visible: printJob && printJob.configurationChanges.length !== 0;
|
||||
width: parent.width;
|
||||
|
||||
// Config change toggle
|
||||
Rectangle {
|
||||
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 {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
top: parent.top;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: !printJob ? UM.Theme.getColor("monitor_skeleton_fill") : 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 {
|
||||
height: height;
|
||||
width: width;
|
||||
}
|
||||
width: 23 * screenScaleFactor; // TODO: Theme!
|
||||
}
|
||||
|
||||
Label {
|
||||
id: configChangeToggleLabel;
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter;
|
||||
verticalCenter: parent.verticalCenter;
|
||||
}
|
||||
color: UM.Theme.getColor("text");
|
||||
font: UM.Theme.getFont("default");
|
||||
text: catalog.i18nc("@label", "Configuration change");
|
||||
}
|
||||
|
||||
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: configChangeToggleArea;
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: true;
|
||||
onClicked: {
|
||||
configChangeDetails.visible = !configChangeDetails.visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Config change details
|
||||
Item {
|
||||
id: configChangeDetails;
|
||||
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_config_override_box").height, childrenRect.height) : 0;
|
||||
visible: false;
|
||||
width: parent.width;
|
||||
|
||||
Item {
|
||||
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;
|
||||
}
|
||||
clip: true;
|
||||
|
||||
Label {
|
||||
anchors.fill: parent;
|
||||
elide: Text.ElideRight;
|
||||
color: UM.Theme.getColor("text");
|
||||
font: UM.Theme.getFont("default");
|
||||
text: {
|
||||
if (!printJob || 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 = "<p>" + topLine +"</p>";
|
||||
for (var i = 0; i < printJob.configurationChanges.length; i++) {
|
||||
var change = 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 += "<p><b>" + text + "</b></p>";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
wrapMode: Text.WordWrap;
|
||||
}
|
||||
|
||||
Button {
|
||||
anchors {
|
||||
bottom: parent.bottom;
|
||||
left: parent.left;
|
||||
}
|
||||
background: Rectangle {
|
||||
border {
|
||||
color: UM.Theme.getColor("monitor_lining_heavy");
|
||||
width: UM.Theme.getSize("default_lining").width;
|
||||
}
|
||||
color: parent.hovered ? UM.Theme.getColor("monitor_card_background_inactive") : UM.Theme.getColor("monitor_card_background");
|
||||
implicitHeight: UM.Theme.getSize("default_margin").height * 3;
|
||||
implicitWidth: UM.Theme.getSize("default_margin").height * 8;
|
||||
}
|
||||
contentItem: Label {
|
||||
color: UM.Theme.getColor("text");
|
||||
font: UM.Theme.getFont("medium");
|
||||
horizontalAlignment: Text.AlignHCenter;
|
||||
text: parent.text;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
onClicked: {
|
||||
overrideConfirmationDialog.visible = true;
|
||||
}
|
||||
text: catalog.i18nc("@label", "Override");
|
||||
visible: {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: overrideConfirmationDialog;
|
||||
Component.onCompleted: visible = false;
|
||||
icon: StandardIcon.Warning;
|
||||
onYes: OutputDevice.forceSendJob(printJob.key);
|
||||
standardButtons: StandardButton.Yes | StandardButton.No;
|
||||
text: {
|
||||
if (!printJob) {
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
// 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
|
||||
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 * screenScaleFactor;
|
||||
width: height;
|
||||
|
||||
// Skeleton
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
radius: UM.Theme.getSize("default_margin").width;
|
||||
visible: !job;
|
||||
}
|
||||
|
||||
// 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;
|
||||
color: UM.Theme.getColor("monitor_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;
|
||||
}
|
||||
|
||||
UM.RecolorImage {
|
||||
id: statusImage;
|
||||
anchors.centerIn: parent;
|
||||
color: "black"; // TODO: Theme!
|
||||
height: Math.round(0.5 * parent.height);
|
||||
source: job && job.state == "error" ? "../svg/aborted-icon.svg" : "";
|
||||
sourceSize {
|
||||
height: height;
|
||||
width: width;
|
||||
}
|
||||
visible: source != "";
|
||||
width: Math.round(0.5 * parent.width);
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
// 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_text_line").height;
|
||||
width: parent.width;
|
||||
|
||||
// Skeleton loading
|
||||
Rectangle {
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
height: parent.height;
|
||||
visible: !job;
|
||||
width: Math.round(parent.width / 3);
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("text");
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("default_bold");
|
||||
text: job && job.name ? job.name : "";
|
||||
visible: job;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: ownerName;
|
||||
height: UM.Theme.getSize("monitor_text_line").height;
|
||||
width: parent.width;
|
||||
|
||||
// Skeleton loading
|
||||
Rectangle {
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill");
|
||||
height: parent.height;
|
||||
visible: !job;
|
||||
width: Math.round(parent.width / 2);
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("text")
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("default");
|
||||
text: job ? job.owner : "";
|
||||
visible: job;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,241 +0,0 @@
|
|||
// 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
|
||||
import QtQuick.Controls.Styles 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
import UM 1.3 as UM
|
||||
|
||||
Item {
|
||||
id: root;
|
||||
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
|
||||
width: parent.width; // Bubbles downward
|
||||
|
||||
// The actual card (white block)
|
||||
Rectangle {
|
||||
// 5px margin, but shifted 2px vertically because of the shadow
|
||||
anchors {
|
||||
bottomMargin: root.shadowRadius + root.shadowOffset;
|
||||
leftMargin: root.shadowRadius;
|
||||
rightMargin: root.shadowRadius;
|
||||
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_card_background_inactive");
|
||||
} else {
|
||||
return UM.Theme.getColor("monitor_card_background");
|
||||
}
|
||||
}
|
||||
height: childrenRect.height;
|
||||
layer.effect: DropShadow {
|
||||
radius: root.shadowRadius;
|
||||
verticalOffset: root.shadowOffset;
|
||||
color: "#3F000000"; // 25% shadow
|
||||
}
|
||||
layer.enabled: true
|
||||
width: parent.width - 2 * shadowRadius;
|
||||
|
||||
Column {
|
||||
id: cardContents;
|
||||
height: childrenRect.height;
|
||||
width: parent.width;
|
||||
|
||||
// Main card
|
||||
Item {
|
||||
id: mainCard;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.getSize("default_margin").width;
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||
}
|
||||
height: 60 * screenScaleFactor + 2 * UM.Theme.getSize("default_margin").height;
|
||||
width: parent.width;
|
||||
|
||||
// Machine icon
|
||||
Item {
|
||||
id: machineIcon;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
height: parent.height - 2 * UM.Theme.getSize("default_margin").width;
|
||||
width: height;
|
||||
|
||||
// Skeleton
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill_dark");
|
||||
radius: UM.Theme.getSize("default_margin").width;
|
||||
visible: !printer;
|
||||
}
|
||||
|
||||
// Content
|
||||
UM.RecolorImage {
|
||||
anchors.centerIn: parent;
|
||||
color: {
|
||||
if (printer && printer.activePrintJob != undefined) {
|
||||
return UM.Theme.getColor("monitor_printer_icon");
|
||||
}
|
||||
return UM.Theme.getColor("monitor_printer_icon_inactive");
|
||||
}
|
||||
height: sourceSize.height;
|
||||
source: {
|
||||
if (!printer) {
|
||||
return "";
|
||||
}
|
||||
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;
|
||||
anchors {
|
||||
left: machineIcon.right;
|
||||
leftMargin: UM.Theme.getSize("wide_margin").width;
|
||||
right: collapseIcon.left;
|
||||
verticalCenter: machineIcon.verticalCenter;
|
||||
}
|
||||
height: childrenRect.height;
|
||||
|
||||
// Machine name
|
||||
Item {
|
||||
id: machineNameLabel;
|
||||
height: UM.Theme.getSize("monitor_text_line").height;
|
||||
width: {
|
||||
var percent = printer ? 0.75 : 0.3;
|
||||
return Math.round(parent.width * percent);
|
||||
}
|
||||
|
||||
// Skeleton
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill_dark");
|
||||
visible: !printer;
|
||||
}
|
||||
|
||||
// Actual content
|
||||
Label {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("text");
|
||||
elide: Text.ElideRight;
|
||||
font: UM.Theme.getFont("default_bold");
|
||||
text: printer ? 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_text_line").height;
|
||||
width: Math.round(parent.width * 0.75);
|
||||
|
||||
// Skeleton
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_skeleton_fill_dark");
|
||||
visible: !printer;
|
||||
}
|
||||
|
||||
// Actual content
|
||||
Label {
|
||||
anchors.fill: parent;
|
||||
color: UM.Theme.getColor("monitor_text_inactive");
|
||||
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 && printer.activePrintJob.name) {
|
||||
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 * screenScaleFactor; // TODO: Theme!
|
||||
source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom");
|
||||
sourceSize {
|
||||
height: height;
|
||||
width: width;
|
||||
}
|
||||
visible: printer;
|
||||
width: 15 * screenScaleFactor; // TODO: Theme!
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
enabled: printer;
|
||||
onClicked: {
|
||||
if (model && root.collapsed) {
|
||||
printerList.currentIndex = model.index;
|
||||
} else {
|
||||
printerList.currentIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: printerList;
|
||||
onCurrentIndexChanged: {
|
||||
root.collapsed = printerList.currentIndex != model.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Detailed card
|
||||
PrinterCardDetails {
|
||||
collapsed: root.collapsed;
|
||||
printer: root.printer;
|
||||
visible: root.printer;
|
||||
}
|
||||
|
||||
// Progress bar
|
||||
PrinterCardProgressBar {
|
||||
visible: printer && printer.activePrintJob != null;
|
||||
width: parent.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
// 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
|
||||
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 ? printer.activePrintJob : null;
|
||||
property var collapsed: true;
|
||||
Behavior on height { NumberAnimation { duration: 100 } }
|
||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||
height: collapsed ? 0 : childrenRect.height;
|
||||
opacity: collapsed ? 0 : 1;
|
||||
width: parent.width;
|
||||
|
||||
Column {
|
||||
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("default_margin").height;
|
||||
spacing: UM.Theme.getSize("default_margin").height;
|
||||
width: parent.width;
|
||||
|
||||
HorizontalLine {}
|
||||
|
||||
PrinterInfoBlock {
|
||||
printer: root.printer;
|
||||
printJob: root.printer ? root.printer.activePrintJob : null;
|
||||
}
|
||||
|
||||
HorizontalLine {}
|
||||
|
||||
Row {
|
||||
height: childrenRect.height;
|
||||
visible: root.printJob;
|
||||
width: parent.width;
|
||||
|
||||
PrintJobTitle {
|
||||
job: root.printer ? root.printer.activePrintJob : null;
|
||||
}
|
||||
PrintJobContextMenu {
|
||||
id: contextButton;
|
||||
anchors {
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.getSize("wide_margin").width;
|
||||
}
|
||||
printJob: root.printer ? root.printer.activePrintJob : null;
|
||||
visible: printJob;
|
||||
}
|
||||
}
|
||||
|
||||
PrintJobPreview {
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null;
|
||||
visible: root.printJob;
|
||||
}
|
||||
|
||||
CameraButton {
|
||||
id: showCameraButton;
|
||||
iconSource: "../svg/camera-icon.svg";
|
||||
visible: root.printer;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
// 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
|
||||
import UM 1.3 as UM
|
||||
|
||||
ProgressBar {
|
||||
property var progress: {
|
||||
if (!printer || printer.activePrintJob == null) {
|
||||
return 0;
|
||||
}
|
||||
var result = printer.activePrintJob.timeElapsed / printer.activePrintJob.timeTotal;
|
||||
if (result > 1.0) {
|
||||
result = 1.0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
style: ProgressBarStyle {
|
||||
property var remainingTime: {
|
||||
if (!printer || 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". */
|
||||
return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0);
|
||||
}
|
||||
property var progressText: {
|
||||
if (printer === 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 {
|
||||
color: UM.Theme.getColor("monitor_progress_background");
|
||||
implicitHeight: visible ? 24 : 0;
|
||||
implicitWidth: 100;
|
||||
}
|
||||
progress: Rectangle {
|
||||
id: progressItem;
|
||||
color: {
|
||||
if (! printer || !printer.activePrintJob) {
|
||||
return "black";
|
||||
}
|
||||
var state = printer.activePrintJob.state
|
||||
var inactiveStates = [
|
||||
"pausing",
|
||||
"paused",
|
||||
"resuming",
|
||||
"wait_cleanup"
|
||||
];
|
||||
if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) {
|
||||
return UM.Theme.getColor("monitor_progress_fill_inactive");
|
||||
} else {
|
||||
return UM.Theme.getColor("monitor_progress_fill");
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: progressLabel;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: getTextOffset();
|
||||
}
|
||||
text: progressText;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
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");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
|
@ -1,32 +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.Controls 1.4
|
||||
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: Math.max(48 * screenScaleFactor, 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: 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;
|
||||
}
|
||||
|
||||
Label {
|
||||
id: familyNameLabel;
|
||||
anchors.centerIn: parent;
|
||||
color: UM.Theme.getColor("text");
|
||||
text: "";
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
// 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
|
||||
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;
|
||||
}
|
||||
height: childrenRect.height;
|
||||
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
|
||||
width: parent.width;
|
||||
|
||||
Repeater {
|
||||
id: compatiblePills;
|
||||
delegate: PrinterFamilyPill {
|
||||
text: modelData;
|
||||
}
|
||||
model: printJob ? printJob.compatibleMachineFamilies : [];
|
||||
visible: printJob;
|
||||
|
||||
}
|
||||
|
||||
PrinterFamilyPill {
|
||||
text: printer ? printer.type : "";
|
||||
visible: !compatiblePills.visible && printer;
|
||||
}
|
||||
}
|
||||
|
||||
// Extruder info
|
||||
Row {
|
||||
id: extrudersInfo;
|
||||
anchors {
|
||||
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;
|
||||
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];
|
||||
}
|
||||
if (root.printer) {
|
||||
return root.printer.printerConfiguration.extruderConfigurations[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -64,7 +64,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
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._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/MonitorStage.qml")
|
||||
|
||||
# See comments about this hack with the clusterPrintersChanged signal
|
||||
self.printersChanged.connect(self.clusterPrintersChanged)
|
||||
|
@ -608,16 +608,6 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||
def _createMaterialOutputModel(self, material_data: Dict[str, Any]) -> "MaterialOutputModel":
|
||||
material_manager = CuraApplication.getInstance().getMaterialManager()
|
||||
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
|
||||
# This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the
|
||||
# material is unknown to Cura, so we should return an "empty" or "unknown" material model.
|
||||
if material_group_list is None:
|
||||
material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown"
|
||||
return MaterialOutputModel(guid = material_data["guid"],
|
||||
type = material_data.get("type", ""),
|
||||
color = material_data.get("color", ""),
|
||||
brand = material_data.get("brand", ""),
|
||||
name = material_data.get("name", material_name)
|
||||
)
|
||||
|
||||
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
|
||||
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue