Remove hacky code that is now not needed anymore

This commit is contained in:
ChrisTerBeke 2019-05-14 21:13:29 +02:00
parent 56c1da2580
commit b1920b05e9
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
2 changed files with 1 additions and 22 deletions

View file

@ -58,14 +58,6 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
# Therefore we create a private signal used to trigger the printersChanged signal. # Therefore we create a private signal used to trigger the printersChanged signal.
_clusterPrintersChanged = pyqtSignal() _clusterPrintersChanged = pyqtSignal()
# Map of Cura Connect machine_variant field to Cura machine types.
# Needed for printer discovery stack creation.
_host_machine_variant_to_machine_type_map = {
"Ultimaker 3": "ultimaker3",
"Ultimaker 3 Extended": "ultimaker3_extended",
"Ultimaker S5": "ultimaker_s5"
}
## Creates a new cloud output device ## Creates a new cloud output device
# \param api_client: The client that will run the API calls # \param api_client: The client that will run the API calls
# \param cluster: The device response received from the cloud API. # \param cluster: The device response received from the cloud API.
@ -105,7 +97,6 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
# We keep track of which printer is visible in the monitor page. # We keep track of which printer is visible in the monitor page.
self._active_printer = None # type: Optional[PrinterOutputModel] self._active_printer = None # type: Optional[PrinterOutputModel]
self._host_machine_type = cluster.printer_type # type: str
# Properties to populate later on with received cloud data. # Properties to populate later on with received cloud data.
self._print_jobs = [] # type: List[UM3PrintJobOutputModel] self._print_jobs = [] # type: List[UM3PrintJobOutputModel]
@ -245,11 +236,6 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
def _updatePrinters(self, printers: List[CloudClusterPrinterStatus]) -> None: def _updatePrinters(self, printers: List[CloudClusterPrinterStatus]) -> None:
previous = {p.key: p for p in self._printers} # type: Dict[str, PrinterOutputModel] previous = {p.key: p for p in self._printers} # type: Dict[str, PrinterOutputModel]
received = {p.uuid: p for p in printers} # type: Dict[str, CloudClusterPrinterStatus] received = {p.uuid: p for p in printers} # type: Dict[str, CloudClusterPrinterStatus]
if len(printers) > 0:
# We need the machine type of the host (1st list entry) to allow discovery to work.
self._host_machine_type = printers[0].machine_variant
removed_printers, added_printers, updated_printers = findChanges(previous, received) removed_printers, added_printers, updated_printers = findChanges(previous, received)
for removed_printer in removed_printers: for removed_printer in removed_printers:
@ -373,13 +359,6 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
).show() ).show()
self.writeFinished.emit() self.writeFinished.emit()
## Gets the printer type of the cluster host. Falls back to the printer type in the device properties.
@pyqtProperty(str, notify=_clusterPrintersChanged)
def printerType(self) -> str:
if self._host_machine_type in self._host_machine_variant_to_machine_type_map:
return self._host_machine_variant_to_machine_type_map[self._host_machine_type]
return super().printerType
## Gets the number of printers in the cluster. ## Gets the number of printers in the cluster.
# We use a minimum of 1 because cloud devices are always a cluster and printer discovery needs it. # We use a minimum of 1 because cloud devices are always a cluster and printer discovery needs it.
@pyqtProperty(int, notify = _clusterPrintersChanged) @pyqtProperty(int, notify = _clusterPrintersChanged)

View file

@ -17,7 +17,7 @@ class CloudClusterResponse(BaseCloudModel):
# \param host_version: The firmware version of the cluster host. This is where the Stardust client is running on. # \param host_version: The firmware version of the cluster host. This is where the Stardust client is running on.
# \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, for example "Ultimaker 3".
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 = "Ultimaker 3", **kwargs) -> None: friendly_name: Optional[str] = None, printer_type: str = "Ultimaker 3", **kwargs) -> None: