mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
First steps to ensure that the Discover UM3 action works with new architecture
CL-541
This commit is contained in:
parent
1b8caa7a21
commit
4197f18fc1
4 changed files with 65 additions and 27 deletions
|
@ -10,7 +10,7 @@ Cura.MachineAction
|
|||
{
|
||||
id: base
|
||||
anchors.fill: parent;
|
||||
property var selectedPrinter: null
|
||||
property var selectedDevice: null
|
||||
property bool completeProperties: true
|
||||
|
||||
Connections
|
||||
|
@ -31,7 +31,7 @@ Cura.MachineAction
|
|||
{
|
||||
if(base.selectedPrinter && base.completeProperties)
|
||||
{
|
||||
var printerKey = base.selectedPrinter.getKey()
|
||||
var printerKey = base.selectedDevice.key
|
||||
if(manager.getStoredKey() != printerKey)
|
||||
{
|
||||
manager.setKey(printerKey);
|
||||
|
@ -83,10 +83,10 @@ Cura.MachineAction
|
|||
{
|
||||
id: editButton
|
||||
text: catalog.i18nc("@action:button", "Edit")
|
||||
enabled: base.selectedPrinter != null && base.selectedPrinter.getProperty("manual") == "true"
|
||||
enabled: base.selectedDevice != null && base.selectedDevice.getProperty("manual") == "true"
|
||||
onClicked:
|
||||
{
|
||||
manualPrinterDialog.showDialog(base.selectedPrinter.getKey(), base.selectedPrinter.ipAddress);
|
||||
manualPrinterDialog.showDialog(base.selectedDevice.key, base.selectedDevice.ipAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ Cura.MachineAction
|
|||
{
|
||||
id: removeButton
|
||||
text: catalog.i18nc("@action:button", "Remove")
|
||||
enabled: base.selectedPrinter != null && base.selectedPrinter.getProperty("manual") == "true"
|
||||
onClicked: manager.removeManualPrinter(base.selectedPrinter.getKey(), base.selectedPrinter.ipAddress)
|
||||
enabled: base.selectedDevice != null && base.selectedDevice.getProperty("manual") == "true"
|
||||
onClicked: manager.removeManualPrinter(base.selectedDevice.key, base.selectedDevice.ipAddress)
|
||||
}
|
||||
|
||||
Button
|
||||
|
@ -139,7 +139,7 @@ Cura.MachineAction
|
|||
{
|
||||
var selectedKey = manager.getStoredKey();
|
||||
for(var i = 0; i < model.length; i++) {
|
||||
if(model[i].getKey() == selectedKey)
|
||||
if(model[i].key == selectedKey)
|
||||
{
|
||||
currentIndex = i;
|
||||
return
|
||||
|
@ -151,9 +151,9 @@ Cura.MachineAction
|
|||
currentIndex: -1
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
base.selectedPrinter = listview.model[currentIndex];
|
||||
base.selectedDevice = listview.model[currentIndex];
|
||||
// Only allow connecting if the printer has responded to API query since the last refresh
|
||||
base.completeProperties = base.selectedPrinter != null && base.selectedPrinter.getProperty("incomplete") != "true";
|
||||
base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true";
|
||||
}
|
||||
Component.onCompleted: manager.startDiscovery()
|
||||
delegate: Rectangle
|
||||
|
@ -199,13 +199,13 @@ Cura.MachineAction
|
|||
Column
|
||||
{
|
||||
width: Math.floor(parent.width * 0.5)
|
||||
visible: base.selectedPrinter ? true : false
|
||||
visible: base.selectedDevice ? true : false
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
Label
|
||||
{
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedPrinter ? base.selectedPrinter.name : ""
|
||||
text: base.selectedDevice ? base.selectedDevice.name : ""
|
||||
font: UM.Theme.getFont("large")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
@ -226,12 +226,12 @@ Cura.MachineAction
|
|||
wrapMode: Text.WordWrap
|
||||
text:
|
||||
{
|
||||
if(base.selectedPrinter)
|
||||
if(base.selectedDevice)
|
||||
{
|
||||
if(base.selectedPrinter.printerType == "ultimaker3")
|
||||
if(base.selectedDevice.printerType == "ultimaker3")
|
||||
{
|
||||
return catalog.i18nc("@label", "Ultimaker 3")
|
||||
} else if(base.selectedPrinter.printerType == "ultimaker3_extended")
|
||||
} else if(base.selectedDevice.printerType == "ultimaker3_extended")
|
||||
{
|
||||
return catalog.i18nc("@label", "Ultimaker 3 Extended")
|
||||
} else
|
||||
|
@ -255,7 +255,7 @@ Cura.MachineAction
|
|||
{
|
||||
width: Math.floor(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedPrinter ? base.selectedPrinter.firmwareVersion : ""
|
||||
text: base.selectedDevice ? base.selectedDevice.firmwareVersion : ""
|
||||
}
|
||||
Label
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ Cura.MachineAction
|
|||
{
|
||||
width: Math.floor(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedPrinter ? base.selectedPrinter.ipAddress : ""
|
||||
text: base.selectedDevice ? base.selectedDevice.ipAddress : ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,17 +277,17 @@ Cura.MachineAction
|
|||
wrapMode: Text.WordWrap
|
||||
text:{
|
||||
// The property cluster size does not exist for older UM3 devices.
|
||||
if(!base.selectedPrinter || base.selectedPrinter.clusterSize == null || base.selectedPrinter.clusterSize == 1)
|
||||
if(!base.selectedDevice || base.selectedDevice.clusterSize == null || base.selectedDevice.clusterSize == 1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else if (base.selectedPrinter.clusterSize === 0)
|
||||
else if (base.selectedDevice.clusterSize === 0)
|
||||
{
|
||||
return catalog.i18nc("@label", "This printer is not set up to host a group of Ultimaker 3 printers.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label", "This printer is the host for a group of %1 Ultimaker 3 printers.".arg(base.selectedPrinter.clusterSize));
|
||||
return catalog.i18nc("@label", "This printer is the host for a group of %1 Ultimaker 3 printers.".arg(base.selectedDevice.clusterSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,14 +296,14 @@ Cura.MachineAction
|
|||
{
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
visible: base.selectedPrinter != null && !base.completeProperties
|
||||
visible: base.selectedDevice != null && !base.completeProperties
|
||||
text: catalog.i18nc("@label", "The printer at this address has not yet responded." )
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Connect")
|
||||
enabled: (base.selectedPrinter && base.completeProperties) ? true : false
|
||||
enabled: (base.selectedDevice && base.completeProperties) ? true : false
|
||||
onClicked: connectToPrinter()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue