diff options
author | Remco Burema <r.burema@ultimaker.com> | 2022-09-09 12:05:05 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2022-09-09 12:05:05 +0300 |
commit | 6adf05bbf054a87316fa283e10ee7d8367bb787e (patch) | |
tree | a00f59c975612fbaa7665d38480597614c4ec303 /cura/Machines | |
parent | d955a05d55f493504a67376a09e5149ba477845f (diff) |
Complete interface for selecting cloud printer.
CURA-9278
Diffstat (limited to 'cura/Machines')
-rw-r--r-- | cura/Machines/Models/CompatibleMachineModel.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/cura/Machines/Models/CompatibleMachineModel.py b/cura/Machines/Models/CompatibleMachineModel.py index 5526c67331..1ac13d4ad4 100644 --- a/cura/Machines/Models/CompatibleMachineModel.py +++ b/cura/Machines/Models/CompatibleMachineModel.py @@ -1,24 +1,18 @@ # Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -# TODO?: documentation - -from typing import Optional, Dict, cast +from typing import Optional from PyQt6.QtCore import Qt, QObject, pyqtSlot, pyqtProperty, pyqtSignal +from UM.Logger import Logger from UM.Qt.ListModel import ListModel -from UM.Settings.ContainerStack import ContainerStack from UM.i18n import i18nCatalog -from UM.Util import parseBool - -from cura.Settings.CuraContainerRegistry import CuraContainerRegistry -from cura.Settings.ExtruderStack import ExtruderStack class CompatibleMachineModel(ListModel): NameRole = Qt.ItemDataRole.UserRole + 1 - IdRole = Qt.ItemDataRole.UserRole + 2 + UniqueIdRole = Qt.ItemDataRole.UserRole + 2 ExtrudersRole = Qt.ItemDataRole.UserRole + 3 def __init__(self, parent: Optional[QObject] = None) -> None: @@ -27,7 +21,7 @@ class CompatibleMachineModel(ListModel): self._catalog = i18nCatalog("cura") self.addRoleName(self.NameRole, "name") - self.addRoleName(self.IdRole, "id") + self.addRoleName(self.UniqueIdRole, "unique_id") self.addRoleName(self.ExtrudersRole, "extruders") self._update() @@ -62,11 +56,10 @@ class CompatibleMachineModel(ListModel): # add currently inactive, but possible materials: for configuration in printer.availableConfigurations: - print(" CONFIG !") for extruder in configuration.extruderConfigurations: if not extruder.position in extruder_configs: - # TODO: log -- all extruders should be present in the init round, regardless of if a material was active + Logger.log("w", f"No active extruder for position {extruder.position}.") continue extruder_configs[extruder.position]["materials"].append({ @@ -77,8 +70,6 @@ class CompatibleMachineModel(ListModel): self.appendItem({ "name": printer.name, - "id": printer.uniqueName, + "unique_id": printer.uniqueName, "extruders": [extruder for extruder in extruder_configs.values()] }) - - # TODO: Handle 0 compatible machines -> option to close window? Message in card? (remember the design has a refresh button!) |