diff --git a/cura/PrinterOutput/ConfigurationModel.py b/cura/PrinterOutput/ConfigurationModel.py index 633986a65c..8138543d7b 100644 --- a/cura/PrinterOutput/ConfigurationModel.py +++ b/cura/PrinterOutput/ConfigurationModel.py @@ -40,11 +40,19 @@ class ConfigurationModel(QObject): def buildplateConfiguration(self): return self._buildplate_configuration + def __str__(self): + info = "Printer type: " + self.printerType + "\n" + info += "Extruders: [\n" + for configuration in self.extruderConfigurations: + info += " " + str(configuration) + "\n" + info += "]" + return info + def __eq__(self, other): return hash(self) == hash(other) def __hash__(self): - extruder_hash = hash(0) + extruder_hash = hash(self.extruderConfigurations[0]) # Use the hash of the first extruder as a seed for configuration in self.extruderConfigurations: - extruder_hash ^= configuration.__hash__() - return hash(self.printerType) ^ extruder_hash ^ hash(self.buildplateConfiguration) \ No newline at end of file + extruder_hash ^= hash(configuration) + return hash(self._printer_type) ^ extruder_hash ^ hash(self._buildplate_configuration) \ No newline at end of file diff --git a/cura/PrinterOutput/ExtruderConfigurationModel.py b/cura/PrinterOutput/ExtruderConfigurationModel.py index 4871dca3cc..7aa8785ae9 100644 --- a/cura/PrinterOutput/ExtruderConfigurationModel.py +++ b/cura/PrinterOutput/ExtruderConfigurationModel.py @@ -35,8 +35,13 @@ class ExtruderConfigurationModel(QObject): def hotendID(self): return self._hotend_id + def __str__(self): + if self._material is None or self._hotend_id is None: + return "No information" + return "Position: " + str(self._position) + " - Material: " + self._material + " - HotendID: " + self._hotend_id + def __eq__(self, other): return hash(self) == hash(other) def __hash__(self): - return hash(self.position) ^ hash(self.material) ^ hash(self.hotendID) \ No newline at end of file + return hash(self._position) ^ hash(self._material) ^ hash(self._hotend_id) \ No newline at end of file diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 7d5e00f0b5..39962690bb 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -191,8 +191,9 @@ class MachineManager(QObject): @pyqtSlot(QObject, result = bool) def matchesConfiguration(self, configuration: ConfigurationModel) -> bool: - # print("@@@@@@@@@@@@@@@@@@", configuration.extruderConfigurations) - # print("##################", self._current_printer_configuration.extruderConfigurations, configuration == self._current_printer_configuration) + # print(configuration) + # print(self._current_printer_configuration) + # print("%%%%%%%%", configuration == self._current_printer_configuration) return self._current_printer_configuration == configuration @property