mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Make code a bit smarter about reusing ExtruderConfigurationModels
This prevents a lot of unneeded signal noise
This commit is contained in:
parent
ee25c4b94c
commit
05a6c9c3cf
2 changed files with 13 additions and 4 deletions
|
@ -34,3 +34,11 @@ class MaterialOutputModel(QObject):
|
|||
@pyqtProperty(str, constant = True)
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
def __eq__(self, other):
|
||||
if self is other:
|
||||
return True
|
||||
if type(other) is not MaterialOutputModel:
|
||||
return False
|
||||
|
||||
return self.guid == other.guid and self.type == other.type and self.brand == other.brand and self.color == other.color and self.name == other.name
|
||||
|
|
|
@ -182,9 +182,11 @@ class MachineManager(QObject):
|
|||
|
||||
# Create the configuration model with the current data in Cura
|
||||
self._current_printer_configuration.printerType = self._global_container_stack.definition.getName()
|
||||
self._current_printer_configuration.extruderConfigurations = []
|
||||
for extruder in self._global_container_stack.extruderList:
|
||||
extruder_configuration = ExtruderConfigurationModel()
|
||||
|
||||
if len(self._current_printer_configuration.extruderConfigurations) != len(self._global_container_stack.extruderList):
|
||||
self._current_printer_configuration.extruderConfigurations = [ExtruderConfigurationModel() for extruder in self._global_container_stack.extruderList]
|
||||
|
||||
for extruder, extruder_configuration in zip(self._global_container_stack.extruderList, self._current_printer_configuration.extruderConfigurations):
|
||||
# For compare just the GUID is needed at this moment
|
||||
mat_type = extruder.material.getMetaDataEntry("material") if extruder.material != empty_material_container else None
|
||||
mat_guid = extruder.material.getMetaDataEntry("GUID") if extruder.material != empty_material_container else None
|
||||
|
@ -196,7 +198,6 @@ class MachineManager(QObject):
|
|||
extruder_configuration.position = int(extruder.getMetaDataEntry("position"))
|
||||
extruder_configuration.material = material_model
|
||||
extruder_configuration.hotendID = extruder.variant.getName() if extruder.variant != empty_variant_container else None
|
||||
self._current_printer_configuration.extruderConfigurations.append(extruder_configuration)
|
||||
|
||||
# An empty build plate configuration from the network printer is presented as an empty string, so use "" for an
|
||||
# empty build plate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue