ConfigurationChangeModel.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (c) 2019 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from PyQt5.QtCore import pyqtProperty, QObject
  4. BLOCKING_CHANGE_TYPES = [
  5. "material_insert", "buildplate_change"
  6. ]
  7. class ConfigurationChangeModel(QObject):
  8. def __init__(self, type_of_change: str, index: int, target_name: str, origin_name: str) -> None:
  9. super().__init__()
  10. self._type_of_change = type_of_change # enum = ["material", "print_core_change"]
  11. self._can_override = self._type_of_change not in BLOCKING_CHANGE_TYPES
  12. self._index = index
  13. self._target_name = target_name
  14. self._origin_name = origin_name
  15. @pyqtProperty(int, constant = True)
  16. def index(self) -> int:
  17. return self._index
  18. @pyqtProperty(str, constant = True)
  19. def typeOfChange(self) -> str:
  20. return self._type_of_change
  21. @pyqtProperty(str, constant = True)
  22. def targetName(self) -> str:
  23. return self._target_name
  24. @pyqtProperty(str, constant = True)
  25. def originName(self) -> str:
  26. return self._origin_name
  27. @pyqtProperty(bool, constant = True)
  28. def canOverride(self) -> bool:
  29. return self._can_override