mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 15:39:00 +08:00
Add missing file
CURA-11561
This commit is contained in:
parent
636de30c35
commit
31f3d6161d
38
plugins/3MFReader/SpecificSettingsModel.py
Normal file
38
plugins/3MFReader/SpecificSettingsModel.py
Normal file
@ -0,0 +1,38 @@
|
||||
# Copyright (c) 2024 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
from UM.Settings.SettingDefinition import SettingDefinition
|
||||
from UM.Qt.ListModel import ListModel
|
||||
|
||||
|
||||
class SpecificSettingsModel(ListModel):
|
||||
CategoryRole = Qt.ItemDataRole.UserRole + 1
|
||||
LabelRole = Qt.ItemDataRole.UserRole + 2
|
||||
ValueRole = Qt.ItemDataRole.UserRole + 3
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super().__init__(parent = parent)
|
||||
self.addRoleName(self.CategoryRole, "category")
|
||||
self.addRoleName(self.LabelRole, "label")
|
||||
self.addRoleName(self.ValueRole, "value")
|
||||
|
||||
self._i18n_catalog = None
|
||||
|
||||
def addSettingsFromStack(self, stack, category, settings):
|
||||
for setting, value in settings.items():
|
||||
unit = stack.getProperty(setting, "unit")
|
||||
|
||||
setting_type = stack.getProperty(setting, "type")
|
||||
if setting_type is not None:
|
||||
# This is not very good looking, but will do for now
|
||||
value = SettingDefinition.settingValueToString(setting_type, value) + " " + unit
|
||||
else:
|
||||
value = str(value)
|
||||
|
||||
self.appendItem({
|
||||
"category": category,
|
||||
"label": stack.getProperty(setting, "label"),
|
||||
"value": value
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user