mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
START-322: Python 3.5 compatibility
This commit is contained in:
parent
f8f6670cae
commit
186c2cf3f5
2 changed files with 56 additions and 56 deletions
|
@ -224,8 +224,8 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
||||||
self._updatePrintJobs(status.print_jobs)
|
self._updatePrintJobs(status.print_jobs)
|
||||||
|
|
||||||
def _updatePrinters(self, printers: List[CloudClusterPrinter]) -> None:
|
def _updatePrinters(self, printers: List[CloudClusterPrinter]) -> None:
|
||||||
remote_printers: Dict[str, CloudClusterPrinter] = {p.uuid: p for p in printers}
|
remote_printers = {p.uuid: p for p in printers} # type: Dict[str, CloudClusterPrinter]
|
||||||
current_printers: Dict[str, PrinterOutputModel] = {p.key: p for p in self._printers}
|
current_printers = {p.key: p for p in self._printers} # type: Dict[str, PrinterOutputModel]
|
||||||
|
|
||||||
removed_printer_ids = set(current_printers).difference(remote_printers)
|
removed_printer_ids = set(current_printers).difference(remote_printers)
|
||||||
new_printer_ids = set(remote_printers).difference(current_printers)
|
new_printer_ids = set(remote_printers).difference(current_printers)
|
||||||
|
@ -302,8 +302,8 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
||||||
return MaterialOutputModel(guid=material.guid, type=material_type, brand=brand, color=color, name=name)
|
return MaterialOutputModel(guid=material.guid, type=material_type, brand=brand, color=color, name=name)
|
||||||
|
|
||||||
def _updatePrintJobs(self, jobs: List[CloudClusterPrintJob]) -> None:
|
def _updatePrintJobs(self, jobs: List[CloudClusterPrintJob]) -> None:
|
||||||
remote_jobs: Dict[str, CloudClusterPrintJob] = {j.uuid: j for j in jobs}
|
remote_jobs = {j.uuid: j for j in jobs} # type: Dict[str, CloudClusterPrintJob]
|
||||||
current_jobs: Dict[str, UM3PrintJobOutputModel] = {j.key: j for j in self._print_jobs}
|
current_jobs = {j.key: j for j in self._print_jobs} # type: Dict[str, UM3PrintJobOutputModel]
|
||||||
|
|
||||||
removed_job_ids = set(current_jobs).difference(set(remote_jobs))
|
removed_job_ids = set(current_jobs).difference(set(remote_jobs))
|
||||||
new_job_ids = set(remote_jobs.keys()).difference(set(current_jobs))
|
new_job_ids = set(remote_jobs.keys()).difference(set(current_jobs))
|
||||||
|
|
|
@ -8,11 +8,11 @@ from ..Models import BaseModel
|
||||||
## Class representing a cloud connected cluster.
|
## Class representing a cloud connected cluster.
|
||||||
class CloudCluster(BaseModel):
|
class CloudCluster(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.cluster_id: str = None
|
self.cluster_id = None # type: str
|
||||||
self.host_guid: str = None
|
self.host_guid = None # type: str
|
||||||
self.host_name: str = None
|
self.host_name = None # type: str
|
||||||
self.host_version: str = None
|
self.host_version = None # type: str
|
||||||
self.status: str = None
|
self.status = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
@ -23,20 +23,20 @@ class CloudCluster(BaseModel):
|
||||||
## Class representing a cloud cluster printer configuration
|
## Class representing a cloud cluster printer configuration
|
||||||
class CloudClusterPrinterConfigurationMaterial(BaseModel):
|
class CloudClusterPrinterConfigurationMaterial(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.guid: str = None
|
self.guid = None # type: str
|
||||||
self.brand: str = None
|
self.brand = None # type: str
|
||||||
self.color: str = None
|
self.color = None # type: str
|
||||||
self.material: str = None
|
self.material = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
## Class representing a cloud cluster printer configuration
|
## Class representing a cloud cluster printer configuration
|
||||||
class CloudClusterPrinterConfiguration(BaseModel):
|
class CloudClusterPrinterConfiguration(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.extruder_index: str = None
|
self.extruder_index = None # type: str
|
||||||
self.material: CloudClusterPrinterConfigurationMaterial = None
|
self.material = None # type: CloudClusterPrinterConfigurationMaterial
|
||||||
self.nozzle_diameter: str = None
|
self.nozzle_diameter = None # type: str
|
||||||
self.print_core_id: str = None
|
self.print_core_id = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
if isinstance(self.material, dict):
|
if isinstance(self.material, dict):
|
||||||
|
@ -46,15 +46,15 @@ class CloudClusterPrinterConfiguration(BaseModel):
|
||||||
## Class representing a cluster printer
|
## Class representing a cluster printer
|
||||||
class CloudClusterPrinter(BaseModel):
|
class CloudClusterPrinter(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.configuration: List[CloudClusterPrinterConfiguration] = []
|
self.configuration = [] # type: List[CloudClusterPrinterConfiguration]
|
||||||
self.enabled: str = None
|
self.enabled = None # type: str
|
||||||
self.firmware_version: str = None
|
self.firmware_version = None # type: str
|
||||||
self.friendly_name: str = None
|
self.friendly_name = None # type: str
|
||||||
self.ip_address: str = None
|
self.ip_address = None # type: str
|
||||||
self.machine_variant: str = None
|
self.machine_variant = None # type: str
|
||||||
self.status: str = None
|
self.status = None # type: str
|
||||||
self.unique_name: str = None
|
self.unique_name = None # type: str
|
||||||
self.uuid: str = None
|
self.uuid = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
self.configuration = [CloudClusterPrinterConfiguration(**c)
|
self.configuration = [CloudClusterPrinterConfiguration(**c)
|
||||||
|
@ -64,29 +64,29 @@ class CloudClusterPrinter(BaseModel):
|
||||||
## Class representing a cloud cluster print job constraint
|
## Class representing a cloud cluster print job constraint
|
||||||
class CloudClusterPrintJobConstraint(BaseModel):
|
class CloudClusterPrintJobConstraint(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.require_printer_name: str = None
|
self.require_printer_name = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
## Class representing a print job
|
## Class representing a print job
|
||||||
class CloudClusterPrintJob(BaseModel):
|
class CloudClusterPrintJob(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.assigned_to: str = None
|
self.assigned_to = None # type: str
|
||||||
self.configuration: List[CloudClusterPrinterConfiguration] = []
|
self.configuration = [] # type: List[CloudClusterPrinterConfiguration]
|
||||||
self.constraints: List[CloudClusterPrintJobConstraint] = []
|
self.constraints = [] # type: List[CloudClusterPrintJobConstraint]
|
||||||
self.created_at: str = None
|
self.created_at = None # type: str
|
||||||
self.force: str = None
|
self.force = None # type: str
|
||||||
self.last_seen: str = None
|
self.last_seen = None # type: str
|
||||||
self.machine_variant: str = None
|
self.machine_variant = None # type: str
|
||||||
self.name: str = None
|
self.name = None # type: str
|
||||||
self.network_error_count: int = None
|
self.network_error_count = None # type: int
|
||||||
self.owner: str = None
|
self.owner = None # type: str
|
||||||
self.printer_uuid: str = None
|
self.printer_uuid = None # type: str
|
||||||
self.started: str = None
|
self.started = None # type: str
|
||||||
self.status: str = None
|
self.status = None # type: str
|
||||||
self.time_elapsed: str = None
|
self.time_elapsed = None # type: str
|
||||||
self.time_total: str = None
|
self.time_total = None # type: str
|
||||||
self.uuid: str = None
|
self.uuid = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.printers = [CloudClusterPrinterConfiguration(**c) if isinstance(c, dict) else c
|
self.printers = [CloudClusterPrinterConfiguration(**c) if isinstance(c, dict) else c
|
||||||
for c in self.configuration]
|
for c in self.configuration]
|
||||||
|
@ -96,8 +96,8 @@ class CloudClusterPrintJob(BaseModel):
|
||||||
|
|
||||||
class CloudClusterStatus(BaseModel):
|
class CloudClusterStatus(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.printers: List[CloudClusterPrinter] = []
|
self.printers = [] # type: List[CloudClusterPrinter]
|
||||||
self.print_jobs: List[CloudClusterPrintJob] = []
|
self.print_jobs = [] # type: List[CloudClusterPrintJob]
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
self.printers = [CloudClusterPrinter(**p) if isinstance(p, dict) else p for p in self.printers]
|
self.printers = [CloudClusterPrinter(**p) if isinstance(p, dict) else p for p in self.printers]
|
||||||
|
@ -106,25 +106,25 @@ class CloudClusterStatus(BaseModel):
|
||||||
|
|
||||||
class JobUploadRequest(BaseModel):
|
class JobUploadRequest(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.file_size: int = None
|
self.file_size = None # type: int
|
||||||
self.job_name: str = None
|
self.job_name = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
class JobUploadResponse(BaseModel):
|
class JobUploadResponse(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.download_url: str = None
|
self.download_url = None # type: str
|
||||||
self.job_id: str = None
|
self.job_id = None # type: str
|
||||||
self.job_name: str = None
|
self.job_name = None # type: str
|
||||||
self.slicing_details: str = None
|
self.slicing_details = None # type: str
|
||||||
self.status: str = None
|
self.status = None # type: str
|
||||||
self.upload_url: str = None
|
self.upload_url = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
class PrintResponse(BaseModel):
|
class PrintResponse(BaseModel):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.cluster_job_id: str = None
|
self.cluster_job_id = None # type: str
|
||||||
self.job_id: str = None
|
self.job_id = None # type: str
|
||||||
self.status: str = None
|
self.status = None # type: str
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue