Merge branch 'master' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2021-03-01 14:32:54 +01:00
commit a8f92e9900
No known key found for this signature in database
GPG Key ID: 3710727397403C91
2 changed files with 21 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2019 Ultimaker B.V. # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional from typing import Optional

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 Ultimaker B.V. # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from typing import List, Optional, Union, Dict, Any from typing import List, Optional, Union, Dict, Any
@ -8,7 +8,7 @@ from .ClusterBuildPlate import ClusterBuildPlate
from .ClusterPrintJobConfigurationChange import ClusterPrintJobConfigurationChange from .ClusterPrintJobConfigurationChange import ClusterPrintJobConfigurationChange
from .ClusterPrintJobImpediment import ClusterPrintJobImpediment from .ClusterPrintJobImpediment import ClusterPrintJobImpediment
from .ClusterPrintCoreConfiguration import ClusterPrintCoreConfiguration from .ClusterPrintCoreConfiguration import ClusterPrintCoreConfiguration
from .ClusterPrintJobConstraint import ClusterPrintJobConstraints from .ClusterPrintJobConstraints import ClusterPrintJobConstraints
from ..UM3PrintJobOutputModel import UM3PrintJobOutputModel from ..UM3PrintJobOutputModel import UM3PrintJobOutputModel
from ..ConfigurationChangeModel import ConfigurationChangeModel from ..ConfigurationChangeModel import ConfigurationChangeModel
from ..BaseModel import BaseModel from ..BaseModel import BaseModel
@ -18,13 +18,24 @@ from ...ClusterOutputController import ClusterOutputController
class ClusterPrintJobStatus(BaseModel): class ClusterPrintJobStatus(BaseModel):
"""Model for the status of a single print job in a cluster.""" """Model for the status of a single print job in a cluster."""
def __init__(self, created_at: str, force: bool, machine_variant: str, name: str, started: bool, status: str, def __init__(self,
time_total: int, uuid: str, created_at: str,
force: bool,
machine_variant: str,
name: str,
started: bool,
status: str,
time_total: int,
uuid: str,
configuration: List[Union[Dict[str, Any], ClusterPrintCoreConfiguration]], configuration: List[Union[Dict[str, Any], ClusterPrintCoreConfiguration]],
constraints: List[Union[Dict[str, Any], ClusterPrintJobConstraints]], constraints: Optional[Union[Dict[str, Any], ClusterPrintJobConstraints]] = None,
last_seen: Optional[float] = None, network_error_count: Optional[int] = None, last_seen: Optional[float] = None,
owner: Optional[str] = None, printer_uuid: Optional[str] = None, time_elapsed: Optional[int] = None, network_error_count: Optional[int] = None,
assigned_to: Optional[str] = None, deleted_at: Optional[str] = None, owner: Optional[str] = None,
printer_uuid: Optional[str] = None,
time_elapsed: Optional[int] = None,
assigned_to: Optional[str] = None,
deleted_at: Optional[str] = None,
printed_on_uuid: Optional[str] = None, printed_on_uuid: Optional[str] = None,
configuration_changes_required: List[ configuration_changes_required: List[
Union[Dict[str, Any], ClusterPrintJobConfigurationChange]] = None, Union[Dict[str, Any], ClusterPrintJobConfigurationChange]] = None,
@ -63,10 +74,9 @@ class ClusterPrintJobStatus(BaseModel):
printer printer
:param preview_url: URL to the preview image (same as wou;d've been included in the ufp). :param preview_url: URL to the preview image (same as wou;d've been included in the ufp).
""" """
self.assigned_to = assigned_to self.assigned_to = assigned_to
self.configuration = self.parseModels(ClusterPrintCoreConfiguration, configuration) self.configuration = self.parseModels(ClusterPrintCoreConfiguration, configuration)
self.constraints = self.parseModels(ClusterPrintJobConstraints, constraints) self.constraints = self.parseModel(ClusterPrintJobConstraints, constraints) if constraints else None
self.created_at = created_at self.created_at = created_at
self.force = force self.force = force
self.last_seen = last_seen self.last_seen = last_seen
@ -83,7 +93,6 @@ class ClusterPrintJobStatus(BaseModel):
self.deleted_at = deleted_at self.deleted_at = deleted_at
self.printed_on_uuid = printed_on_uuid self.printed_on_uuid = printed_on_uuid
self.preview_url = preview_url self.preview_url = preview_url
self.configuration_changes_required = self.parseModels(ClusterPrintJobConfigurationChange, self.configuration_changes_required = self.parseModels(ClusterPrintJobConfigurationChange,
configuration_changes_required) \ configuration_changes_required) \
if configuration_changes_required else [] if configuration_changes_required else []