Add legacy 'Connect over Network' button back

This commit is contained in:
ChrisTerBeke 2019-08-12 01:19:41 +02:00
parent d703e48007
commit e977cdd431
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
7 changed files with 131 additions and 140 deletions

View file

@ -16,7 +16,6 @@ from .LocalClusterOutputDevice import LocalClusterOutputDevice
from ..UltimakerNetworkedPrinterOutputDevice import UltimakerNetworkedPrinterOutputDevice
from ..Messages.CloudFlowMessage import CloudFlowMessage
from ..Messages.LegacyDeviceNoLongerSupportedMessage import LegacyDeviceNoLongerSupportedMessage
from ..Messages.NotClusterHostMessage import NotClusterHostMessage
from ..Models.Http.PrinterSystemStatus import PrinterSystemStatus
@ -86,6 +85,17 @@ class LocalClusterOutputDeviceManager:
def refreshConnections(self) -> None:
self._connectToActiveMachine()
## Get the discovered devices.
def getDiscoveredDevices(self) -> Dict[str, LocalClusterOutputDevice]:
return self._discovered_devices
## Connect the active machine to a given device.
def associateActiveMachineWithPrinterDevice(self, device: LocalClusterOutputDevice) -> None:
active_machine = CuraApplication.getInstance().getGlobalContainerStack()
if not active_machine:
return
self._connectToOutputDevice(device, active_machine)
## Callback for when the active machine was changed by the user or a new remote cluster was found.
def _connectToActiveMachine(self) -> None:
active_machine = CuraApplication.getInstance().getGlobalContainerStack()
@ -176,8 +186,6 @@ class LocalClusterOutputDeviceManager:
active_machine = CuraApplication.getInstance().getGlobalContainerStack()
if not active_machine:
return
active_machine.setMetaDataEntry(self.META_NETWORK_KEY, device.key)
active_machine.setMetaDataEntry("group_name", device.name)
self._connectToOutputDevice(device, active_machine)
CloudFlowMessage(device.ipAddress).show() # Nudge the user to start using Ultimaker Cloud.
@ -215,6 +223,10 @@ class LocalClusterOutputDeviceManager:
LegacyDeviceNoLongerSupportedMessage().show()
return
machine.setName(device.name)
machine.setMetaDataEntry(self.META_NETWORK_KEY, device.key)
machine.setMetaDataEntry("group_name", device.name)
device.connect()
machine.addConfiguredConnectionType(device.connectionType.value)
CuraApplication.getInstance().getOutputDeviceManager().addOutputDevice(device)