Warn for mismatched cores on multi-config printers.

Similar to the warning we already had for missing materials.

CURA-12368
This commit is contained in:
Remco Burema 2025-01-22 21:16:56 +01:00
parent 3095acd896
commit 038e8b7722
2 changed files with 68 additions and 16 deletions

View file

@ -1,9 +1,12 @@
# Copyright (c) 2018 Ultimaker B.V.
# Copyright (c) 2025 UltiMaker
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt6.QtCore import pyqtProperty, QObject, pyqtSignal
from typing import List
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Settings.DefinitionContainer import DefinitionContainer
MYPY = False
if MYPY:
from cura.PrinterOutput.Models.ExtruderConfigurationModel import ExtruderConfigurationModel
@ -68,6 +71,15 @@ class PrinterConfigurationModel(QObject):
return True
return False
@pyqtProperty("QStringList", constant=True)
def validCoresForPrinterType(self) -> List[str]:
printers = ContainerRegistry.getInstance().findContainersMetadata(
ignore_case=True, type="machine", name=self._printer_type, container_type=DefinitionContainer)
id = printers[0]["id"] if len(printers) > 0 and "id" in printers[0] else ""
definitions = ContainerRegistry.getInstance().findContainersMetadata(
ignore_case=True, type="variant", definition=id+"*")
return [x["name"] for x in definitions]
def __str__(self):
message_chunks = []
message_chunks.append("Printer type: " + self._printer_type)