Merge pull request #5726 from Ultimaker/CL-1331_use_API_for_UM3NetworkPrinting

CL-1331 Extending the Cura API for the Network Printing Plugin
This commit is contained in:
Simon Edwards 2019-05-15 11:11:49 +02:00 committed by GitHub
commit bec7b6546d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 180 additions and 88 deletions

View file

@ -27,13 +27,14 @@ Cura.MachineAction
{
var printerKey = base.selectedDevice.key
var printerName = base.selectedDevice.name // TODO To change when the groups have a name
if (manager.getStoredKey() != printerKey)
if (Cura.API.machines.getCurrentMachine().um_network_key != printerKey) // TODO: change to hostname
{
// Check if there is another instance with the same key
if (!manager.existsKey(printerKey))
{
manager.associateActiveMachineWithPrinterDevice(base.selectedDevice)
manager.setGroupName(printerName) // TODO To change when the groups have a name
Cura.API.machines.addOutputDeviceToCurrentMachine(base.selectedDevice)
Cura.API.machines.setCurrentMachineGroupName(printerName) // TODO To change when the groups have a name
manager.refreshConnections()
completed()
}
else
@ -156,7 +157,7 @@ Cura.MachineAction
var selectedKey = manager.getLastManualEntryKey()
// If there is no last manual entry key, then we select the stored key (if any)
if (selectedKey == "")
selectedKey = manager.getStoredKey()
selectedKey = Cura.API.machines.getCurrentMachine().um_network_key // TODO: change to host name
for(var i = 0; i < model.length; i++) {
if(model[i].key == selectedKey)
{