Add CloudOutputDeviceManager, test implementation

This commit is contained in:
ChrisTerBeke 2018-11-19 21:59:57 +01:00
parent 115936c46b
commit 228325eb89
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
5 changed files with 78 additions and 17 deletions

View file

@ -0,0 +1,31 @@
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import TYPE_CHECKING
from plugins.UM3NetworkPrinting.src.Cloud.CloudOutputDevice import CloudOutputDevice
if TYPE_CHECKING:
from cura.CuraApplication import CuraApplication
## The cloud output device manager is responsible for using the Ultimaker Cloud APIs to manage remote clusters.
# Keeping all cloud related logic in this class instead of the UM3OutputDevicePlugin results in more readable code.
class CloudOutputDeviceManager:
def __init__(self, application: "CuraApplication"):
self._output_device_manager = application.getOutputDeviceManager()
self._account = application.getCuraAPI().account
self._getRemoteClusters()
# For testing:
application.globalContainerStackChanged.connect(self._addCloudOutputDevice)
def _getRemoteClusters(self):
# TODO: get list of remote clusters and create an output device for each.
pass
def _addCloudOutputDevice(self):
device = CloudOutputDevice("xxxx-xxxx-xxxx-xxxx")
self._output_device_manager.addOutputDevice(device)
device.connect()