BuildPlateModel.py 710 B

123456789101112131415161718192021222324
  1. # Copyright (c) 2019 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from PyQt6.QtCore import Qt
  4. from UM.Logger import Logger
  5. from UM.Qt.ListModel import ListModel
  6. class BuildPlateModel(ListModel):
  7. NameRole = Qt.ItemDataRole.UserRole + 1
  8. ContainerNodeRole = Qt.ItemDataRole.UserRole + 2
  9. def __init__(self, parent = None):
  10. super().__init__(parent)
  11. self.addRoleName(self.NameRole, "name")
  12. self.addRoleName(self.ContainerNodeRole, "container_node")
  13. self._update()
  14. def _update(self):
  15. Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
  16. self.setItems([])
  17. return