| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/python3
- # This file was automatically generated from drawio2CBD from
- # {{ file }}
- from pyCBD.Core import *
- from pyCBD.lib.std import *
- {% for file, klss in imports.items() %}
- from {{ file }} import {{ klss|join(', ') }}
- {% endfor %}
- {% for block in classes %}
- class {{block.class_name}}(CBD):
- {% if block.docs != "" %}
- """
- {{ block.docs }}
- """
- {% endif %}
- def __init__(self, block_name{% if block.properties|length > 0 %}, {{block.get_properties()}}{% endif %}):
- super().__init__(block_name, input_ports={{block.get_inputs()}}, output_ports={{ block.get_outputs() }})
- # Create the Blocks
- {% for child in block.blocks %}
- self.addBlock({{child.class_name}}("{{child.block_name}}"{% if child.args|length > 0 %}, {{child.get_properties()}}{% endif %}))
- {% endfor %}
- # Create the Connections
- {% for source, target in block.connections %}
- {% set send = "" %}
- {% if source[1] is not none %}
- {% set send = ", output_port_name=\"" + source[1] + '"' %}
- {% endif %}
- {% set tend = "" %}
- {% if target[1] is not none %}
- {% set tend = ", input_port_name=\"" + target[1] + '"' %}
- {% endif %}
- self.addConnection("{{source[0]}}", "{{target[0]}}"{{ send }}{{ tend }})
- {% endfor %}
- {% endfor %}
|