SettingExport.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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, selectable):
  6. super().__init__()
  7. self.id = id
  8. self._name = name
  9. self._value = value
  10. self._selected = selectable
  11. self._selectable = selectable
  12. @pyqtProperty(str, constant=True)
  13. def name(self):
  14. return self._name
  15. @pyqtProperty(str, constant=True)
  16. def value(self):
  17. return self._value
  18. selectedChanged = pyqtSignal(bool)
  19. def setSelected(self, selected):
  20. if selected != self._selected:
  21. self._selected = selected
  22. self.selectedChanged.emit(self._selected)
  23. @pyqtProperty(bool, fset = setSelected, notify = selectedChanged)
  24. def selected(self):
  25. return self._selected
  26. @pyqtProperty(bool, constant=True)
  27. def selectable(self):
  28. return self._selectable