Cura/plugins/3MFWriter/SettingExport.py
Saumya Jain 6ddd96f914 Add visibility control for settings in 3MFWriter plugin
Introduced a new property 'show_in_menu' to control the visibility of individual settings in 3MFWriter plugin. Modified 'SettingExport' class constructor to store this visibility status. Also, updated the 'SettingsExportGroup' model to filter the settings based on visibility before presenting them in the GUI.

CURA-11723
2024-03-26 20:37:43 +01:00

44 lines
1.1 KiB
Python

# Copyright (c) 2024 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal
class SettingExport(QObject):
def __init__(self, id, name, value, selectable, show):
super().__init__()
self.id = id
self._name = name
self._value = value
self._selected = selectable
self._selectable = selectable
self._show_in_menu = show
@pyqtProperty(str, constant=True)
def name(self):
return self._name
@pyqtProperty(str, constant=True)
def value(self):
return self._value
selectedChanged = pyqtSignal(bool)
def setSelected(self, selected):
if selected != self._selected:
self._selected = selected
self.selectedChanged.emit(self._selected)
@pyqtProperty(bool, fset = setSelected, notify = selectedChanged)
def selected(self):
return self._selected
@pyqtProperty(bool, constant=True)
def selectable(self):
return self._selectable
@pyqtProperty(bool, constant=True)
def isVisible(self):
return self._show_in_menu