def RefreshConnectors(self):
scaling = self.Parent.GetScaling()
height = self.Size[1] - self.Extensions[0] - self.Extensions[1]
interval = float(height) / float(max(len(self.Connectors) - 1, 1))
for i, connector in enumerate(self.Connectors):
if self.RealConnectors:
position = self.Extensions[0] + int(round(self.RealConnectors[i] * height))
else:
position = self.Extensions[0] + int(round(i * interval))
if scaling is not None:
position = round(float(self.Pos.y + position) / float(scaling[1])) * scaling[1] - self.Pos.y
if self.Type == LEFTRAIL:
connector.SetPosition(wx.Point(self.Size[0], position))
elif self.Type == RIGHTRAIL:
connector.SetPosition(wx.Point(0, position))
self.RefreshConnected()
# Refresh the position of wires connected to power rail
评论列表
文章目录