本文整理汇总了Python中UM.Settings.InstanceContainer.InstanceContainer.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Python InstanceContainer.getProperty方法的具体用法?Python InstanceContainer.getProperty怎么用?Python InstanceContainer.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UM.Settings.InstanceContainer.InstanceContainer
的用法示例。
在下文中一共展示了InstanceContainer.getProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_roundtrip_instance
# 需要导入模块: from UM.Settings.InstanceContainer import InstanceContainer [as 别名]
# 或者: from UM.Settings.InstanceContainer.InstanceContainer import getProperty [as 别名]
def test_roundtrip_instance(tmpdir, process_count, loaded_container_registry):
definition = loaded_container_registry.findDefinitionContainers(id = "inherits")[0]
instance_container = InstanceContainer("test_container")
instance_container.setName("Test Instance Container")
instance_container.setDefinition(definition)
instance_container.addMetaDataEntry("test", "test")
instance_container.setProperty("test_setting_1", "value", 20)
temp_file = tmpdir.join("instance_container_test")
mp_run(process_count, write_data, temp_file, instance_container)
assert len(list(tmpdir.listdir())) == 1
results = mp_run(process_count, read_data, temp_file)
for result in results:
deserialized_container = InstanceContainer("test_container")
deserialized_container.setDefinition(definition)
deserialized_container.deserialize(result)
assert deserialized_container.getName() == instance_container.getName()
assert deserialized_container.getMetaData() == instance_container.getMetaData()
assert deserialized_container.getProperty("test_setting_1", "value") == instance_container.getProperty("test_setting_1", "value")
示例2: _performMerge
# 需要导入模块: from UM.Settings.InstanceContainer import InstanceContainer [as 别名]
# 或者: from UM.Settings.InstanceContainer.InstanceContainer import getProperty [as 别名]
def _performMerge(self, merge_into: InstanceContainer, merge: InstanceContainer, clear_settings: bool = True) -> None:
if merge == merge_into:
return
for key in merge.getAllKeys():
merge_into.setProperty(key, "value", merge.getProperty(key, "value"))
if clear_settings:
merge.clear()