mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 12:25:10 +08:00
Merge pull request #6311 from Ultimaker/CS-284_fix_crash_missing_printer_configuration
Check if printerConfiguration is actually set before trying to access it
This commit is contained in:
commit
f53031f6b9
@ -66,7 +66,11 @@ class ClusterPrinterStatus(BaseModel):
|
|||||||
## Creates a new output model.
|
## Creates a new output model.
|
||||||
# \param controller - The controller of the model.
|
# \param controller - The controller of the model.
|
||||||
def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel:
|
def createOutputModel(self, controller: PrinterOutputController) -> PrinterOutputModel:
|
||||||
model = PrinterOutputModel(controller, len(self.configuration), firmware_version = self.firmware_version)
|
# FIXME
|
||||||
|
# Note that we're using '2' here as extruder count. We have hardcoded this for now to prevent issues where the
|
||||||
|
# amount of extruders coming back from the API is actually lower (which it can be if a printer was just added
|
||||||
|
# to a cluster). This should be fixed in the future, probably also on the cluster API side.
|
||||||
|
model = PrinterOutputModel(controller, 2, firmware_version = self.firmware_version)
|
||||||
self.updateOutputModel(model)
|
self.updateOutputModel(model)
|
||||||
return model
|
return model
|
||||||
|
|
||||||
@ -80,6 +84,11 @@ class ClusterPrinterStatus(BaseModel):
|
|||||||
model.updateBuildplate(self.build_plate.type if self.build_plate else "glass")
|
model.updateBuildplate(self.build_plate.type if self.build_plate else "glass")
|
||||||
model.setCameraUrl(QUrl("http://{}:8080/?action=stream".format(self.ip_address)))
|
model.setCameraUrl(QUrl("http://{}:8080/?action=stream".format(self.ip_address)))
|
||||||
|
|
||||||
|
if not model.printerConfiguration:
|
||||||
|
# Prevent accessing printer configuration when not available.
|
||||||
|
# This sometimes happens when a printer was just added to a group and Cura is connected to that group.
|
||||||
|
return
|
||||||
|
|
||||||
# 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 and self.material_station.material_slots:
|
if self.material_station and self.material_station.material_slots:
|
||||||
self._updateAvailableConfigurations(model)
|
self._updateAvailableConfigurations(model)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user