--- a/graphics/GraphicCommons.py Fri Oct 19 17:08:46 2007 +0200
+++ b/graphics/GraphicCommons.py Wed Oct 24 15:59:46 2007 +0200
@@ -714,8 +714,10 @@
self.Pen = pen
# Make a clone of the connector
- def Clone(self):
- return Connector(self.ParentBlock, self.Name, self.Type, wx.Point(self.Pos[0], self.Pos[1]),
+ def Clone(self, parent = None):
+ if parent is None:
+ parent = self.ParentBlock
+ return Connector(parent, self.Name, self.Type, wx.Point(self.Pos[0], self.Pos[1]),
self.Direction, self.Negated)
# Returns the connector parent block
@@ -723,8 +725,8 @@
return self.ParentBlock
# Returns the connector type
- def GetType(self):
- if IsEndType(self.Type):
+ def GetType(self, raw = False):
+ if IsEndType(self.Type) or raw:
return self.Type
elif (self.Negated or self.Edge != "none") and IsOfType("BOOL", self.Type):
return "BOOL"
@@ -1562,12 +1564,20 @@
def MoveSegment(self, idx, movex, movey):
if 0 < idx < len(self.Segments) - 1:
if self.Segments[idx] in (NORTH, SOUTH):
+ start_x = self.Points[idx].x
self.Points[idx].x += movex
self.Points[idx + 1].x += movex
+ self.GeneratePoints()
+ if start_x != self.Points[idx].x:
+ return True, False
elif self.Segments[idx] in (EAST, WEST):
+ start_y = self.Points[idx].y
self.Points[idx].y += movey
self.Points[idx + 1].y += movey
- self.GeneratePoints()
+ self.GeneratePoints()
+ if start_y != self.Points[idx].y:
+ return False, True
+ return False, False
# Adds two points in the middle of the handled segment
def AddSegment(self):
@@ -1709,8 +1719,7 @@
return True, True
# A segment has been handled, move a segment
elif handle_type == HANDLE_SEGMENT:
- self.MoveSegment(handle[0], movex, movey)
- return True, True
+ return self.MoveSegment(handle[0], movex, movey)
# Execute the default method for a graphic element
else:
return Graphic_Element.ProcessDragging(self, movex, movey)
@@ -1762,6 +1771,12 @@
self.Pos = wx.Point(0, 0)
self.Size = wx.Size(0, 0)
+ # Make a clone of this comment
+ def Clone(self, id = None):
+ comment = Comment(self.Parent, self.Content, id)
+ comment.SetSize(self.Size[0], self.Size[1])
+ return comment
+
# Method for keeping compatibility with others
def Clean(self):
pass