--- a/graphics/FBD_Objects.py Tue Apr 23 12:50:53 2013 +0200
+++ b/graphics/FBD_Objects.py Tue Apr 23 21:46:15 2013 +0200
@@ -263,43 +263,49 @@
self.Pen = MiterPen(self.Colour)
# Extract the inputs properties and create or modify the corresponding connector
- idx = 0
- for idx, (input_name, input_type, input_modifier) in enumerate(inputs):
- if idx < len(self.Inputs):
- connector = self.Inputs[idx]
- connector.SetName(input_name)
- connector.SetType(input_type)
- else:
- connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
- self.Inputs.append(connector)
+ input_connectors = []
+ for input_name, input_type, input_modifier in inputs:
+ connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
if input_modifier == "negated":
connector.SetNegated(True)
elif input_modifier != "none":
connector.SetEdge(input_modifier)
- for i in xrange(idx + 1, len(self.Inputs)):
- self.Inputs[i].UnConnect(delete = True)
- self.Inputs = self.Inputs[:idx + 1]
+ for input in self.Inputs:
+ if input.GetName() == input_name:
+ wires = input.GetWires()[:]
+ input.UnConnect()
+ for wire in wires:
+ connector.Connect(wire)
+ break
+ input_connectors.append(connector)
+ for input in self.Inputs:
+ input.UnConnect(delete = True)
+ self.Inputs = input_connectors
# Extract the outputs properties and create or modify the corresponding connector
- idx = 0
- for idx, (output_name, output_type, output_modifier) in enumerate(outputs):
- if idx < len(self.Outputs):
- connector = self.Outputs[idx]
- connector.SetName(output_name)
- connector.SetType(output_type)
- else:
- connector = Connector(self, output_name, output_type, wx.Point(0, 0), EAST)
- self.Outputs.append(connector)
+ output_connectors = []
+ for output_name, output_type, output_modifier in outputs:
+ connector = Connector(self, output_name, output_type, wx.Point(0, 0), EAST)
if output_modifier == "negated":
connector.SetNegated(True)
elif output_modifier != "none":
connector.SetEdge(output_modifier)
- for i in xrange(idx + 1, len(self.Outputs)):
- self.Outputs[i].UnConnect(delete = True)
- self.Outputs = self.Outputs[:idx + 1]
+ for output in self.Outputs:
+ if output.GetName() == output_name:
+ wires = output.GetWires()[:]
+ output.UnConnect()
+ for wire in wires:
+ connector.Connect(wire)
+ break
+ output_connectors.append(connector)
+ for output in self.Outputs:
+ output.UnConnect(delete = True)
+ self.Outputs = output_connectors
self.RefreshMinSize()
self.RefreshConnectors()
+ for output in self.Outputs:
+ output.RefreshWires()
self.RefreshBoundingBox()
# Returns the block type
--- a/graphics/GraphicCommons.py Tue Apr 23 12:50:53 2013 +0200
+++ b/graphics/GraphicCommons.py Tue Apr 23 21:46:15 2013 +0200
@@ -1695,6 +1695,10 @@
def InsertConnect(self, idx, wire, refresh = True):
if wire not in self.Wires:
self.Wires.insert(idx, wire)
+ if wire[1] == 0:
+ wire[0].ConnectStartPoint(None, self)
+ else:
+ wire[0].ConnectEndPoint(None, self)
if refresh:
self.ParentBlock.RefreshModel(False)