46 # LD constants |
46 # LD constants |
47 LD_LINE_SIZE = 40 # Distance between two lines in a ladder rung |
47 LD_LINE_SIZE = 40 # Distance between two lines in a ladder rung |
48 LD_ELEMENT_SIZE = (21, 15) # Size (width, height) of a ladder element (contact or coil) |
48 LD_ELEMENT_SIZE = (21, 15) # Size (width, height) of a ladder element (contact or coil) |
49 LD_WIRE_SIZE = 30 # Size of a wire between two contact |
49 LD_WIRE_SIZE = 30 # Size of a wire between two contact |
50 LD_WIRECOIL_SIZE = 70 # Size of a wire between a coil and a contact |
50 LD_WIRECOIL_SIZE = 70 # Size of a wire between a coil and a contact |
|
51 LD_POWERRAIL_WIDTH = 3 # Width of a Powerrail |
51 LD_OFFSET = (10, 10) # Distance (x, y) between each comment and rung of the ladder |
52 LD_OFFSET = (10, 10) # Distance (x, y) between each comment and rung of the ladder |
52 LD_COMMENT_DEFAULTSIZE = (600, 40) # Size (width, height) of a comment box |
53 LD_COMMENT_DEFAULTSIZE = (600, 40) # Size (width, height) of a comment box |
53 |
54 |
54 # SFC constants |
55 # SFC constants |
55 SFC_STEP_DEFAULT_SIZE = (40, 30) # Default size of a SFC step |
56 SFC_STEP_DEFAULT_SIZE = (40, 30) # Default size of a SFC step |
296 self.Size = wx.Size(0, 0) |
297 self.Size = wx.Size(0, 0) |
297 self.BoundingBox = wx.Rect(0, 0, 0, 0) |
298 self.BoundingBox = wx.Rect(0, 0, 0, 0) |
298 self.CurrentCursor = 0 |
299 self.CurrentCursor = 0 |
299 ResetCursors() |
300 ResetCursors() |
300 |
301 |
|
302 def GetDragging(self): |
|
303 return self.Dragging |
|
304 |
301 # Make a clone of this element |
305 # Make a clone of this element |
302 def Clone(self): |
306 def Clone(self): |
303 return Graphic_Element(self.Parent, self.Id) |
307 return Graphic_Element(self.Parent, self.Id) |
304 |
308 |
305 # Changes the block position |
309 # Changes the block position |
363 |
367 |
364 # Returns the bounding box |
368 # Returns the bounding box |
365 def GetBoundingBox(self): |
369 def GetBoundingBox(self): |
366 return self.BoundingBox |
370 return self.BoundingBox |
367 |
371 |
|
372 # Returns the RedrawRect |
|
373 def GetRedrawRect(self, movex = 0, movey = 0): |
|
374 rect = wx.Rect() |
|
375 rect.x = self.BoundingBox.x - HANDLE_SIZE - 2 - abs(movex) |
|
376 rect.y = self.BoundingBox.y - HANDLE_SIZE - 2 - abs(movey) |
|
377 rect.width = self.BoundingBox.width + 2 * (HANDLE_SIZE + abs(movex)) + 4 |
|
378 rect.height = self.BoundingBox.height + 2 * (HANDLE_SIZE + abs(movey)) + 4 |
|
379 return rect |
|
380 |
|
381 def Refresh(self, rect = None): |
|
382 self.Parent.RefreshRect(self.Parent.GetScrolledRect(self.GetRedrawRect())) |
|
383 |
368 # Change the variable that indicates if this element is selected |
384 # Change the variable that indicates if this element is selected |
369 def SetSelected(self, selected): |
385 def SetSelected(self, selected): |
370 self.Selected = selected |
386 self.Selected = selected |
|
387 self.Refresh() |
371 |
388 |
372 # Change the variable that indicates if this element is highlighted |
389 # Change the variable that indicates if this element is highlighted |
373 def SetHighlighted(self, highlighted): |
390 def SetHighlighted(self, highlighted): |
374 self.Highlighted = highlighted |
391 self.Highlighted = highlighted |
|
392 self.Refresh() |
375 |
393 |
376 # Test if the point is on a handle of this element |
394 # Test if the point is on a handle of this element |
377 def TestHandle(self, pt): |
395 def TestHandle(self, pt): |
378 extern_rect = wx.Rect(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, |
396 extern_rect = wx.Rect(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, |
379 self.BoundingBox.width + 2 * HANDLE_SIZE + 4, self.BoundingBox.height + 2 * HANDLE_SIZE + 4) |
397 self.BoundingBox.width + 2 * HANDLE_SIZE + 4, self.BoundingBox.height + 2 * HANDLE_SIZE + 4) |
463 # If a dragging have been initiated, refreshes the element state |
481 # If a dragging have been initiated, refreshes the element state |
464 if self.Dragging: |
482 if self.Dragging: |
465 dragx, dragy = self.ProcessDragging(movex, movey) |
483 dragx, dragy = self.ProcessDragging(movex, movey) |
466 self.oldPos.x += dragx |
484 self.oldPos.x += dragx |
467 self.oldPos.y += dragy |
485 self.oldPos.y += dragy |
468 return True |
486 return dragx, dragy |
|
487 return movex, movey |
469 # If cursor just pass over the element, changes the cursor if it is on a handle |
488 # If cursor just pass over the element, changes the cursor if it is on a handle |
470 else: |
489 else: |
471 pos = event.GetLogicalPosition(dc) |
490 pos = event.GetLogicalPosition(dc) |
472 handle = self.TestHandle(pos) |
491 handle = self.TestHandle(pos) |
473 # Find which type of handle have been clicked, |
492 # Find which type of handle have been clicked, |
474 # Save a resize event and change the cursor |
493 # Save a resize event and change the cursor |
475 cursor = HANDLE_CURSORS.get(handle, 0) |
494 cursor = HANDLE_CURSORS.get(handle, 0) |
476 if cursor != self.CurrentCursor: |
495 if cursor != self.CurrentCursor: |
477 self.Parent.SetCursor(CURSORS[cursor]) |
496 self.Parent.SetCursor(CURSORS[cursor]) |
478 self.CurrentCursor = cursor |
497 self.CurrentCursor = cursor |
479 return False |
498 return 0, 0 |
480 |
499 |
481 # Moves the element |
500 # Moves the element |
482 def Move(self, dx, dy, exclude = []): |
501 def Move(self, dx, dy, exclude = []): |
483 self.Pos.x += dx |
502 self.Pos.x += dx |
484 self.Pos.y += dy |
503 self.Pos.y += dy |
534 def RefreshModel(self, move=True): |
553 def RefreshModel(self, move=True): |
535 pass |
554 pass |
536 |
555 |
537 # Draws the highlightment of this element if it is highlighted (can be overwritten) |
556 # Draws the highlightment of this element if it is highlighted (can be overwritten) |
538 def DrawHighlightment(self, dc): |
557 def DrawHighlightment(self, dc): |
539 if self.Highlighted: |
558 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
540 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
559 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
541 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
560 dc.SetLogicalFunction(wx.AND) |
542 dc.DrawRectangle(self.Pos.x - 2, self.Pos.y - 2, self.Size.width + 5, self.Size.height + 5) |
561 dc.DrawRectangle(self.Pos.x - 2, self.Pos.y - 2, self.Size.width + 5, self.Size.height + 5) |
|
562 dc.SetLogicalFunction(wx.COPY) |
543 |
563 |
544 # Draws the handles of this element if it is selected |
564 # Draws the handles of this element if it is selected |
545 def Draw(self, dc): |
565 def Draw(self, dc): |
|
566 if self.Highlighted: |
|
567 self.DrawHighlightment(dc) |
546 if self.Selected: |
568 if self.Selected: |
547 dc.SetPen(wx.BLACK_PEN) |
569 dc.SetPen(wx.BLACK_PEN) |
548 dc.SetBrush(wx.BLACK_BRUSH) |
570 dc.SetBrush(wx.BLACK_BRUSH) |
549 dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE) |
571 dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE) |
550 dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2, |
572 dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2, |
599 # Makes a clone of all the elements in this group |
621 # Makes a clone of all the elements in this group |
600 for element in self.Elements: |
622 for element in self.Elements: |
601 elements.append(element.Clone()) |
623 elements.append(element.Clone()) |
602 clone.SetElements(elements) |
624 clone.SetElements(elements) |
603 return clone |
625 return clone |
|
626 |
|
627 # Returns the RedrawRect |
|
628 def GetRedrawRect(self, movex = 0, movey = 0): |
|
629 rect = None |
|
630 for element in self.Elements: |
|
631 if rect is None: |
|
632 rect = element.GetRedrawRect(movex, movey) |
|
633 else: |
|
634 rect = rect.Union(element.GetRedrawRect(movex, movey)) |
|
635 return rect |
604 |
636 |
605 # Clean this group of elements |
637 # Clean this group of elements |
606 def Clean(self): |
638 def Clean(self): |
607 # Clean all the elements of the group |
639 # Clean all the elements of the group |
608 for element in self.Elements: |
640 for element in self.Elements: |
772 self.Edge = "none" |
804 self.Edge = "none" |
773 self.OneConnected = onlyone |
805 self.OneConnected = onlyone |
774 self.Pen = wx.BLACK_PEN |
806 self.Pen = wx.BLACK_PEN |
775 self.RefreshNameSize() |
807 self.RefreshNameSize() |
776 |
808 |
|
809 # Returns the RedrawRect |
|
810 def GetRedrawRect(self, movex = 0, movey = 0): |
|
811 parent_pos = self.ParentBlock.GetPosition() |
|
812 x = min(parent_pos[0] + self.Pos.x, parent_pos[0] + self.Pos.x + self.Direction[0] * CONNECTOR_SIZE) |
|
813 y = min(parent_pos[1] + self.Pos.y, parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE) |
|
814 if self.Direction[0] == 0: |
|
815 width = 5 |
|
816 else: |
|
817 width = CONNECTOR_SIZE |
|
818 if self.Direction[1] == 0: |
|
819 height = 5 |
|
820 else: |
|
821 height = CONNECTOR_SIZE |
|
822 return wx.Rect(x - abs(movex), y - abs(movey), width + 2 * abs(movex), height + 2 * abs(movey)) |
|
823 |
777 # Change the connector pen |
824 # Change the connector pen |
778 def SetPen(self, pen): |
825 def SetPen(self, pen): |
779 self.Pen = pen |
826 self.Pen = pen |
780 |
827 |
781 # Make a clone of the connector |
828 # Make a clone of the connector |
803 if IsEndType(self.Type): |
850 if IsEndType(self.Type): |
804 return self.Type |
851 return self.Type |
805 elif len(self.Wires) == 1: |
852 elif len(self.Wires) == 1: |
806 return self.Wires[0][0].GetOtherConnectedType(self.Wires[0][1]) |
853 return self.Wires[0][0].GetOtherConnectedType(self.Wires[0][1]) |
807 return self.Type |
854 return self.Type |
|
855 |
|
856 # Returns the connector type |
|
857 def GetConnectedRedrawRect(self, movex, movey): |
|
858 rect = None |
|
859 for wire, handle in self.Wires: |
|
860 if rect is None: |
|
861 rect = wire.GetRedrawRect() |
|
862 else: |
|
863 rect = rect.Union(wire.GetRedrawRect()) |
|
864 return rect |
808 |
865 |
809 # Returns if connector type is compatible with type given |
866 # Returns if connector type is compatible with type given |
810 def IsCompatible(self, type): |
867 def IsCompatible(self, type): |
811 reference = self.GetType() |
868 reference = self.GetType() |
812 return IsOfType(type, reference) or IsOfType(reference, type) |
869 return IsOfType(type, reference) or IsOfType(reference, type) |
945 self.ParentBlock.RefreshModel(False) |
1002 self.ParentBlock.RefreshModel(False) |
946 |
1003 |
947 # Highlight the parent block |
1004 # Highlight the parent block |
948 def HighlightParentBlock(self, highlight): |
1005 def HighlightParentBlock(self, highlight): |
949 self.ParentBlock.SetHighlighted(highlight) |
1006 self.ParentBlock.SetHighlighted(highlight) |
|
1007 self.ParentBlock.Refresh() |
950 |
1008 |
951 # Returns all the blocks connected to this connector |
1009 # Returns all the blocks connected to this connector |
952 def GetConnectedBlocks(self): |
1010 def GetConnectedBlocks(self): |
953 blocks = [] |
1011 blocks = [] |
954 for wire, handle in self.Wires: |
1012 for wire, handle in self.Wires: |
999 |
1057 |
1000 # Draws the highlightment of this element if it is highlighted |
1058 # Draws the highlightment of this element if it is highlighted |
1001 def DrawHighlightment(self, dc): |
1059 def DrawHighlightment(self, dc): |
1002 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
1060 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
1003 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
1061 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
|
1062 dc.SetLogicalFunction(wx.AND) |
1004 parent_pos = self.ParentBlock.GetPosition() |
1063 parent_pos = self.ParentBlock.GetPosition() |
1005 posx = parent_pos[0] + self.Pos.x |
1064 posx = parent_pos[0] + self.Pos.x |
1006 posy = parent_pos[1] + self.Pos.y |
1065 posy = parent_pos[1] + self.Pos.y |
1007 width = CONNECTOR_SIZE |
1066 width = CONNECTOR_SIZE |
1008 height = CONNECTOR_SIZE |
1067 height = CONNECTOR_SIZE |
1090 # Destructor of a wire |
1150 # Destructor of a wire |
1091 def __del__(self): |
1151 def __del__(self): |
1092 self.StartConnected = None |
1152 self.StartConnected = None |
1093 self.EndConnected = None |
1153 self.EndConnected = None |
1094 |
1154 |
|
1155 # Returns the RedrawRect |
|
1156 def GetRedrawRect(self, movex = 0, movey = 0): |
|
1157 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
|
1158 if self.StartConnected: |
|
1159 rect = rect.Union(self.StartConnected.GetRedrawRect(movex, movey)) |
|
1160 if self.EndConnected: |
|
1161 rect = rect.Union(self.EndConnected.GetRedrawRect(movex, movey)) |
|
1162 return rect |
|
1163 |
1095 # Forbids to change the wire position |
1164 # Forbids to change the wire position |
1096 def SetPosition(x, y): |
1165 def SetPosition(x, y): |
1097 pass |
1166 pass |
1098 |
1167 |
1099 # Forbids to change the wire size |
1168 # Forbids to change the wire size |
1173 if self.StartConnected: |
1242 if self.StartConnected: |
1174 self.StartConnected.SetPen(wx.BLACK_PEN) |
1243 self.StartConnected.SetPen(wx.BLACK_PEN) |
1175 if self.EndConnected: |
1244 if self.EndConnected: |
1176 self.EndConnected.SetPen(wx.RED_PEN) |
1245 self.EndConnected.SetPen(wx.RED_PEN) |
1177 self.SelectedSegment = segment |
1246 self.SelectedSegment = segment |
|
1247 self.Refresh() |
1178 |
1248 |
1179 # Reinitialize the wire points |
1249 # Reinitialize the wire points |
1180 def ResetPoints(self): |
1250 def ResetPoints(self): |
1181 if self.StartPoint and self.EndPoint: |
1251 if self.StartPoint and self.EndPoint: |
1182 self.Points = [self.StartPoint[0], self.EndPoint[0]] |
1252 self.Points = [self.StartPoint[0], self.EndPoint[0]] |
1784 wx.CallAfter(self.Parent.SetCursor, CURSORS[4]) |
1854 wx.CallAfter(self.Parent.SetCursor, CURSORS[4]) |
1785 elif result[1] in (EAST, WEST): |
1855 elif result[1] in (EAST, WEST): |
1786 if self.CurrentCursor != 5: |
1856 if self.CurrentCursor != 5: |
1787 self.CurrentCursor = 5 |
1857 self.CurrentCursor = 5 |
1788 wx.CallAfter(self.Parent.SetCursor, CURSORS[5]) |
1858 wx.CallAfter(self.Parent.SetCursor, CURSORS[5]) |
1789 return False |
1859 return 0, 0 |
1790 else: |
1860 else: |
1791 # Test if a point has been handled |
1861 # Test if a point has been handled |
1792 #result = self.TestPoint(pos) |
1862 #result = self.TestPoint(pos) |
1793 #if result != None: |
1863 #if result != None: |
1794 # if result == 0 and self.StartConnected: |
1864 # if result == 0 and self.StartConnected: |
1863 if self.EndConnected and self.EndPoint[1] in [WEST, NORTH]: |
1933 if self.EndConnected and self.EndPoint[1] in [WEST, NORTH]: |
1864 self.EndConnected.RefreshParentBlock() |
1934 self.EndConnected.RefreshParentBlock() |
1865 |
1935 |
1866 # Draws the highlightment of this element if it is highlighted |
1936 # Draws the highlightment of this element if it is highlighted |
1867 def DrawHighlightment(self, dc): |
1937 def DrawHighlightment(self, dc): |
1868 if self.Highlighted: |
1938 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
1869 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
1939 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
1870 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
1940 dc.SetLogicalFunction(wx.AND) |
1871 # Draw the start and end points if they are not connected or the mouse is over them |
1941 # Draw the start and end points if they are not connected or the mouse is over them |
1872 if len(self.Points) > 0 and (not self.StartConnected or self.OverStart): |
1942 if len(self.Points) > 0 and (not self.StartConnected or self.OverStart): |
1873 dc.DrawCircle(self.Points[0].x, self.Points[0].y, POINT_RADIUS + 2) |
1943 dc.DrawCircle(self.Points[0].x, self.Points[0].y, POINT_RADIUS + 2) |
1874 if len(self.Points) > 1 and (not self.EndConnected or self.OverEnd): |
1944 if len(self.Points) > 1 and (not self.EndConnected or self.OverEnd): |
1875 dc.DrawCircle(self.Points[-1].x, self.Points[-1].y, POINT_RADIUS + 2) |
1945 dc.DrawCircle(self.Points[-1].x, self.Points[-1].y, POINT_RADIUS + 2) |
1876 for i in xrange(len(self.Points) - 1): |
1946 for i in xrange(len(self.Points) - 1): |
1877 posx = min(self.Points[i].x, self.Points[i + 1].x) - 2 |
1947 posx = min(self.Points[i].x, self.Points[i + 1].x) - 2 |
1878 posy = min(self.Points[i].y, self.Points[i + 1].y) - 2 |
1948 posy = min(self.Points[i].y, self.Points[i + 1].y) - 2 |
1879 width = abs(self.Points[i + 1].x - self.Points[i].x) + 5 |
1949 width = abs(self.Points[i + 1].x - self.Points[i].x) + 5 |
1880 height = abs(self.Points[i + 1].y - self.Points[i].y) + 5 |
1950 height = abs(self.Points[i + 1].y - self.Points[i].y) + 5 |
1881 dc.DrawRectangle(posx, posy, width, height) |
1951 dc.DrawRectangle(posx, posy, width, height) |
1882 if self.StartConnected is not None: |
1952 if self.StartConnected is not None: |
1883 self.StartConnected.DrawHighlightment(dc) |
1953 self.StartConnected.DrawHighlightment(dc) |
1884 if self.EndConnected is not None: |
1954 if self.EndConnected is not None: |
1885 self.EndConnected.DrawHighlightment(dc) |
1955 self.EndConnected.DrawHighlightment(dc) |
|
1956 dc.SetLogicalFunction(wx.COPY) |
1886 |
1957 |
1887 # Draws the wire lines and points |
1958 # Draws the wire lines and points |
1888 def Draw(self, dc): |
1959 def Draw(self, dc): |
|
1960 Graphic_Element.Draw(self, dc) |
1889 dc.SetPen(wx.BLACK_PEN) |
1961 dc.SetPen(wx.BLACK_PEN) |
1890 dc.SetBrush(wx.BLACK_BRUSH) |
1962 dc.SetBrush(wx.BLACK_BRUSH) |
1891 # Draw the start and end points if they are not connected or the mouse is over them |
1963 # Draw the start and end points if they are not connected or the mouse is over them |
1892 if len(self.Points) > 0 and (not self.StartConnected or self.OverStart): |
1964 if len(self.Points) > 0 and (not self.StartConnected or self.OverStart): |
1893 dc.DrawCircle(self.Points[0].x, self.Points[0].y, POINT_RADIUS) |
1965 dc.DrawCircle(self.Points[0].x, self.Points[0].y, POINT_RADIUS) |
1901 dc.SetPen(wx.RED_PEN) |
1973 dc.SetPen(wx.RED_PEN) |
1902 dc.DrawLine(self.Points[self.SelectedSegment].x, self.Points[self.SelectedSegment].y, |
1974 dc.DrawLine(self.Points[self.SelectedSegment].x, self.Points[self.SelectedSegment].y, |
1903 self.Points[self.SelectedSegment + 1].x, self.Points[self.SelectedSegment + 1].y) |
1975 self.Points[self.SelectedSegment + 1].x, self.Points[self.SelectedSegment + 1].y) |
1904 if self.SelectedSegment == len(self.Segments) - 1: |
1976 if self.SelectedSegment == len(self.Segments) - 1: |
1905 dc.DrawPoint(self.Points[-1].x, self.Points[-1].y) |
1977 dc.DrawPoint(self.Points[-1].x, self.Points[-1].y) |
1906 Graphic_Element.Draw(self, dc) |
1978 |
1907 |
1979 |
1908 #------------------------------------------------------------------------------- |
1980 #------------------------------------------------------------------------------- |
1909 # Graphic comment element |
1981 # Graphic comment element |
1910 #------------------------------------------------------------------------------- |
1982 #------------------------------------------------------------------------------- |
1911 |
1983 |
2011 # Edit the comment content |
2083 # Edit the comment content |
2012 self.Parent.EditCommentContent(self) |
2084 self.Parent.EditCommentContent(self) |
2013 |
2085 |
2014 # Draws the highlightment of this element if it is highlighted |
2086 # Draws the highlightment of this element if it is highlighted |
2015 def DrawHighlightment(self, dc): |
2087 def DrawHighlightment(self, dc): |
2016 if self.Highlighted: |
2088 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
2017 dc.SetPen(wx.Pen(HIGHLIGHTCOLOR)) |
2089 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
2018 dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR)) |
2090 dc.SetLogicalFunction(wx.AND) |
2019 polygon = [wx.Point(self.Pos.x - 2, self.Pos.y - 2), |
2091 polygon = [wx.Point(self.Pos.x - 2, self.Pos.y - 2), |
2020 wx.Point(self.Pos.x + self.Size[0] - 8, self.Pos.y - 2), |
2092 wx.Point(self.Pos.x + self.Size[0] - 8, self.Pos.y - 2), |
2021 wx.Point(self.Pos.x + self.Size[0] + 2, self.Pos.y + 8), |
2093 wx.Point(self.Pos.x + self.Size[0] + 2, self.Pos.y + 8), |
2022 wx.Point(self.Pos.x + self.Size[0] + 2, self.Pos.y + self.Size[1] + 2), |
2094 wx.Point(self.Pos.x + self.Size[0] + 2, self.Pos.y + self.Size[1] + 2), |
2023 wx.Point(self.Pos.x - 2, self.Pos.y + self.Size[1] + 2)] |
2095 wx.Point(self.Pos.x - 2, self.Pos.y + self.Size[1] + 2)] |
2024 dc.DrawPolygon(polygon) |
2096 dc.DrawPolygon(polygon) |
|
2097 dc.SetLogicalFunction(wx.COPY) |
2025 |
2098 |
2026 # Draws the comment and its content |
2099 # Draws the comment and its content |
2027 def Draw(self, dc): |
2100 def Draw(self, dc): |
|
2101 Graphic_Element.Draw(self, dc) |
2028 dc.SetPen(wx.BLACK_PEN) |
2102 dc.SetPen(wx.BLACK_PEN) |
2029 dc.SetBrush(wx.WHITE_BRUSH) |
2103 dc.SetBrush(wx.WHITE_BRUSH) |
2030 # Draws the comment shape |
2104 # Draws the comment shape |
2031 polygon = [wx.Point(self.Pos.x, self.Pos.y), |
2105 polygon = [wx.Point(self.Pos.x, self.Pos.y), |
2032 wx.Point(self.Pos.x + self.Size[0] - 10, self.Pos.y), |
2106 wx.Point(self.Pos.x + self.Size[0] - 10, self.Pos.y), |