equal
deleted
inserted
replaced
24 |
24 |
25 import wx |
25 import wx |
26 |
26 |
27 from GraphicCommons import * |
27 from GraphicCommons import * |
28 from plcopen.structures import * |
28 from plcopen.structures import * |
29 |
29 from plcopen.structures import IsOfType |
30 |
30 |
31 #------------------------------------------------------------------------------- |
31 #------------------------------------------------------------------------------- |
32 # Function Block Diagram Block |
32 # Function Block Diagram Block |
33 #------------------------------------------------------------------------------- |
33 #------------------------------------------------------------------------------- |
34 |
34 |
135 return output |
135 return output |
136 return None |
136 return None |
137 |
137 |
138 def GetInputTypes(self): |
138 def GetInputTypes(self): |
139 return tuple([input.GetType() for input in self.Inputs]) |
139 return tuple([input.GetType() for input in self.Inputs]) |
|
140 |
|
141 def GetConnectionResultType(self, connector): |
|
142 resulttype = None |
|
143 for input in self.Inputs: |
|
144 name = input.GetName() |
|
145 if input != connector and (name.startswith("IN") or name in ["MN", "MX"]): |
|
146 inputtype = input.GetConnectedType() |
|
147 if resulttype is None or inputtype is not None and IsOfType(inputtype, resulttype): |
|
148 resulttype = inputtype |
|
149 for output in self.Outputs: |
|
150 name = output.GetName() |
|
151 if output != connector and name == "OUT": |
|
152 outputtype = output.GetConnectedType() |
|
153 if resulttype is None or outputtype is not None and IsOfType(outputtype, resulttype): |
|
154 resulttype = outputtype |
|
155 return resulttype |
140 |
156 |
141 # Returns all the block connectors |
157 # Returns all the block connectors |
142 def GetConnectors(self): |
158 def GetConnectors(self): |
143 return {"inputs" : self.Inputs, "outputs" : self.Outputs} |
159 return {"inputs" : self.Inputs, "outputs" : self.Outputs} |
144 |
160 |