270 action_pos = self.Action.GetRelPosition() |
270 action_pos = self.Action.GetRelPosition() |
271 if position.x == self.Pos.x + action_pos.x and position.y == self.Pos.y + action_pos.y: |
271 if position.x == self.Pos.x + action_pos.x and position.y == self.Pos.y + action_pos.y: |
272 return self.Action |
272 return self.Action |
273 return None |
273 return None |
274 |
274 |
|
275 # Returns action step connector |
|
276 def GetActionConnector(self): |
|
277 return self.Action |
|
278 |
275 # Returns input and output step connectors |
279 # Returns input and output step connectors |
276 def GetConnectors(self): |
280 def GetConnectors(self): |
277 return {"input":self.Input,"output":self.Output,"action":self.Action} |
281 connectors = {"inputs": [], "outputs": []} |
|
282 if self.Input: |
|
283 connectors["inputs"].append(self.Input) |
|
284 if self.Output: |
|
285 connectors["outputs"].append(self.Output) |
|
286 return connectors |
278 |
287 |
279 # Test if point given is on step input or output connector |
288 # Test if point given is on step input or output connector |
280 def TestConnector(self, pt, direction = None, exclude=True): |
289 def TestConnector(self, pt, direction = None, exclude=True): |
281 # Test input connector if it exists |
290 # Test input connector if it exists |
282 if self.Input and self.Input.TestPoint(pt, direction, exclude): |
291 if self.Input and self.Input.TestPoint(pt, direction, exclude): |
317 if len(wires) == 1: |
326 if len(wires) == 1: |
318 return wires[0][0].GetOtherConnected(self.Output) |
327 return wires[0][0].GetOtherConnected(self.Output) |
319 return None |
328 return None |
320 |
329 |
321 # Returns the connector connected to action |
330 # Returns the connector connected to action |
322 def GetActionConnector(self): |
331 def GetActionConnected(self): |
323 if self.Action: |
332 if self.Action: |
324 wires = self.Action.GetWires() |
333 wires = self.Action.GetWires() |
325 if len(wires) == 1: |
334 if len(wires) == 1: |
326 return wires[0][0].GetOtherConnected(self.Action) |
335 return wires[0][0].GetOtherConnected(self.Action) |
327 return None |
336 return None |
489 |
498 |
490 # Refreshes the step model |
499 # Refreshes the step model |
491 def RefreshModel(self, move=True): |
500 def RefreshModel(self, move=True): |
492 self.Parent.RefreshStepModel(self) |
501 self.Parent.RefreshStepModel(self) |
493 if self.Action: |
502 if self.Action: |
494 action = self.GetActionConnector() |
503 action = self.GetActionConnected() |
495 if action: |
504 if action: |
496 action_block = action.GetParentBlock() |
505 action_block = action.GetParentBlock() |
497 action_block.RefreshModel(False) |
506 action_block.RefreshModel(False) |
498 # If step has moved, refresh the model of wires connected to output |
507 # If step has moved, refresh the model of wires connected to output |
499 if move: |
508 if move: |
746 condition_pos = self.Condition.GetRelPosition() |
755 condition_pos = self.Condition.GetRelPosition() |
747 if position.x == self.Pos.x + condition_pos.x and position.y == self.Pos.y + condition_pos.y: |
756 if position.x == self.Pos.x + condition_pos.x and position.y == self.Pos.y + condition_pos.y: |
748 return self.Condition |
757 return self.Condition |
749 return None |
758 return None |
750 |
759 |
|
760 # Returns the transition condition connector |
|
761 def GetConditionConnector(self): |
|
762 if self.Type == "connection": |
|
763 return self.Condition |
|
764 return None |
|
765 |
751 # Returns input and output transition connectors |
766 # Returns input and output transition connectors |
752 def GetConnectors(self): |
767 def GetConnectors(self): |
753 connectors = {"input":self.Input,"output":self.Output} |
768 return {"inputs": [self.Input], "outputs": [self.Output]} |
754 if self.Type == "connection": |
769 |
755 connectors["connection"] = self.Condition |
|
756 return connectors |
|
757 |
|
758 # Test if point given is on transition input or output connector |
770 # Test if point given is on transition input or output connector |
759 def TestConnector(self, pt, direction = None, exclude=True): |
771 def TestConnector(self, pt, direction = None, exclude=True): |
760 # Test input connector |
772 # Test input connector |
761 if self.Input.TestPoint(pt, direction, exclude): |
773 if self.Input.TestPoint(pt, direction, exclude): |
762 return self.Input |
774 return self.Input |
1204 return output |
1216 return output |
1205 return None |
1217 return None |
1206 |
1218 |
1207 # Returns input and output divergence connectors |
1219 # Returns input and output divergence connectors |
1208 def GetConnectors(self): |
1220 def GetConnectors(self): |
1209 return {"inputs":self.Inputs,"outputs":self.Outputs} |
1221 return {"inputs": self.Inputs, "outputs": self.Outputs} |
1210 |
1222 |
1211 # Test if point given is on divergence input or output connector |
1223 # Test if point given is on divergence input or output connector |
1212 def TestConnector(self, pt, direction = None, exclude=True): |
1224 def TestConnector(self, pt, direction = None, exclude=True): |
1213 # Test input connector |
1225 # Test input connector |
1214 for input in self.Inputs: |
1226 for input in self.Inputs: |
1551 |
1563 |
1552 # Returns input jump connector |
1564 # Returns input jump connector |
1553 def GetConnector(self, position = None, name = None): |
1565 def GetConnector(self, position = None, name = None): |
1554 return self.Input |
1566 return self.Input |
1555 |
1567 |
|
1568 # Returns all the jump connectors |
|
1569 def GetConnectors(self): |
|
1570 return {"inputs": [self.Input], "outputs": []} |
|
1571 |
1556 # Test if point given is on jump input connector |
1572 # Test if point given is on jump input connector |
1557 def TestConnector(self, pt, direction = None, exclude = True): |
1573 def TestConnector(self, pt, direction = None, exclude = True): |
1558 # Test input connector |
1574 # Test input connector |
1559 if self.Input and self.Input.TestPoint(pt, direction, exclude): |
1575 if self.Input and self.Input.TestPoint(pt, direction, exclude): |
1560 return self.Input |
1576 return self.Input |
1779 self.Input.MoveConnected(exclude) |
1795 self.Input.MoveConnected(exclude) |
1780 |
1796 |
1781 # Returns input action block connector |
1797 # Returns input action block connector |
1782 def GetConnector(self, position = None, name = None): |
1798 def GetConnector(self, position = None, name = None): |
1783 return self.Input |
1799 return self.Input |
|
1800 |
|
1801 # Returns all the action block connectors |
|
1802 def GetConnectors(self): |
|
1803 return {"inputs": [self.Input], "outputs": []} |
1784 |
1804 |
1785 # Test if point given is on action block input connector |
1805 # Test if point given is on action block input connector |
1786 def TestConnector(self, pt, direction = None, exclude = True): |
1806 def TestConnector(self, pt, direction = None, exclude = True): |
1787 # Test input connector |
1807 # Test input connector |
1788 if self.Input.TestPoint(pt, direction, exclude): |
1808 if self.Input.TestPoint(pt, direction, exclude): |