99 def Clone(self, parent, id = None, name = "Step", pos = None): |
99 def Clone(self, parent, id = None, name = "Step", pos = None): |
100 step = SFC_Step(parent, name, self.Initial, id) |
100 step = SFC_Step(parent, name, self.Initial, id) |
101 step.SetSize(self.Size[0], self.Size[1]) |
101 step.SetSize(self.Size[0], self.Size[1]) |
102 if pos is not None: |
102 if pos is not None: |
103 step.SetPosition(pos.x, pos.y) |
103 step.SetPosition(pos.x, pos.y) |
|
104 else: |
|
105 step.SetPosition(self.Pos.x, self.Pos.y) |
104 if self.Input: |
106 if self.Input: |
105 step.Input = self.Input.Clone(step) |
107 step.Input = self.Input.Clone(step) |
106 if self.Output: |
108 if self.Output: |
107 step.Output = self.Output.Clone(step) |
109 step.Output = self.Output.Clone(step) |
108 if self.Action: |
110 if self.Action: |
109 step.Action = self.Action.Clone(step) |
111 step.Action = self.Action.Clone(step) |
110 return step |
112 return step |
|
113 |
|
114 def GetConnectorTranslation(self, element): |
|
115 connectors = {} |
|
116 if self.Input is not None: |
|
117 connector[self.Input] = element.Input |
|
118 if self.Output is not None: |
|
119 connectors[self.Output] = element.Output |
|
120 if self.Action is not None: |
|
121 connectors[self.Action] = element.Action |
|
122 return connectors |
111 |
123 |
112 # Returns the RedrawRect |
124 # Returns the RedrawRect |
113 def GetRedrawRect(self, movex = 0, movey = 0): |
125 def GetRedrawRect(self, movex = 0, movey = 0): |
114 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
126 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
115 if self.Input: |
127 if self.Input: |
587 def Clone(self, parent, id = None, pos = None): |
599 def Clone(self, parent, id = None, pos = None): |
588 transition = SFC_Transition(parent, self.Type, self.Condition, self.Priority, id) |
600 transition = SFC_Transition(parent, self.Type, self.Condition, self.Priority, id) |
589 transition.SetSize(self.Size[0], self.Size[1]) |
601 transition.SetSize(self.Size[0], self.Size[1]) |
590 if pos is not None: |
602 if pos is not None: |
591 transition.SetPosition(pos.x, pos.y) |
603 transition.SetPosition(pos.x, pos.y) |
|
604 else: |
|
605 transition.SetPosition(self.Pos.x, self.Pos.y) |
592 transition.Input = self.Input.Clone(transition) |
606 transition.Input = self.Input.Clone(transition) |
593 transition.Output = self.Output.Clone(transition) |
607 transition.Output = self.Output.Clone(transition) |
594 if self.Type == "connection": |
608 if self.Type == "connection": |
595 transition.Condition = self.Condition.Clone(transition) |
609 transition.Condition = self.Condition.Clone(transition) |
596 return transition |
610 return transition |
|
611 |
|
612 def GetConnectorTranslation(self, element): |
|
613 connectors = {self.Input : element.Input, self.Output : element.Output} |
|
614 if self.Type == "connection" and self.Condition is not None: |
|
615 connectors[self.Condition] = element.Condition |
|
616 return connectors |
597 |
617 |
598 # Returns the RedrawRect |
618 # Returns the RedrawRect |
599 def GetRedrawRect(self, movex = 0, movey = 0): |
619 def GetRedrawRect(self, movex = 0, movey = 0): |
600 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
620 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
601 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
621 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
1021 def Clone(self, parent, id = None, pos = None): |
1041 def Clone(self, parent, id = None, pos = None): |
1022 divergence = SFC_Divergence(parent, self.Type, max(len(self.Inputs), len(self.Outputs)), id) |
1042 divergence = SFC_Divergence(parent, self.Type, max(len(self.Inputs), len(self.Outputs)), id) |
1023 divergence.SetSize(self.Size[0], self.Size[1]) |
1043 divergence.SetSize(self.Size[0], self.Size[1]) |
1024 if pos is not None: |
1044 if pos is not None: |
1025 divergence.SetPosition(pos.x, pos.y) |
1045 divergence.SetPosition(pos.x, pos.y) |
|
1046 else: |
|
1047 divergence.SetPosition(self.Pos.x, self.Pos.y) |
1026 divergence.Inputs = [input.Clone(divergence) for input in self.Inputs] |
1048 divergence.Inputs = [input.Clone(divergence) for input in self.Inputs] |
1027 divergence.Outputs = [output.Clone(divergence) for output in self.Outputs] |
1049 divergence.Outputs = [output.Clone(divergence) for output in self.Outputs] |
1028 return divergence |
1050 return divergence |
|
1051 |
|
1052 def GetConnectorTranslation(self, element): |
|
1053 return dict(zip(self.Inputs + self.Outputs, element.Inputs + element.Outputs)) |
1029 |
1054 |
1030 # Returns the RedrawRect |
1055 # Returns the RedrawRect |
1031 def GetRedrawRect(self, movex = 0, movey = 0): |
1056 def GetRedrawRect(self, movex = 0, movey = 0): |
1032 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
1057 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
1033 if movex != 0 or movey != 0: |
1058 if movex != 0 or movey != 0: |
1451 def Clone(self, parent, id = None, pos = None): |
1476 def Clone(self, parent, id = None, pos = None): |
1452 jump = SFC_Jump(parent, self.Target, id) |
1477 jump = SFC_Jump(parent, self.Target, id) |
1453 jump.SetSize(self.Size[0], self.Size[1]) |
1478 jump.SetSize(self.Size[0], self.Size[1]) |
1454 if pos is not None: |
1479 if pos is not None: |
1455 jump.SetPosition(pos.x, pos.y) |
1480 jump.SetPosition(pos.x, pos.y) |
|
1481 else: |
|
1482 jump.SetPosition(self.Pos.x, self.Pos.y) |
1456 jump.Input = self.Input.Clone(jump) |
1483 jump.Input = self.Input.Clone(jump) |
1457 return jump |
1484 return jump |
|
1485 |
|
1486 def GetConnectorTranslation(self, element): |
|
1487 return {self.Input : element.Input} |
1458 |
1488 |
1459 # Returns the RedrawRect |
1489 # Returns the RedrawRect |
1460 def GetRedrawRect(self, movex = 0, movey = 0): |
1490 def GetRedrawRect(self, movex = 0, movey = 0): |
1461 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
1491 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
1462 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
1492 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
1692 actions = [action.copy() for action in self.Actions] |
1722 actions = [action.copy() for action in self.Actions] |
1693 action_block = SFC_ActionBlock(parent, actions, id) |
1723 action_block = SFC_ActionBlock(parent, actions, id) |
1694 action_block.SetSize(self.Size[0], self.Size[1]) |
1724 action_block.SetSize(self.Size[0], self.Size[1]) |
1695 if pos is not None: |
1725 if pos is not None: |
1696 action_block.SetPosition(pos.x, pos.y) |
1726 action_block.SetPosition(pos.x, pos.y) |
|
1727 else: |
|
1728 action_block.SetPosition(self.Pos.x, self.Pos.y) |
1697 action_block.Input = self.Input.Clone(action_block) |
1729 action_block.Input = self.Input.Clone(action_block) |
1698 return action_block |
1730 return action_block |
1699 |
1731 |
1700 # Returns the RedrawRect |
1732 def GetConnectorTranslation(self, element): |
|
1733 return {self.Input : element.Input} |
|
1734 |
|
1735 # Returns the RedrawRect |
1701 def GetRedrawRect(self, movex = 0, movey = 0): |
1736 def GetRedrawRect(self, movex = 0, movey = 0): |
1702 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
1737 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
1703 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
1738 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
1704 if movex != 0 or movey != 0: |
1739 if movex != 0 or movey != 0: |
1705 if self.Input.IsConnected(): |
1740 if self.Input.IsConnected(): |