90 |
90 |
91 # Refresh the positions of the block connectors |
91 # Refresh the positions of the block connectors |
92 def RefreshConnectors(self): |
92 def RefreshConnectors(self): |
93 # Calculate the size for the connector lines |
93 # Calculate the size for the connector lines |
94 lines = max(len(self.Inputs), len(self.Outputs)) |
94 lines = max(len(self.Inputs), len(self.Outputs)) |
95 linesize = max((self.Size[1] - BLOCK_LINE_SIZE) / lines, BLOCK_LINE_SIZE) |
95 if lines > 0: |
96 # Update inputs positions |
96 linesize = max((self.Size[1] - BLOCK_LINE_SIZE) / lines, BLOCK_LINE_SIZE) |
97 position = BLOCK_LINE_SIZE + linesize / 2 |
97 # Update inputs positions |
98 for input in self.Inputs: |
98 position = BLOCK_LINE_SIZE + linesize / 2 |
99 input.SetPosition(wx.Point(0, position)) |
99 for input in self.Inputs: |
100 position += linesize |
100 input.SetPosition(wx.Point(0, position)) |
101 # Update outputs positions |
101 position += linesize |
102 position = BLOCK_LINE_SIZE + linesize / 2 |
102 # Update outputs positions |
103 for output in self.Outputs: |
103 position = BLOCK_LINE_SIZE + linesize / 2 |
104 output.SetPosition(wx.Point(self.Size[0], position)) |
104 for output in self.Outputs: |
105 position += linesize |
105 output.SetPosition(wx.Point(self.Size[0], position)) |
|
106 position += linesize |
106 self.RefreshConnected() |
107 self.RefreshConnected() |
107 |
108 |
108 # Refresh the positions of wires connected to inputs and outputs |
109 # Refresh the positions of wires connected to inputs and outputs |
109 def RefreshConnected(self, exclude = []): |
110 def RefreshConnected(self, exclude = []): |
110 for input in self.Inputs: |
111 for input in self.Inputs: |