--- a/graphics/FBD_Objects.py Wed Mar 07 10:06:01 2012 +0100
+++ b/graphics/FBD_Objects.py Sun Mar 18 15:35:07 2012 +0100
@@ -35,6 +35,9 @@
Class that implements the graphic representation of a function block
"""
+def TestConnectorName(name, block_type):
+ return name in ["OUT", "MN", "MX"] or name.startswith("IN") and (block_type, name) != ("EXPT", "IN2")
+
class FBD_Block(Graphic_Element):
# Create a new block
@@ -178,26 +181,21 @@
output.SetValue(values.get(ouput.getName(), None))
def GetConnectionResultType(self, connector, connectortype):
+ if not TestConnectorName(connector.GetName(), self.Type):
+ return connectortype
resulttype = connectortype
- undefined = True
for input in self.Inputs:
- name = input.GetName()
- undefined = undefined and input.GetType(True) == "ANY"
- if input != connector and (name.startswith("IN") or name in ["MN", "MX"]):
+ if input != connector and TestConnectorName(input.GetName(), self.Type):
inputtype = input.GetConnectedType()
if resulttype is None or inputtype is not None and self.IsOfType(inputtype, resulttype):
resulttype = inputtype
for output in self.Outputs:
- name = output.GetName()
- undefined = undefined and output.GetType(True) == "ANY"
- if output != connector and name == "OUT" and not self.IsEndType(output.GetType()):
+ if output != connector and TestConnectorName(output.GetName(), self.Type):
outputtype = output.GetConnectedType()
if resulttype is None or outputtype is not None and self.IsOfType(outputtype, resulttype):
resulttype = outputtype
- if not undefined:
- return resulttype
- return "ANY"
-
+ return resulttype
+
# Returns all the block connectors
def GetConnectors(self):
return {"inputs" : self.Inputs, "outputs" : self.Outputs}