mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Method printers method, methodx, methodxl read from cloud
CURA-11138
This commit is contained in:
parent
15e7bb1f07
commit
cf78ae0dca
4 changed files with 38 additions and 9 deletions
|
@ -415,7 +415,17 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
|
||||||
|
|
||||||
@pyqtProperty(str, constant = True)
|
@pyqtProperty(str, constant = True)
|
||||||
def printerType(self) -> str:
|
def printerType(self) -> str:
|
||||||
return self._properties.get(b"printer_type", b"Unknown").decode("utf-8")
|
return self.getPrinterType(self._properties.get(b"printer_type", b"Unknown").decode("utf-8"))
|
||||||
|
|
||||||
|
def getPrinterTypeIfMakerBot(printer_type):
|
||||||
|
method_printer_type = {
|
||||||
|
"fire_e": "ultimaker_method",
|
||||||
|
"lava_f": "ultimaker_methodx",
|
||||||
|
"magma_10": "ultimaker_methodxl"
|
||||||
|
}
|
||||||
|
if printer_type in method_printer_type:
|
||||||
|
return method_printer_type[printer_type]
|
||||||
|
return printer_type
|
||||||
|
|
||||||
@pyqtProperty(str, constant = True)
|
@pyqtProperty(str, constant = True)
|
||||||
def ipAddress(self) -> str:
|
def ipAddress(self) -> str:
|
||||||
|
|
|
@ -115,7 +115,7 @@ UM.Dialog
|
||||||
// Utils
|
// Utils
|
||||||
function formatPrintJobName(name)
|
function formatPrintJobName(name)
|
||||||
{
|
{
|
||||||
var extensions = [ ".gcode.gz", ".gz", ".gcode", ".ufp" ]
|
var extensions = [ ".gcode.gz", ".gz", ".gcode", ".ufp", ".makerbot" ]
|
||||||
for (var i = 0; i < extensions.length; i++)
|
for (var i = 0; i < extensions.length; i++)
|
||||||
{
|
{
|
||||||
var extension = extensions[i]
|
var extension = extensions[i]
|
||||||
|
|
|
@ -82,13 +82,22 @@ class CloudApiClient:
|
||||||
# HACK: There is something weird going on with the API, as it reports printer types in formats like
|
# HACK: There is something weird going on with the API, as it reports printer types in formats like
|
||||||
# "ultimaker_s3", but wants "Ultimaker S3" when using the machine_variant filter query. So we need to do some
|
# "ultimaker_s3", but wants "Ultimaker S3" when using the machine_variant filter query. So we need to do some
|
||||||
# conversion!
|
# conversion!
|
||||||
|
# API points to "MakerBot Method" for a makerbot printertypes which we already changed to allign with other printer_type
|
||||||
|
|
||||||
machine_type = machine_type.replace("_plus", "+")
|
method_x = {
|
||||||
machine_type = machine_type.replace("_", " ")
|
"ultimaker_method":"MakerBot Method",
|
||||||
machine_type = machine_type.replace("ultimaker", "ultimaker ")
|
"ultimaker_methodx":"MakerBot Method X",
|
||||||
machine_type = machine_type.replace(" ", " ")
|
"ultimaker_methodxl":"MakerBot Method XL"
|
||||||
machine_type = machine_type.title()
|
}
|
||||||
machine_type = urllib.parse.quote_plus(machine_type)
|
if machine_type in method_x:
|
||||||
|
machine_type = method_x[machine_type]
|
||||||
|
else:
|
||||||
|
machine_type = machine_type.replace("_plus", "+")
|
||||||
|
machine_type = machine_type.replace("_", " ")
|
||||||
|
machine_type = machine_type.replace("ultimaker", "ultimaker ")
|
||||||
|
machine_type = machine_type.replace(" ", " ")
|
||||||
|
machine_type = machine_type.title()
|
||||||
|
machine_type = urllib.parse.quote_plus(machine_type)
|
||||||
url = f"{self.CLUSTER_API_ROOT}/clusters?machine_variant={machine_type}"
|
url = f"{self.CLUSTER_API_ROOT}/clusters?machine_variant={machine_type}"
|
||||||
self._http.get(url,
|
self._http.get(url,
|
||||||
scope=self._scope,
|
scope=self._scope,
|
||||||
|
|
|
@ -34,7 +34,7 @@ class CloudClusterResponse(BaseModel):
|
||||||
self.host_version = host_version
|
self.host_version = host_version
|
||||||
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 = self.getPrinterTypeIfMakerBot(printer_type)
|
||||||
self.printer_count = printer_count
|
self.printer_count = printer_count
|
||||||
self.capabilities = capabilities if capabilities is not None else []
|
self.capabilities = capabilities if capabilities is not None else []
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
@ -51,3 +51,13 @@ class CloudClusterResponse(BaseModel):
|
||||||
:return: A human-readable representation of the data in this object.
|
:return: A human-readable representation of the data in this object.
|
||||||
"""
|
"""
|
||||||
return str({k: v for k, v in self.__dict__.items() if k in {"cluster_id", "host_guid", "host_name", "status", "is_online", "host_version", "host_internal_ip", "friendly_name", "printer_type", "printer_count", "capabilities"}})
|
return str({k: v for k, v in self.__dict__.items() if k in {"cluster_id", "host_guid", "host_name", "status", "is_online", "host_version", "host_internal_ip", "friendly_name", "printer_type", "printer_count", "capabilities"}})
|
||||||
|
|
||||||
|
def getPrinterTypeIfMakerBot(printer_type):
|
||||||
|
method_printer_type = {
|
||||||
|
"fire_e": "ultimaker_method",
|
||||||
|
"lava_f": "ultimaker_methodx",
|
||||||
|
"magma_10": "ultimaker_methodxl"
|
||||||
|
}
|
||||||
|
if printer_type in method_printer_type:
|
||||||
|
return method_printer_type[printer_type]
|
||||||
|
return printer_type
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue