def createPortItem(self, port, x, y):
        """ createPortItem(port: Port, x: int, y: int) -> QGraphicsPortItem
        Create a item from the port spec
        
        """
        # pts = [(0,2),(0,-2), (2,None), (-2,None),
        #        (None,-2), (None,2), (-2,0), (2,0)]
        # pts = [(0,0.2), (0, 0.8), (0.2, None), (0.8, None), 
        #        (None, 0.8), (None, 0.2), (0.8,0), (0.2, 0)]
        # portShape = QGraphicsPortPolygonItem(x, y, self.ghosted, self, 
        #                                      port.optional, port.min_conns,
        #                                      port.max_conns, points=pts)
        # portShape = QGraphicsPortTriangleItem(x, y, self.ghosted, self, 
        #                                       port.optional, port.min_conns,
        #                                       port.max_conns, angle=0)
        # portShape = QGraphicsPortDiamondItem(x, y, self.ghosted, self, 
        #                                      port.optional, port.min_conns,
        #                                      port.max_conns)
    
        port_klass = QGraphicsPortRectItem
        kwargs = {}
        shape = port.shape()
        if shape is not None:
            if isinstance(shape, basestring):
                if shape.startswith("triangle"):
                    port_klass = QGraphicsPortTriangleItem
                    try:
                        kwargs['angle'] = int(shape[8:])
                    except __HOLE__:
                        kwargs['angle'] = 0
                elif shape == "diamond":
                    port_klass = QGraphicsPortDiamondItem
                elif shape == "circle" or shape == "ellipse":
                    port_klass = QGraphicsPortEllipseItem
            else:
                try:
                    iter(shape)
                except TypeError:
                    pass
                else:
                    port_klass = QGraphicsPortPolygonItem
                    kwargs['points'] = shape

        portShape = port_klass(port, x, y, self.ghosted, self, **kwargs)
        # portShape = QGraphicsPortRectItem(port, x, y, self.ghosted, self)

        portShape.controller = self.controller
        portShape.port = port
        # do not show as invalid in search mode
        if not port.is_valid and not (self.controller and self.controller.search):
            portShape.setInvalid(True)
        return portShape
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/gui/pipeline_view.py/QGraphicsModuleItem.createPortItem