SettingExport.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright (c) 2024 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal
  4. class SettingExport(QObject):
  5. def __init__(self, id, name, value, value_name, selectable, show):
  6. super().__init__()
  7. self.id = id
  8. self._name = name
  9. self._value = value
  10. self._value_name = value_name
  11. self._selected = selectable
  12. self._selectable = selectable
  13. self._show_in_menu = show
  14. @pyqtProperty(str, constant=True)
  15. def name(self):
  16. return self._name
  17. @pyqtProperty(str, constant=True)
  18. def value(self):
  19. return self._value
  20. @pyqtProperty(str, constant=True)
  21. def valuename(self):
  22. return str(self._value_name)
  23. selectedChanged = pyqtSignal(bool)
  24. def setSelected(self, selected):
  25. if selected != self._selected:
  26. self._selected = selected
  27. self.selectedChanged.emit(self._selected)
  28. @pyqtProperty(bool, fset = setSelected, notify = selectedChanged)
  29. def selected(self):
  30. return self._selected
  31. @pyqtProperty(bool, constant=True)
  32. def selectable(self):
  33. return self._selectable
  34. @pyqtProperty(bool, constant=True)
  35. def isVisible(self):
  36. return self._show_in_menu