SettingsExportGroup.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (c) 2024 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from enum import IntEnum
  4. from PyQt6.QtCore import QObject, pyqtProperty, pyqtEnum
  5. class SettingsExportGroup(QObject):
  6. @pyqtEnum
  7. class Category(IntEnum):
  8. Global = 0
  9. Extruder = 1
  10. Model = 2
  11. def __init__(self, stack, name, category, settings, category_details = '', extruder_index = 0, extruder_color = ''):
  12. super().__init__()
  13. self.stack = stack
  14. self._name = name
  15. self._settings = settings
  16. self._category = category
  17. self._category_details = category_details
  18. self._extruder_index = extruder_index
  19. self._extruder_color = extruder_color
  20. self._visible_settings = []
  21. @pyqtProperty(str, constant=True)
  22. def name(self):
  23. return self._name
  24. @pyqtProperty(list, constant=True)
  25. def settings(self):
  26. return self._settings
  27. @pyqtProperty(list, constant=True)
  28. def visibleSettings(self):
  29. if self._visible_settings == []:
  30. self._visible_settings = list(filter(lambda item : item.isVisible, self._settings))
  31. return self._visible_settings
  32. @pyqtProperty(int, constant=True)
  33. def category(self):
  34. return self._category
  35. @pyqtProperty(str, constant=True)
  36. def category_details(self):
  37. return self._category_details
  38. @pyqtProperty(int, constant=True)
  39. def extruder_index(self):
  40. return self._extruder_index
  41. @pyqtProperty(str, constant=True)
  42. def extruder_color(self):
  43. return self._extruder_color