688 |
688 |
689 # Returs the execution order |
689 # Returs the execution order |
690 def GetExecutionOrder(self): |
690 def GetExecutionOrder(self): |
691 return self.ExecutionOrder |
691 return self.ExecutionOrder |
692 |
692 |
693 # Changes the element size |
|
694 def SetSize(self, width, height): |
|
695 scaling = self.Parent.GetScaling() |
|
696 min_width, min_height = self.GetMinSize() |
|
697 if width < min_width: |
|
698 if self.Type == INPUT: |
|
699 posx = max(0, self.Pos.x + width - min_width) |
|
700 if scaling is not None: |
|
701 posx = round_scaling(posx, scaling[0]) |
|
702 self.Pos.x = posx |
|
703 elif self.Type == OUTPUT: |
|
704 posx = max(0, self.Pos.x + (width - min_width) / 2) |
|
705 if scaling is not None: |
|
706 posx = round_scaling(posx, scaling[0]) |
|
707 self.Pos.x = posx |
|
708 width = min_width |
|
709 if scaling is not None: |
|
710 width = round_scaling(width, scaling[0], 1) |
|
711 if height < min_height: |
|
712 posy = max(0, self.Pos.y + (height - min_height) / 2) |
|
713 if scaling is not None: |
|
714 posy = round_scaling(posy, scaling[1]) |
|
715 self.Pos.y = posy |
|
716 height = min_height |
|
717 if scaling is not None: |
|
718 height = round_scaling(height, scaling[1], 1) |
|
719 Graphic_Element.SetSize(self, width, height) |
|
720 |
|
721 # Returns the variable minimum size |
693 # Returns the variable minimum size |
722 def GetMinSize(self): |
694 def GetMinSize(self): |
723 return self.NameSize[0] + 10, self.NameSize[1] + 10 |
695 return self.NameSize[0] + 10, self.NameSize[1] + 10 |
|
696 |
|
697 # Set size of the variable to the minimum size |
|
698 def SetBestSize(self, scaling): |
|
699 if self.Type == INPUT: |
|
700 return Graphic_Element.SetBestSize(self, scaling, x_factor=1.) |
|
701 elif self.Type == OUTPUT: |
|
702 return Graphic_Element.SetBestSize(self, scaling, x_factor=0.) |
|
703 else: |
|
704 return Graphic_Element.SetBestSize(self, scaling) |
724 |
705 |
725 # Method called when a LeftDClick event have been generated |
706 # Method called when a LeftDClick event have been generated |
726 def OnLeftDClick(self, event, dc, scaling): |
707 def OnLeftDClick(self, event, dc, scaling): |
727 # Edit the variable properties |
708 # Edit the variable properties |
728 self.Parent.EditVariableContent(self) |
709 self.Parent.EditVariableContent(self) |
928 |
909 |
929 # Returns the connection name |
910 # Returns the connection name |
930 def GetName(self): |
911 def GetName(self): |
931 return self.Name |
912 return self.Name |
932 |
913 |
933 # Changes the element size |
914 # Set size of the variable to the minimum size |
934 def SetSize(self, width, height): |
915 def SetBestSize(self, scaling): |
935 scaling = self.Parent.GetScaling() |
916 if self.Type == CONTINUATION: |
936 min_width, min_height = self.GetMinSize() |
917 return Graphic_Element.SetBestSize(self, scaling, x_factor=1.) |
937 if width < min_width: |
918 else: |
938 if self.Type == CONTINUATION: |
919 return Graphic_Element.SetBestSize(self, scaling, x_factor=0.) |
939 posx = max(0, self.Pos.x + width - min_width) |
|
940 if scaling is not None: |
|
941 posx = round_scaling(posx, scaling[0]) |
|
942 self.Pos.x = posx |
|
943 width = min_width |
|
944 if scaling is not None: |
|
945 width = round_scaling(width, scaling[0], 1) |
|
946 if height < min_height: |
|
947 posy = max(0, self.Pos.y + (height - min_height) / 2) |
|
948 if scaling is not None: |
|
949 posy = round_scaling(posy, scaling[1]) |
|
950 self.Pos.y = posy |
|
951 height = min_height |
|
952 if scaling is not None: |
|
953 height = round_scaling(height, scaling[1], 1) |
|
954 Graphic_Element.SetSize(self, width, height) |
|
955 |
920 |
956 # Returns the connection minimum size |
921 # Returns the connection minimum size |
957 def GetMinSize(self): |
922 def GetMinSize(self): |
958 text_width, text_height = self.NameSize |
923 text_width, text_height = self.NameSize |
959 if text_height % 2 == 1: |
924 if text_height % 2 == 1: |