mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Re-add config changes in monitor tab
Contributes to CL-1152
This commit is contained in:
parent
ad7dcf6fc0
commit
8a856f13d2
9 changed files with 210 additions and 32 deletions
|
@ -0,0 +1,131 @@
|
|||
// 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
|
||||
leftMargin: 60
|
||||
rightMargin: 60
|
||||
topMargin: 18
|
||||
bottomMargin: 56
|
||||
}
|
||||
wrapMode: Text.WordWrap
|
||||
text:
|
||||
{
|
||||
var topLine
|
||||
if (materialsAreKnown(printer.activePrintJob))
|
||||
{
|
||||
topLine = catalog.i18nc("@label", "The assigned printer, %1, requires the following configuration change(s):").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>"
|
||||
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 = [ ".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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue