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

@ -1,24 +1,30 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, Callable
from typing import Optional, Callable, Dict
from UM.Signal import Signal
from cura.CuraApplication import CuraApplication
from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
from .Network.LocalClusterOutputDevice import LocalClusterOutputDevice
from .Network.LocalClusterOutputDeviceManager import LocalClusterOutputDeviceManager
from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager
## This plugin handles the discovery and networking for Ultimaker 3D printers that support network and cloud printing.
class UM3OutputDevicePlugin(OutputDevicePlugin):
# Signal emitted when the list of discovered devices changed. Used by printer action in this plugin.
discoveredDevicesChanged = Signal()
def __init__(self) -> None:
super().__init__()
# Create a network output device manager that abstracts all network connection logic away.
self._network_output_device_manager = LocalClusterOutputDeviceManager()
self._network_output_device_manager.discoveredDevicesChanged.connect(self.discoveredDevicesChanged)
# Create a cloud output device manager that abstracts all cloud connection logic away.
self._cloud_output_device_manager = CloudOutputDeviceManager()
@ -57,3 +63,11 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
## Remove a manually connected networked printer.
def removeManualDevice(self, key: str, address: Optional[str] = None) -> None:
self._network_output_device_manager.removeManualDevice(key, address)
## Get the discovered devices from the local network.
def getDiscoveredDevices(self) -> Dict[str, LocalClusterOutputDevice]:
return self._network_output_device_manager.getDiscoveredDevices()
## Connect the active machine to a device.
def associateActiveMachineWithPrinterDevice(self, device: LocalClusterOutputDevice) -> None:
self._network_output_device_manager.associateActiveMachineWithPrinterDevice(device)