本文整理汇总了Python中UM.Settings.ContainerStack.ContainerStack.getMetaData方法的典型用法代码示例。如果您正苦于以下问题:Python ContainerStack.getMetaData方法的具体用法?Python ContainerStack.getMetaData怎么用?Python ContainerStack.getMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UM.Settings.ContainerStack.ContainerStack
的用法示例。
在下文中一共展示了ContainerStack.getMetaData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_roundtrip_stack
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import getMetaData [as 别名]
def test_roundtrip_stack(tmpdir, process_count, loaded_container_registry):
definition = loaded_container_registry.findDefinitionContainers(id = "multiple_settings")[0]
instances = loaded_container_registry.findInstanceContainers(id = "setting_values")[0]
container_stack = ContainerStack("test_stack")
container_stack.setName("Test Container Stack")
container_stack.addMetaDataEntry("test", "test")
container_stack.addContainer(definition)
container_stack.addContainer(instances)
temp_file = tmpdir.join("container_stack_test")
mp_run(process_count, write_data, temp_file, container_stack)
assert len(list(tmpdir.listdir())) == 1
results = mp_run(process_count, read_data, temp_file)
for result in results:
deserialized_stack = ContainerStack("test_stack")
deserialized_stack.deserialize(result)
assert deserialized_stack.getName() == container_stack.getName()
assert deserialized_stack.getMetaData() == container_stack.getMetaData()
assert deserialized_stack.getBottom() == container_stack.getBottom()
assert deserialized_stack.getTop() == container_stack.getTop()
示例2: test_findContainerStacks
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import getMetaData [as 别名]
def test_findContainerStacks(container_registry, data):
for container in data["containers"]: # Fill the registry with container stacks.
container = container.copy()
container_id = container["id"]
del container["id"]
container_stack = ContainerStack(container_id)
for key, value in container.items(): # Copy data into metadata.
container_stack.getMetaData()[key] = value
container_registry.addContainer(container_stack)
results = container_registry.findContainerStacks(**data["filter"]) # The actual function call we're testing.
_verifyMetaDataMatches(results, data["result"])
示例3: _test_serialize_cycle
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import getMetaData [as 别名]
def _test_serialize_cycle(container_stack):
name = container_stack.getName()
metadata = container_stack.getMetaData()
containers = container_stack.getContainers()
serialised = container_stack.serialize()
container_stack = ContainerStack(uuid.uuid4().int) # Completely fresh container stack.
container_stack.deserialize(serialised)
#ID and nextStack are allowed to be different.
assert name == container_stack.getName()
assert metadata == container_stack.getMetaData()
assert containers == container_stack.getContainers()
示例4: _test_serialize_cycle
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import getMetaData [as 别名]
def _test_serialize_cycle(container_stack, ignored_metadata_keys: Optional[set] = None):
metadata = {key: value for key, value in container_stack.getMetaData().items()}
containers = container_stack.getContainers()
serialised = container_stack.serialize(ignored_metadata_keys = ignored_metadata_keys)
container_stack = ContainerStack(str(uuid.uuid4())) # Completely fresh container stack.
container_stack.deserialize(serialised)
# Remove ignored keys from metadata dict
if ignored_metadata_keys:
for key in ignored_metadata_keys:
if key in metadata:
del metadata[key]
# ID and nextStack are allowed to be different.
assert metadata.items() <= container_stack.getMetaData().items()
assert containers == container_stack.getContainers()
示例5: addExtruder
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import getMetaData [as 别名]
def addExtruder(self, extruder: ContainerStack) -> None:
extruder_count = self.getProperty("machine_extruder_count", "value")
if extruder_count and len(self._extruders) + 1 > extruder_count:
Logger.log("w", "Adding extruder {meta} to {id} but its extruder count is {count}".format(id = self.id, count = extruder_count, meta = str(extruder.getMetaData())))
return
position = extruder.getMetaDataEntry("position")
if position is None:
Logger.log("w", "No position defined for extruder {extruder}, cannot add it to stack {stack}", extruder = extruder.id, stack = self.id)
return
if any(item.getId() == extruder.id for item in self._extruders.values()):
Logger.log("w", "Extruder [%s] has already been added to this stack [%s]", extruder.id, self._id)
return
self._extruders[position] = extruder