graphics/FBD_Objects.py
changeset 526 79900abdfa3c
parent 388 7ea1f5094df3
child 533 7081b52a8a2d
equal deleted inserted replaced
525:e8d5ab0855d3 526:79900abdfa3c
   186         for output in self.Outputs:
   186         for output in self.Outputs:
   187             output.SetValue(values.get(ouput.getName(), None))
   187             output.SetValue(values.get(ouput.getName(), None))
   188     
   188     
   189     def GetConnectionResultType(self, connector, connectortype):
   189     def GetConnectionResultType(self, connector, connectortype):
   190         resulttype = connectortype
   190         resulttype = connectortype
       
   191         undefined = True
   191         for input in self.Inputs:
   192         for input in self.Inputs:
   192             name = input.GetName()
   193             name = input.GetName()
       
   194             undefined = undefined and input.GetType(True) == "ANY"
   193             if input != connector and (name.startswith("IN") or name in ["MN", "MX"]):
   195             if input != connector and (name.startswith("IN") or name in ["MN", "MX"]):
   194                 inputtype = input.GetConnectedType()
   196                 inputtype = input.GetConnectedType()
   195                 if resulttype is None or inputtype is not None and self.IsOfType(inputtype, resulttype):
   197                 if resulttype is None or inputtype is not None and self.IsOfType(inputtype, resulttype):
   196                     resulttype = inputtype
   198                     resulttype = inputtype
   197         for output in self.Outputs:
   199         for output in self.Outputs:
   198             name = output.GetName()
   200             name = output.GetName()
       
   201             undefined = undefined and output.GetType(True) == "ANY"
   199             if output != connector and name == "OUT" and not self.IsEndType(output.GetType()):
   202             if output != connector and name == "OUT" and not self.IsEndType(output.GetType()):
   200                 outputtype = output.GetConnectedType()
   203                 outputtype = output.GetConnectedType()
   201                 if resulttype is None or outputtype is not None and self.IsOfType(outputtype, resulttype):
   204                 if resulttype is None or outputtype is not None and self.IsOfType(outputtype, resulttype):
   202                     resulttype = outputtype
   205                     resulttype = outputtype
   203         return resulttype
   206         if not undefined:
       
   207             return resulttype
       
   208         return "ANY"
   204     
   209     
   205     # Returns all the block connectors
   210     # Returns all the block connectors
   206     def GetConnectors(self):
   211     def GetConnectors(self):
   207         return {"inputs" : self.Inputs, "outputs" : self.Outputs}
   212         return {"inputs" : self.Inputs, "outputs" : self.Outputs}
   208     
   213