mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Merge pull request #18737 from Ultimaker/CURA-11723-dont-show-anti-mesh-settings
Add visibility control for settings in 3MFWriter plugin
This commit is contained in:
commit
2ce731fb83
4 changed files with 19 additions and 6 deletions
|
@ -6,13 +6,14 @@ from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal
|
|||
|
||||
class SettingExport(QObject):
|
||||
|
||||
def __init__(self, id, name, value, selectable):
|
||||
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):
|
||||
|
@ -36,3 +37,7 @@ class SettingExport(QObject):
|
|||
@pyqtProperty(bool, constant=True)
|
||||
def selectable(self):
|
||||
return self._selectable
|
||||
|
||||
@pyqtProperty(bool, constant=True)
|
||||
def isVisible(self):
|
||||
return self._show_in_menu
|
||||
|
|
|
@ -23,6 +23,7 @@ class SettingsExportGroup(QObject):
|
|||
self._category_details = category_details
|
||||
self._extruder_index = extruder_index
|
||||
self._extruder_color = extruder_color
|
||||
self._visible_settings = []
|
||||
|
||||
@pyqtProperty(str, constant=True)
|
||||
def name(self):
|
||||
|
@ -32,6 +33,12 @@ class SettingsExportGroup(QObject):
|
|||
def settings(self):
|
||||
return self._settings
|
||||
|
||||
@pyqtProperty(list, constant=True)
|
||||
def visibleSettings(self):
|
||||
if self._visible_settings == []:
|
||||
self._visible_settings = list(filter(lambda item : item.isVisible, self._settings))
|
||||
return self._visible_settings
|
||||
|
||||
@pyqtProperty(int, constant=True)
|
||||
def category(self):
|
||||
return self._category
|
||||
|
|
|
@ -117,6 +117,7 @@ class SettingsExportModel(QObject):
|
|||
is_exportable = any(key in SettingsExportModel.PER_MODEL_EXPORTABLE_SETTINGS_KEYS for key in user_keys)
|
||||
|
||||
for setting_to_export in user_keys:
|
||||
show_in_menu = setting_to_export not in SettingsExportModel.PER_MODEL_EXPORTABLE_SETTINGS_KEYS
|
||||
label = settings_stack.getProperty(setting_to_export, "label")
|
||||
value = settings_stack.getProperty(setting_to_export, "value")
|
||||
unit = settings_stack.getProperty(setting_to_export, "unit")
|
||||
|
@ -130,6 +131,7 @@ class SettingsExportModel(QObject):
|
|||
settings_export.append(SettingExport(setting_to_export,
|
||||
label,
|
||||
value,
|
||||
is_exportable or setting_to_export in exportable_settings))
|
||||
is_exportable or setting_to_export in exportable_settings,
|
||||
show_in_menu))
|
||||
|
||||
return settings_export
|
||||
|
|
|
@ -71,8 +71,8 @@ ColumnLayout
|
|||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: contentHeight
|
||||
spacing: 0
|
||||
model: modelData.settings
|
||||
visible: modelData.settings.length > 0
|
||||
model: modelData.visibleSettings
|
||||
visible: modelData.visibleSettings.length > 0
|
||||
|
||||
delegate: SettingSelection { }
|
||||
}
|
||||
|
@ -80,8 +80,7 @@ ColumnLayout
|
|||
UM.Label
|
||||
{
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
||||
text: catalog.i18nc("@label", "No specific value has been set")
|
||||
visible: modelData.settings.length === 0
|
||||
visible: modelData.visibleSettings.length === 0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue