25 import wx |
25 import wx |
26 |
26 |
27 from graphics.GraphicCommons import * |
27 from graphics.GraphicCommons import * |
28 from plcopen.structures import * |
28 from plcopen.structures import * |
29 |
29 |
30 #------------------------------------------------------------------------------- |
30 |
|
31 # ------------------------------------------------------------------------------- |
31 # Function Block Diagram Block |
32 # Function Block Diagram Block |
32 #------------------------------------------------------------------------------- |
33 # ------------------------------------------------------------------------------- |
33 |
34 |
34 |
35 |
35 def TestConnectorName(name, block_type): |
36 def TestConnectorName(name, block_type): |
36 return name in ["OUT", "MN", "MX"] or name.startswith("IN") and (block_type, name) != ("EXPT", "IN2") |
37 return name in ["OUT", "MN", "MX"] or name.startswith("IN") and (block_type, name) != ("EXPT", "IN2") |
37 |
38 |
493 if not getattr(dc, "printing", False): |
494 if not getattr(dc, "printing", False): |
494 DrawHighlightedText(dc, self.Name, self.Highlights.get("name", []), name_pos[0], name_pos[1]) |
495 DrawHighlightedText(dc, self.Name, self.Highlights.get("name", []), name_pos[0], name_pos[1]) |
495 DrawHighlightedText(dc, self.Type, self.Highlights.get("type", []), type_pos[0], type_pos[1]) |
496 DrawHighlightedText(dc, self.Type, self.Highlights.get("type", []), type_pos[0], type_pos[1]) |
496 |
497 |
497 |
498 |
498 #------------------------------------------------------------------------------- |
499 # ------------------------------------------------------------------------------- |
499 # Function Block Diagram Variable |
500 # Function Block Diagram Variable |
500 #------------------------------------------------------------------------------- |
501 # ------------------------------------------------------------------------------- |
501 |
502 |
502 |
503 |
503 class FBD_Variable(Graphic_Element): |
504 class FBD_Variable(Graphic_Element): |
504 """ |
505 """ |
505 Class that implements the graphic representation of a variable |
506 Class that implements the graphic representation of a variable |
627 # Returns the block connector that starts with the point given if it exists |
628 # Returns the block connector that starts with the point given if it exists |
628 def GetConnector(self, position, name=None): |
629 def GetConnector(self, position, name=None): |
629 # if a name is given |
630 # if a name is given |
630 if name is not None: |
631 if name is not None: |
631 # Test input and output connector if they exists |
632 # Test input and output connector if they exists |
632 #if self.Input and name == self.Input.GetName(): |
633 # if self.Input and name == self.Input.GetName(): |
633 # return self.Input |
634 # return self.Input |
634 if self.Output and name == self.Output.GetName(): |
635 if self.Output and name == self.Output.GetName(): |
635 return self.Output |
636 return self.Output |
636 connectors = [] |
637 connectors = [] |
637 # Test input connector if it exists |
638 # Test input connector if it exists |
789 dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0], |
790 dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0], |
790 self.Pos.y + self.Size[1] + 2) |
791 self.Pos.y + self.Size[1] + 2) |
791 if not getattr(dc, "printing", False): |
792 if not getattr(dc, "printing", False): |
792 DrawHighlightedText(dc, self.Name, self.Highlights, text_pos[0], text_pos[1]) |
793 DrawHighlightedText(dc, self.Name, self.Highlights, text_pos[0], text_pos[1]) |
793 |
794 |
794 #------------------------------------------------------------------------------- |
795 |
|
796 # ------------------------------------------------------------------------------- |
795 # Function Block Diagram Connector |
797 # Function Block Diagram Connector |
796 #------------------------------------------------------------------------------- |
798 # ------------------------------------------------------------------------------- |
797 |
799 |
798 |
800 |
799 class FBD_Connector(Graphic_Element): |
801 class FBD_Connector(Graphic_Element): |
800 """ |
802 """ |
801 Class that implements the graphic representation of a connection |
803 Class that implements the graphic representation of a connection |