MaterialOutputModel.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (c) 2017 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from typing import Optional
  4. from PyQt5.QtCore import pyqtProperty, QObject
  5. class MaterialOutputModel(QObject):
  6. def __init__(self, guid: Optional[str], type: str, color: str, brand: str, name: str, parent = None) -> None:
  7. super().__init__(parent)
  8. self._guid = guid
  9. self._type = type
  10. self._color = color
  11. self._brand = brand
  12. self._name = name
  13. @pyqtProperty(str, constant = True)
  14. def guid(self) -> str:
  15. return self._guid if self._guid else ""
  16. @pyqtProperty(str, constant = True)
  17. def type(self) -> str:
  18. return self._type
  19. @pyqtProperty(str, constant = True)
  20. def brand(self) -> str:
  21. return self._brand
  22. @pyqtProperty(str, constant = True)
  23. def color(self) -> str:
  24. return self._color
  25. @pyqtProperty(str, constant = True)
  26. def name(self) -> str:
  27. return self._name
  28. def __eq__(self, other):
  29. if self is other:
  30. return True
  31. if type(other) is not MaterialOutputModel:
  32. return False
  33. return self.guid == other.guid and self.type == other.type and self.brand == other.brand and self.color == other.color and self.name == other.name