Merge branch 'CURA-7437_no_internet_cloud_bugs' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2020-06-09 13:45:21 +02:00
commit b6b3646f32
No known key found for this signature in database
GPG key ID: 3710727397403C91
4 changed files with 10 additions and 3 deletions

View file

@ -488,7 +488,11 @@ class MachineManager(QObject):
@pyqtProperty(bool, notify = printerConnectedStatusChanged) @pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineIsGroup(self) -> bool: def activeMachineIsGroup(self) -> bool:
return bool(self._printer_output_devices) and len(self._printer_output_devices[0].printers) > 1 if self.activeMachine is None:
return False
group_size = int(self.activeMachine.getMetaDataEntry("group_size", "-1"))
return group_size > 1
@pyqtProperty(bool, notify = printerConnectedStatusChanged) @pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineHasNetworkConnection(self) -> bool: def activeMachineHasNetworkConnection(self) -> bool:

View file

@ -74,7 +74,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
b"name": cluster.friendly_name.encode() if cluster.friendly_name else b"", b"name": cluster.friendly_name.encode() if cluster.friendly_name else b"",
b"firmware_version": cluster.host_version.encode() if cluster.host_version else b"", b"firmware_version": cluster.host_version.encode() if cluster.host_version else b"",
b"printer_type": cluster.printer_type.encode() if cluster.printer_type else b"", b"printer_type": cluster.printer_type.encode() if cluster.printer_type else b"",
b"cluster_size": b"1" # cloud devices are always clusters of at least one b"cluster_size": str(cluster.printer_count).encode() if cluster.printer_count else b"1"
} }
super().__init__( super().__init__(

View file

@ -268,6 +268,7 @@ class CloudOutputDeviceManager:
machine.setName(device.name) machine.setName(device.name)
machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key) machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
machine.setMetaDataEntry("group_name", device.name) machine.setMetaDataEntry("group_name", device.name)
machine.setMetaDataEntry("group_size", device.clusterSize)
machine.setMetaDataEntry("removal_warning", self.I18N_CATALOG.i18nc( machine.setMetaDataEntry("removal_warning", self.I18N_CATALOG.i18nc(
"@label ({} is printer name)", "@label ({} is printer name)",
"{} will be removed until the next account sync. <br> To remove {} permanently, " "{} will be removed until the next account sync. <br> To remove {} permanently, "

View file

@ -11,7 +11,7 @@ class CloudClusterResponse(BaseModel):
def __init__(self, cluster_id: str, host_guid: str, host_name: str, is_online: bool, status: str, def __init__(self, cluster_id: str, host_guid: str, host_name: str, is_online: bool, status: str,
host_internal_ip: Optional[str] = None, host_version: Optional[str] = None, host_internal_ip: Optional[str] = None, host_version: Optional[str] = None,
friendly_name: Optional[str] = None, printer_type: str = "ultimaker3", **kwargs) -> None: friendly_name: Optional[str] = None, printer_type: str = "ultimaker3", printer_count: int = 1, **kwargs) -> None:
"""Creates a new cluster response object. """Creates a new cluster response object.
:param cluster_id: The secret unique ID, e.g. 'kBEeZWEifXbrXviO8mRYLx45P8k5lHVGs43XKvRniPg='. :param cluster_id: The secret unique ID, e.g. 'kBEeZWEifXbrXviO8mRYLx45P8k5lHVGs43XKvRniPg='.
@ -23,6 +23,7 @@ class CloudClusterResponse(BaseModel):
:param host_internal_ip: The internal IP address of the host printer. :param host_internal_ip: The internal IP address of the host printer.
:param friendly_name: The human readable name of the host printer. :param friendly_name: The human readable name of the host printer.
:param printer_type: The machine type of the host printer. :param printer_type: The machine type of the host printer.
:param printer_count: The amount of printers in the print cluster. 1 for a single printer
""" """
self.cluster_id = cluster_id self.cluster_id = cluster_id
@ -34,6 +35,7 @@ class CloudClusterResponse(BaseModel):
self.host_internal_ip = host_internal_ip self.host_internal_ip = host_internal_ip
self.friendly_name = friendly_name self.friendly_name = friendly_name
self.printer_type = printer_type self.printer_type = printer_type
self.printer_count = printer_count
super().__init__(**kwargs) super().__init__(**kwargs)
# Validates the model, raising an exception if the model is invalid. # Validates the model, raising an exception if the model is invalid.