def RefreshConnectors(self):
scaling = self.Parent.GetScaling()
# Calculate the size for the connector lines
lines = max(len(self.Inputs), len(self.Outputs))
if lines > 0:
linesize = max((self.Size[1] - BLOCK_LINE_SIZE) / lines, BLOCK_LINE_SIZE)
# Update inputs and outputs positions
position = BLOCK_LINE_SIZE + linesize / 2
for i in xrange(lines):
if scaling is not None:
ypos = round_scaling(self.Pos.y + position, scaling[1]) - self.Pos.y
else:
ypos = position
if i < len(self.Inputs):
self.Inputs[i].SetPosition(wx.Point(0, ypos))
if i < len(self.Outputs):
self.Outputs[i].SetPosition(wx.Point(self.Size[0], ypos))
position += linesize
self.RefreshConnected()
# Refresh the positions of wires connected to inputs and outputs
评论列表
文章目录