def __init__(self, width=10, height=10): super(PortoBox, self).__init__(width, height) # disable default ports for p in self._ports: p.connectable = False nw = self._handles[NW] sw = self._handles[SW] ne = self._handles[NE] se = self._handles[SE] # handle for movable port self._hm = Handle(strength=WEAK) self._hm.pos = width, height / 2.0 self._handles.append(self._hm) # movable port self._ports.append(PointPort(self._hm.pos)) # keep movable port at right edge self.constraint(vertical=(self._hm.pos, ne.pos), delta=10) self.constraint(above=(ne.pos, self._hm.pos)) self.constraint(above=(self._hm.pos, se.pos)) # static point port self._sport = PointPort(Position((width / 2.0, height))) l = sw.pos, se.pos self.constraint(line=(self._sport.point, l)) self._ports.append(self._sport) # line port self._lport = LinePort(nw.pos, se.pos) self._ports.append(self._lport)
def __init__(self): super().__init__() self._handles = [Handle(movable=False)] h = self._handles[0] h.visible = False self._ports.append(PointPort(h.pos)) self.id: int self.colour_hovered = (0.8, 0.8, 1, 0.8) self.colour = (1, 0, 1, 0.8)