def glue(self, pos):
    '\n        Behaves like simple line port, but for folded interface suggests\n        connection to the middle point of a port.\n        '
    if self.is_folded():
        px = ((self.start.x + self.end.x) / 2)
        py = ((self.start.y + self.end.y) / 2)
        d = distance_point_point((px, py), pos)
        return ((px, py), d)
    else:
        (d, pl) = distance_line_point(self.start, self.end, pos)
        return (pl, d)
Behaves like simple line port, but for folded interface suggests
connection to the middle point of a port.
def glue(self, pos):
    '\n        Behaves like simple line port, but for folded interface suggests\n        connection to the middle point of a port.\n        '
    if self.is_folded():
        px = ((self.start.x + self.end.x) / 2)
        py = ((self.start.y + self.end.y) / 2)
        d = distance_point_point((px, py), pos)
        return ((px, py), d)
    else:
        (d, pl) = distance_line_point(self.start, self.end, pos)
        return (pl, d)