Merge remote-tracking branch 'origin/master' into CURA-7437_no_internet_cloud_bugs

This commit is contained in:
Nino van Hooff 2020-06-09 10:47:53 +02:00
commit 32f57b8770
139 changed files with 2614 additions and 277 deletions

View file

@ -9,6 +9,7 @@ from PyQt5.QtNetwork import QNetworkReply
from UM import i18nCatalog
from UM.Logger import Logger # To log errors talking to the API.
from UM.Message import Message
from UM.Settings.Interfaces import ContainerInterface
from UM.Signal import Signal
from cura.API import Account
from cura.API.Account import SyncState
@ -49,6 +50,8 @@ class CloudOutputDeviceManager:
self._syncing = False
CuraApplication.getInstance().getContainerRegistry().containerRemoved.connect(self._printerRemoved)
def start(self):
"""Starts running the cloud output device manager, thus periodically requesting cloud data."""
@ -286,3 +289,16 @@ class CloudOutputDeviceManager:
output_device_manager = CuraApplication.getInstance().getOutputDeviceManager()
if device.key not in output_device_manager.getOutputDeviceIds():
output_device_manager.addOutputDevice(device)
def _printerRemoved(self, container: ContainerInterface) -> None:
"""
Callback connected to the containerRemoved signal. Invoked when a cloud printer is removed from Cura to remove
the printer's reference from the _remote_clusters.
:param container: The ContainerInterface passed to this function whenever the ContainerRemoved signal is emitted
:return: None
"""
if isinstance(container, GlobalStack):
container_cluster_id = container.getMetaDataEntry(self.META_CLUSTER_ID, None)
if container_cluster_id in self._remote_clusters.keys():
del self._remote_clusters[container_cluster_id]

View file

@ -125,9 +125,6 @@ class ClusterPrintJobStatus(BaseModel):
model.updateOwner(self.owner)
model.updateState(self.status)
model.setCompatibleMachineFamilies(self.compatible_machine_families)
model.updateTimeTotal(self.time_total)
model.updateTimeElapsed(self.time_elapsed)
model.updateOwner(self.owner)
status_set_by_impediment = False
for impediment in self.impediments_to_printing:

View file

@ -54,4 +54,4 @@ class ClusterPrinterConfigurationMaterial(BaseModel):
"name": "Empty" if self.material == "empty" else "Unknown"
}
return MaterialOutputModel(guid = self.guid, type = material_metadata["material"], brand = material_metadata["brand"], color = material_metadata["color_code"], name = material_metadata["name"])
return MaterialOutputModel(guid = self.guid, type = material_metadata["material"], brand = material_metadata["brand"], color = material_metadata.get("color_code", "#ffc924"), name = material_metadata["name"])