1701 rect = rect.Union(self.EndConnected.GetRedrawRect(movex, movey)) |
1701 rect = rect.Union(self.EndConnected.GetRedrawRect(movex, movey)) |
1702 if self.ValueSize is not None: |
1702 if self.ValueSize is not None: |
1703 width, height = self.ValueSize |
1703 width, height = self.ValueSize |
1704 if self.BoundingBox[2] > width * 4 or self.BoundingBox[3] > height * 4: |
1704 if self.BoundingBox[2] > width * 4 or self.BoundingBox[3] > height * 4: |
1705 x = self.Points[0].x + width * self.StartPoint[1][0] / 2 |
1705 x = self.Points[0].x + width * self.StartPoint[1][0] / 2 |
1706 y = self.Points[0].y + (height * self.StartPoint[1][1] - 1) / 2 |
1706 y = self.Points[0].y + (height * self.StartPoint[1][1] - 1) |
1707 rect = rect.Union(wx.Rect(x, y, width, height)) |
1707 rect = rect.Union(wx.Rect(x, y, width, height)) |
1708 x = self.Points[-1].x + width * self.EndPoint[1][0] / 2 |
1708 x = self.Points[-1].x + width * self.EndPoint[1][0] / 2 |
1709 y = self.Points[-1].y + (height * self.EndPoint[1][1] - 1) / 2 |
1709 y = self.Points[-1].y + (height * self.EndPoint[1][1] - 1) |
1710 rect = rect.Union(wx.Rect(x, y, width, height)) |
1710 rect = rect.Union(wx.Rect(x, y, width, height)) |
1711 else: |
1711 else: |
1712 middle = len(self.Segments) / 2 + len(self.Segments) % 2 - 1 |
1712 middle = len(self.Segments) / 2 + len(self.Segments) % 2 - 1 |
1713 x = self.Points[middle].x - width / 2 |
1713 x = (self.Points[middle].x + self.Points[middle + 1].x - width) / 2 |
1714 y = self.Points[middle].y - height / 2 |
1714 if self.BoundingBox[3] > height and self.Segments[middle] in [NORTH, SOUTH]: |
|
1715 y = (self.Points[middle].y + self.Points[middle + 1].y - height) / 2 |
|
1716 else: |
|
1717 y = self.Points[middle].y - height |
1715 rect = rect.Union(wx.Rect(x, y, width, height)) |
1718 rect = rect.Union(wx.Rect(x, y, width, height)) |
1716 return rect |
1719 return rect |
1717 |
1720 |
1718 def Clone(self, parent, connectors = {}, dx = 0, dy = 0): |
1721 def Clone(self, parent, connectors = {}, dx = 0, dy = 0): |
1719 start_connector = connectors.get(self.StartConnected, None) |
1722 start_connector = connectors.get(self.StartConnected, None) |
2741 dc.SetTextForeground(wx.NamedColour("purple")) |
2744 dc.SetTextForeground(wx.NamedColour("purple")) |
2742 if self.ValueSize is not None: |
2745 if self.ValueSize is not None: |
2743 width, height = self.ValueSize |
2746 width, height = self.ValueSize |
2744 if self.BoundingBox[2] > width * 4 or self.BoundingBox[3] > height * 4: |
2747 if self.BoundingBox[2] > width * 4 or self.BoundingBox[3] > height * 4: |
2745 x = self.Points[0].x + width * (self.StartPoint[1][0] - 1) / 2 |
2748 x = self.Points[0].x + width * (self.StartPoint[1][0] - 1) / 2 |
2746 y = self.Points[0].y + height * (self.StartPoint[1][1] - 1) / 2 |
2749 y = self.Points[0].y + height * (self.StartPoint[1][1] - 1) |
2747 dc.DrawText(self.ComputedValue, x, y) |
2750 dc.DrawText(self.ComputedValue, x, y) |
2748 x = self.Points[-1].x + width * (self.EndPoint[1][0] - 1) / 2 |
2751 x = self.Points[-1].x + width * (self.EndPoint[1][0] - 1) / 2 |
2749 y = self.Points[-1].y + height * (self.EndPoint[1][1] - 1) / 2 |
2752 y = self.Points[-1].y + height * (self.EndPoint[1][1] - 1) |
2750 dc.DrawText(self.ComputedValue, x, y) |
2753 dc.DrawText(self.ComputedValue, x, y) |
2751 else: |
2754 else: |
2752 middle = len(self.Segments) / 2 + len(self.Segments) % 2 - 1 |
2755 middle = len(self.Segments) / 2 + len(self.Segments) % 2 - 1 |
2753 x = (self.Points[middle].x + self.Points[middle + 1].x - width) / 2 |
2756 x = (self.Points[middle].x + self.Points[middle + 1].x - width) / 2 |
2754 y = (self.Points[middle].y + self.Points[middle + 1].y - height) / 2 |
2757 if self.BoundingBox[3] > height and self.Segments[middle] in [NORTH, SOUTH]: |
|
2758 y = (self.Points[middle].y + self.Points[middle + 1].y - height) / 2 |
|
2759 else: |
|
2760 y = self.Points[middle].y - height |
2755 dc.DrawText(self.ComputedValue, x, y) |
2761 dc.DrawText(self.ComputedValue, x, y) |
2756 dc.SetFont(self.Parent.GetFont()) |
2762 dc.SetFont(self.Parent.GetFont()) |
2757 dc.SetTextForeground(wx.BLACK) |
2763 dc.SetTextForeground(wx.BLACK) |
2758 |
2764 |
2759 |
2765 |