equal
deleted
inserted
replaced
33 if isinstance(block, SFC_Step): |
33 if isinstance(block, SFC_Step): |
34 return SFC_WIRE_MIN_SIZE + block.GetActionExtraLineNumber() * SFC_ACTION_MIN_SIZE[1] |
34 return SFC_WIRE_MIN_SIZE + block.GetActionExtraLineNumber() * SFC_ACTION_MIN_SIZE[1] |
35 else: |
35 else: |
36 return SFC_WIRE_MIN_SIZE |
36 return SFC_WIRE_MIN_SIZE |
37 |
37 |
38 #------------------------------------------------------------------------------- |
38 # ------------------------------------------------------------------------------- |
39 # Sequencial Function Chart Step |
39 # Sequencial Function Chart Step |
40 #------------------------------------------------------------------------------- |
40 # ------------------------------------------------------------------------------- |
41 |
41 |
42 |
42 |
43 class SFC_Step(Graphic_Element, DebugDataConsumer): |
43 class SFC_Step(Graphic_Element, DebugDataConsumer): |
44 """ |
44 """ |
45 Class that implements the graphic representation of a step |
45 Class that implements the graphic representation of a step |
219 else: |
219 else: |
220 bbx_y = self.Pos.y - CONNECTOR_SIZE |
220 bbx_y = self.Pos.y - CONNECTOR_SIZE |
221 bbx_height = self.Size[1] + CONNECTOR_SIZE |
221 bbx_height = self.Size[1] + CONNECTOR_SIZE |
222 if self.Output: |
222 if self.Output: |
223 bbx_height += CONNECTOR_SIZE |
223 bbx_height += CONNECTOR_SIZE |
224 #self.BoundingBox = wx.Rect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1) |
224 # self.BoundingBox = wx.Rect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1) |
225 self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
225 self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
226 |
226 |
227 # Refresh the positions of the step connectors |
227 # Refresh the positions of the step connectors |
228 def RefreshConnectors(self): |
228 def RefreshConnectors(self): |
229 scaling = self.Parent.GetScaling() |
229 scaling = self.Parent.GetScaling() |
255 # Returns the step connector that starts with the point given if it exists |
255 # Returns the step connector that starts with the point given if it exists |
256 def GetConnector(self, position, name=None): |
256 def GetConnector(self, position, name=None): |
257 # if a name is given |
257 # if a name is given |
258 if name is not None: |
258 if name is not None: |
259 # Test input, output and action connector if they exists |
259 # Test input, output and action connector if they exists |
260 #if self.Input and name == self.Input.GetName(): |
260 # if self.Input and name == self.Input.GetName(): |
261 # return self.Input |
261 # return self.Input |
262 if self.Output and name == self.Output.GetName(): |
262 if self.Output and name == self.Output.GetName(): |
263 return self.Output |
263 return self.Output |
264 if self.Action and name == self.Action.GetName(): |
264 if self.Action and name == self.Action.GetName(): |
265 return self.Action |
265 return self.Action |
566 |
566 |
567 if not getattr(dc, "printing", False): |
567 if not getattr(dc, "printing", False): |
568 DrawHighlightedText(dc, self.Name, self.Highlights, name_pos[0], name_pos[1]) |
568 DrawHighlightedText(dc, self.Name, self.Highlights, name_pos[0], name_pos[1]) |
569 |
569 |
570 |
570 |
571 #------------------------------------------------------------------------------- |
571 # ------------------------------------------------------------------------------- |
572 # Sequencial Function Chart Transition |
572 # Sequencial Function Chart Transition |
573 #------------------------------------------------------------------------------- |
573 # ------------------------------------------------------------------------------- |
574 |
574 |
575 |
575 |
576 class SFC_Transition(Graphic_Element, DebugDataConsumer): |
576 class SFC_Transition(Graphic_Element, DebugDataConsumer): |
577 """ |
577 """ |
578 Class that implements the graphic representation of a transition |
578 Class that implements the graphic representation of a transition |
775 # Returns the transition connector that starts with the point given if it exists |
775 # Returns the transition connector that starts with the point given if it exists |
776 def GetConnector(self, position, name=None): |
776 def GetConnector(self, position, name=None): |
777 # if a name is given |
777 # if a name is given |
778 if name is not None: |
778 if name is not None: |
779 # Test input and output connector |
779 # Test input and output connector |
780 #if name == self.Input.GetName(): |
780 # if name == self.Input.GetName(): |
781 # return self.Input |
781 # return self.Input |
782 if name == self.Output.GetName(): |
782 if name == self.Output.GetName(): |
783 return self.Output |
783 return self.Output |
784 if self.Type == "connection" and name == self.Condition.GetName(): |
784 if self.Type == "connection" and name == self.Condition.GetName(): |
785 return self.Condition |
785 return self.Condition |
1035 if name == "priority": |
1035 if name == "priority": |
1036 DrawHighlightedText(dc, str(self.Priority), highlights, priority_pos[0], priority_pos[1]) |
1036 DrawHighlightedText(dc, str(self.Priority), highlights, priority_pos[0], priority_pos[1]) |
1037 else: |
1037 else: |
1038 DrawHighlightedText(dc, condition, highlights, condition_pos[0], condition_pos[1]) |
1038 DrawHighlightedText(dc, condition, highlights, condition_pos[0], condition_pos[1]) |
1039 |
1039 |
1040 #------------------------------------------------------------------------------- |
1040 |
|
1041 # ------------------------------------------------------------------------------- |
1041 # Sequencial Function Chart Divergence and Convergence |
1042 # Sequencial Function Chart Divergence and Convergence |
1042 #------------------------------------------------------------------------------- |
1043 # ------------------------------------------------------------------------------- |
1043 |
1044 |
1044 |
1045 |
1045 class SFC_Divergence(Graphic_Element): |
1046 class SFC_Divergence(Graphic_Element): |
1046 """ |
1047 """ |
1047 Class that implements the graphic representation of a divergence or convergence, |
1048 Class that implements the graphic representation of a divergence or convergence, |
1247 # Returns the divergence connector that starts with the point given if it exists |
1248 # Returns the divergence connector that starts with the point given if it exists |
1248 def GetConnector(self, position, name=None): |
1249 def GetConnector(self, position, name=None): |
1249 # if a name is given |
1250 # if a name is given |
1250 if name is not None: |
1251 if name is not None: |
1251 # Test each input and output connector |
1252 # Test each input and output connector |
1252 #for input in self.Inputs: |
1253 # for input in self.Inputs: |
1253 # if name == input.GetName(): |
1254 # if name == input.GetName(): |
1254 # return input |
1255 # return input |
1255 for output in self.Outputs: |
1256 for output in self.Outputs: |
1256 if name == output.GetName(): |
1257 if name == output.GetName(): |
1257 return output |
1258 return output |
1498 input.Draw(dc) |
1499 input.Draw(dc) |
1499 for output in self.Outputs: |
1500 for output in self.Outputs: |
1500 output.Draw(dc) |
1501 output.Draw(dc) |
1501 |
1502 |
1502 |
1503 |
1503 #------------------------------------------------------------------------------- |
1504 # ------------------------------------------------------------------------------- |
1504 # Sequencial Function Chart Jump to Step |
1505 # Sequencial Function Chart Jump to Step |
1505 #------------------------------------------------------------------------------- |
1506 # ------------------------------------------------------------------------------- |
|
1507 |
1506 |
1508 |
1507 class SFC_Jump(Graphic_Element): |
1509 class SFC_Jump(Graphic_Element): |
1508 """ |
1510 """ |
1509 Class that implements the graphic representation of a jump to step |
1511 Class that implements the graphic representation of a jump to step |
1510 """ |
1512 """ |
1773 |
1775 |
1774 if not getattr(dc, "printing", False): |
1776 if not getattr(dc, "printing", False): |
1775 DrawHighlightedText(dc, self.Target, self.Highlights, target_pos[0], target_pos[1]) |
1777 DrawHighlightedText(dc, self.Target, self.Highlights, target_pos[0], target_pos[1]) |
1776 |
1778 |
1777 |
1779 |
1778 #------------------------------------------------------------------------------- |
1780 # ------------------------------------------------------------------------------- |
1779 # Sequencial Function Chart Action Block |
1781 # Sequencial Function Chart Action Block |
1780 #------------------------------------------------------------------------------- |
1782 # ------------------------------------------------------------------------------- |
1781 |
1783 |
1782 |
1784 |
1783 class SFC_ActionBlock(Graphic_Element): |
1785 class SFC_ActionBlock(Graphic_Element): |
1784 """ |
1786 """ |
1785 Class that implements the graphic representation of an action block |
1787 Class that implements the graphic representation of an action block |