399 diffy = wire_size - output_pos.y + current_pos.y |
399 diffy = wire_size - output_pos.y + current_pos.y |
400 if diffy != 0: |
400 if diffy != 0: |
401 if isinstance(output_block, SFC_Step): |
401 if isinstance(output_block, SFC_Step): |
402 output_block.MoveActionBlock((diffx, diffy)) |
402 output_block.MoveActionBlock((diffx, diffy)) |
403 wires[0][0].SetPoints([wx.Point(current_pos.x, current_pos.y + wire_size), |
403 wires[0][0].SetPoints([wx.Point(current_pos.x, current_pos.y + wire_size), |
404 wx.Point(current_pos.x, current_pos.y)]) |
404 wx.Point(current_pos.x, current_pos.y)]) |
405 if not isinstance(output_block, SFC_Divergence) or output_block.GetConnectors()["inputs"].index(output) == 0: |
405 if not isinstance(output_block, SFC_Divergence) or output_block.GetConnectors()["inputs"].index(output) == 0: |
406 output_block.Move(diffx, diffy, self.Parent.Wires) |
406 output_block.Move(diffx, diffy, self.Parent.Wires) |
407 output_block.RefreshOutputPosition((diffx, diffy)) |
407 output_block.RefreshOutputPosition((diffx, diffy)) |
408 else: |
408 else: |
409 output_block.RefreshPosition() |
409 output_block.RefreshPosition() |
1200 return self.BoundingBox.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) is not None |
1200 return self.BoundingBox.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) is not None |
1201 |
1201 |
1202 # Refresh the divergence bounding box |
1202 # Refresh the divergence bounding box |
1203 def RefreshBoundingBox(self): |
1203 def RefreshBoundingBox(self): |
1204 if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]: |
1204 if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]: |
1205 self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, |
1205 self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, |
1206 self.Size[0] + 1, self.Size[1] + 1) |
1206 self.Size[0] + 1, self.Size[1] + 1) |
1207 elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]: |
1207 elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]: |
1208 self.BoundingBox = wx.Rect(self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y, |
1208 self.BoundingBox = wx.Rect( |
|
1209 self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y, |
1209 self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 1) |
1210 self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 1) |
1210 |
1211 |
1211 # Refresh the position of wires connected to divergence |
1212 # Refresh the position of wires connected to divergence |
1212 def RefreshConnected(self, exclude=[]): |
1213 def RefreshConnected(self, exclude=[]): |
1213 for input in self.Inputs: |
1214 for input in self.Inputs: |
1591 # Refresh the jump bounding box |
1592 # Refresh the jump bounding box |
1592 def RefreshBoundingBox(self): |
1593 def RefreshBoundingBox(self): |
1593 text_width, text_height = self.Parent.GetTextExtent(self.Target) |
1594 text_width, text_height = self.Parent.GetTextExtent(self.Target) |
1594 # Calculate the bounding box size |
1595 # Calculate the bounding box size |
1595 bbx_width = self.Size[0] + 2 + text_width |
1596 bbx_width = self.Size[0] + 2 + text_width |
1596 self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE, |
1597 self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE, |
1597 bbx_width + 1, self.Size[1] + CONNECTOR_SIZE + 1) |
1598 bbx_width + 1, self.Size[1] + CONNECTOR_SIZE + 1) |
1598 |
1599 |
1599 # Returns the connector connected to input |
1600 # Returns the connector connected to input |
1600 def GetPreviousConnector(self): |
1601 def GetPreviousConnector(self): |
1601 wires = self.Input.GetWires() |
1602 wires = self.Input.GetWires() |
1602 if len(wires) == 1: |
1603 if len(wires) == 1: |
1915 self.ColSize[2] = max(self.ColSize[2], width + 10) |
1916 self.ColSize[2] = max(self.ColSize[2], width + 10) |
1916 min_height += row_height + 5 |
1917 min_height += row_height + 5 |
1917 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
1918 if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: |
1918 self.Size = wx.Size(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], max(min_height, SFC_ACTION_MIN_SIZE[1], self.Size[1])) |
1919 self.Size = wx.Size(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], max(min_height, SFC_ACTION_MIN_SIZE[1], self.Size[1])) |
1919 self.MinSize = max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], |
1920 self.MinSize = max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], |
1920 SFC_ACTION_MIN_SIZE[0]), max(SFC_ACTION_MIN_SIZE[1], min_height) |
1921 SFC_ACTION_MIN_SIZE[0]), max(SFC_ACTION_MIN_SIZE[1], min_height) |
1921 self.RefreshBoundingBox() |
1922 self.RefreshBoundingBox() |
1922 else: |
1923 else: |
1923 self.Size = wx.Size(max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], |
1924 self.Size = wx.Size(max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], |
1924 SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1]) |
1925 SFC_ACTION_MIN_SIZE[0]), |
|
1926 len(self.Actions) * SFC_ACTION_MIN_SIZE[1]) |
1925 self.MinSize = max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], |
1927 self.MinSize = max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2], |
1926 SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1] |
1928 SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1] |
1927 self.RefreshBoundingBox() |
1929 self.RefreshBoundingBox() |
1928 if self.Input is not None: |
1930 if self.Input is not None: |
1929 wires = self.Input.GetWires() |
1931 wires = self.Input.GetWires() |
1930 if len(wires) == 1: |
1932 if len(wires) == 1: |
1931 input_block = wires[0][0].GetOtherConnected(self.Input).GetParentBlock() |
1933 input_block = wires[0][0].GetOtherConnected(self.Input).GetParentBlock() |
2016 dc.SetBrush(wx.WHITE_BRUSH) |
2018 dc.SetBrush(wx.WHITE_BRUSH) |
2017 colsize = [self.ColSize[0], self.Size[0] - self.ColSize[0] - self.ColSize[2], self.ColSize[2]] |
2019 colsize = [self.ColSize[0], self.Size[0] - self.ColSize[0] - self.ColSize[2], self.ColSize[2]] |
2018 # Draw plain rectangle for representing the action block |
2020 # Draw plain rectangle for representing the action block |
2019 dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
2021 dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1) |
2020 dc.DrawLine(self.Pos.x + colsize[0], self.Pos.y, |
2022 dc.DrawLine(self.Pos.x + colsize[0], self.Pos.y, |
2021 self.Pos.x + colsize[0], self.Pos.y + self.Size[1]) |
2023 self.Pos.x + colsize[0], self.Pos.y + self.Size[1]) |
2022 dc.DrawLine(self.Pos.x + colsize[0] + colsize[1], self.Pos.y, |
2024 dc.DrawLine(self.Pos.x + colsize[0] + colsize[1], self.Pos.y, |
2023 self.Pos.x + colsize[0] + colsize[1], self.Pos.y + self.Size[1]) |
2025 self.Pos.x + colsize[0] + colsize[1], self.Pos.y + self.Size[1]) |
2024 line_size = self.GetLineSize() |
2026 line_size = self.GetLineSize() |
2025 for i, action in enumerate(self.Actions): |
2027 for i, action in enumerate(self.Actions): |
2026 if i != 0: |
2028 if i != 0: |
2027 dc.DrawLine(self.Pos.x, self.Pos.y + i * line_size, |
2029 dc.DrawLine(self.Pos.x, self.Pos.y + i * line_size, |
2028 self.Pos.x + self.Size[0], self.Pos.y + i * line_size) |
2030 self.Pos.x + self.Size[0], self.Pos.y + i * line_size) |
2029 qualifier_size = dc.GetTextExtent(action.qualifier) |
2031 qualifier_size = dc.GetTextExtent(action.qualifier) |
2030 if action.duration != "": |
2032 if action.duration != "": |
2031 qualifier_pos = (self.Pos.x + (colsize[0] - qualifier_size[0]) / 2, |
2033 qualifier_pos = (self.Pos.x + (colsize[0] - qualifier_size[0]) / 2, |
2032 self.Pos.y + i * line_size + line_size / 2 - qualifier_size[1]) |
2034 self.Pos.y + i * line_size + line_size / 2 - qualifier_size[1]) |
2033 duration_size = dc.GetTextExtent(action.duration) |
2035 duration_size = dc.GetTextExtent(action.duration) |