mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 15:57:52 -06:00
Fix typing issues
This commit is contained in:
parent
7b45100dd0
commit
13e85362b0
2 changed files with 6 additions and 4 deletions
|
@ -14,7 +14,7 @@ class ClusterPrinterMaterialStation(BaseModel):
|
||||||
# \param: supported: Whether the material station is supported on this machine or not.
|
# \param: supported: Whether the material station is supported on this machine or not.
|
||||||
# \param material_slots: The active slots configurations of this material station.
|
# \param material_slots: The active slots configurations of this material station.
|
||||||
def __init__(self, status: str, supported: bool = False,
|
def __init__(self, status: str, supported: bool = False,
|
||||||
material_slots: List[Union[None, Dict[str, Any], ClusterPrinterMaterialStationSlot]] = None,
|
material_slots: List[Union[ClusterPrinterMaterialStationSlot, Dict[str, Any]]] = None,
|
||||||
**kwargs) -> None:
|
**kwargs) -> None:
|
||||||
self.status = status
|
self.status = status
|
||||||
self.supported = supported
|
self.supported = supported
|
||||||
|
|
|
@ -81,9 +81,9 @@ class ClusterPrinterStatus(BaseModel):
|
||||||
model.setCameraUrl(QUrl("http://{}:8080/?action=stream".format(self.ip_address)))
|
model.setCameraUrl(QUrl("http://{}:8080/?action=stream".format(self.ip_address)))
|
||||||
|
|
||||||
# Set the possible configurations based on whether a Material Station is present or not.
|
# Set the possible configurations based on whether a Material Station is present or not.
|
||||||
if self.material_station is not None and len(self.material_station.material_slots):
|
if self.material_station and self.material_station.material_slots:
|
||||||
self._updateAvailableConfigurations(model)
|
self._updateAvailableConfigurations(model)
|
||||||
if self.configuration is not None:
|
if self.configuration:
|
||||||
self._updateActiveConfiguration(model)
|
self._updateActiveConfiguration(model)
|
||||||
|
|
||||||
def _updateActiveConfiguration(self, model: PrinterOutputModel) -> None:
|
def _updateActiveConfiguration(self, model: PrinterOutputModel) -> None:
|
||||||
|
@ -103,6 +103,8 @@ class ClusterPrinterStatus(BaseModel):
|
||||||
## Create a list of Material Station slots for the given extruder index.
|
## Create a list of Material Station slots for the given extruder index.
|
||||||
# Returns a list with a single empty material slot if none are found to ensure we don't miss configurations.
|
# Returns a list with a single empty material slot if none are found to ensure we don't miss configurations.
|
||||||
def _getSlotsForExtruder(self, extruder_index: int) -> List[ClusterPrinterMaterialStationSlot]:
|
def _getSlotsForExtruder(self, extruder_index: int) -> List[ClusterPrinterMaterialStationSlot]:
|
||||||
|
if not self.material_station: # typing guard
|
||||||
|
return []
|
||||||
slots = [slot for slot in self.material_station.material_slots if self._isSupportedConfiguration(
|
slots = [slot for slot in self.material_station.material_slots if self._isSupportedConfiguration(
|
||||||
slot = slot,
|
slot = slot,
|
||||||
extruder_index = extruder_index
|
extruder_index = extruder_index
|
||||||
|
@ -113,7 +115,7 @@ class ClusterPrinterStatus(BaseModel):
|
||||||
# We filter out any slot that is not supported by the extruder index, print core type or if the material is empty.
|
# We filter out any slot that is not supported by the extruder index, print core type or if the material is empty.
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _isSupportedConfiguration(slot: ClusterPrinterMaterialStationSlot, extruder_index: int) -> bool:
|
def _isSupportedConfiguration(slot: ClusterPrinterMaterialStationSlot, extruder_index: int) -> bool:
|
||||||
return slot.extruder_index == extruder_index and slot.compatible and slot.material
|
return slot.extruder_index == extruder_index and slot.compatible
|
||||||
|
|
||||||
## Create an empty material slot with a fake empty material.
|
## Create an empty material slot with a fake empty material.
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue