コード例 #1
0
    def create_block(self, diagram_control=None):
        if diagram_control is None:
            diagram_control = self.create_diagram_control()

        block_model = BlockModel()
        block_model.maxIO = 2

        block = Block(diagram_control.diagram, block_model)
        block.language = "language"
        block.properties = [{"name": "test", "label": "Test", "type": "Test"}]

        block.ports = [{
            "type": "Test",
            "label": "Input",
            "conn_type": "Input",
            "name": "input"
        }, {
            "type": "Test",
            "label": "Output",
            "conn_type": "Outpu",
            "name": "output"
        }]

        BlockControl.load_ports(block, System.get_ports())

        DiagramControl.add_block(diagram_control.diagram, block)
        return block
コード例 #2
0
 def test_set_block(self):
     block = Block(self.create_diagram(), self.create_block())
     block.properties = [{"name": "curve",
                         "label": "Curve",
                         "type": MOSAICODE_FLOAT,
                         "value": 800
                         }
                        ]
     self.propertybox.set_block(block)
     block.properties = [{"name": "curve",
                         "label": "Curve",
                         "type": MOSAICODE_OPEN_FILE,
                         "value": "800"
                         }
                        ]
     self.propertybox.set_block(block)
     self.propertybox.notify_block()